diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2005-09-02 15:24:33 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2005-09-02 15:24:33 +0000 |
commit | d03782495068fc4d6fab04c8749253e4c5bbe28d (patch) | |
tree | 9b94ccedf98bb78daa2a3d3ce5312061b31ee06d /src | |
parent | ec5f020958a5b8123a273ac5857efa48d58cacc7 (diff) | |
download | bcfg2-d03782495068fc4d6fab04c8749253e4c5bbe28d.tar.gz bcfg2-d03782495068fc4d6fab04c8749253e4c5bbe28d.tar.bz2 bcfg2-d03782495068fc4d6fab04c8749253e4c5bbe28d.zip |
fix ctrl-c handling
(Logical change 1.294)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1169 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r-- | src/sbin/bcfg2 | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/sbin/bcfg2 b/src/sbin/bcfg2 index 9b8736f84..81936af89 100644 --- a/src/sbin/bcfg2 +++ b/src/sbin/bcfg2 @@ -5,6 +5,7 @@ __revision__ = '$Revision$' from getopt import getopt, GetoptError from os import popen, chmod, unlink +from signal import signal, SIGINT from sys import argv from tempfile import mktemp @@ -12,6 +13,10 @@ from elementtree.ElementTree import Element, XML, tostring from sss.ssslib import comm_lib +def cb_sigint_handler(signum, frame): + '''Exit upon CTRL-C''' + raise SystemExit, 1 + def load_toolset(toolset, config, clientsetup): '''Import client toolset modules''' if toolset == 'debian': @@ -67,6 +72,7 @@ def dgetopt(arglist, opt, vopt): if __name__ == '__main__': # parse command line options + signal(SIGINT, cb_sigint_handler) options = {'v':'verbose', 'q':'quick', 'd':'debug', 'n':'dryrun', 'B':'build', 'P':'paranoid'} doptions = {'b':'bundle', 'f':'file', 'c':'cache', 'p':'profile', 'i':'image', 'r':'remove'} setup = dgetopt(argv[1:], options, doptions) @@ -154,14 +160,16 @@ if __name__ == '__main__': # install incorrect aspects of configuration client.Install() - client.CondPrint('verbose', "--> %s of %s config elements correct"%(client.states.values().count(True), total)) + client.CondPrint('verbose', "--> %s of %s config elements correct" % + (client.states.values().count(True), total)) failed = [key for key, value in client.states.iteritems() if not value] if failed: client.CondPrint('verbose', "Failing Entries:") [client.CondPrint('verbose', "%s:%s" % (key.tag, key.get('name'))) for key in failed if key.tag != 'Package'] - [client.CondPrint('verbose', "%s:%s-%s"%(key.tag, key.get('name'), - key.get('version', 'unset'))) for key in failed if key.tag == 'Package'] + [client.CondPrint('verbose', "%s:%s-%s" % + (key.tag, key.get('name'), key.get('version', 'unset'))) + for key in failed if key.tag == 'Package'] else: client.CondPrint("verbose", "All entries correct") |