~andrew-haigh-b/cdts/bug1214896

« back to all changes in this revision

Viewing changes to checkbox-old/scripts/udev_resource

  • Committer: Andrew Haigh
  • Date: 2013-09-08 13:27:48 UTC
  • mfrom: (2277.1.14 checkbox-ihv-ng)
  • Revision ID: andrew.haigh@cellsoftware.co.uk-20130908132748-ohm168li3h0klywq
Catchup from checkbox-ihv-ng

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
# You should have received a copy of the GNU General Public License
18
18
# along with Checkbox.  If not, see <http://www.gnu.org/licenses/>.
19
19
#
 
20
import argparse
 
21
import shlex
20
22
 
21
23
from subprocess import check_output, CalledProcessError
22
24
 
39
41
 
40
42
 
41
43
def main():
 
44
    parser = argparse.ArgumentParser()
 
45
    parser.add_argument("-c", "--command", action='store', type=str,
 
46
                        default="udevadm info --export-db",
 
47
                        help="""Command to execute to get udevadm information.
 
48
                              Only change it if you know what you're doing.""")
 
49
    args = parser.parse_args()
42
50
    try:
43
 
        output = check_output(['udevadm', 'info', '--export-db'])
 
51
        output = check_output(shlex.split(args.command))
44
52
    except CalledProcessError as exc:
45
53
        raise SystemExit(exc)
46
54
    # Set the error policy to 'ignore' in order to let tests depending on this