diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-06-19 19:07:07 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-06-19 19:07:07 -0700 |
commit | a07ff5c4be32ae12aea2cc916c010c3b2b22f1b5 (patch) | |
tree | 1a54b5c0c7b7a7ae4a94a8703931eb7cdde8ed48 /bin | |
parent | b334a1035b645d9e727bdeb03e1fe3729bfc4e1a (diff) | |
download | vyos-cloud-init-a07ff5c4be32ae12aea2cc916c010c3b2b22f1b5.tar.gz vyos-cloud-init-a07ff5c4be32ae12aea2cc916c010c3b2b22f1b5.zip |
1. Use the help message to show the default
2. Add a mode option in to the 'config' subparser that allows the user to affect the transform selection phase
3. Some tiny pylint warnings.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/cloud-init2.py | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/bin/cloud-init2.py b/bin/cloud-init2.py index 1f938f01..10cf4614 100755 --- a/bin/cloud-init2.py +++ b/bin/cloud-init2.py @@ -167,7 +167,7 @@ def main_init(name, args): welcome(name) try: init.fetch() - except sources.DataSourceNotFoundException as e: + except sources.DataSourceNotFoundException: util.logexc(LOG, "No instance datasource found!") # TODO: Return 0 or 1?? return 1 @@ -223,25 +223,36 @@ def main(): version='%(prog)s ' + (version.version_string())) parser.add_argument('--file', '-f', action='append', dest='files', - help='additional configuration file to include', + help=('additional yaml configuration' + ' files to use'), type=argparse.FileType('rb')) - parser.add_argument('--debug', '-d', action='store_true', - help='show additional pre-action logging', + parser.add_argument('--debug', '-d', action='store_true', + help=('show additional pre-action' + ' logging (default: %(default)s)'), default=False) subparsers = parser.add_subparsers() + # Possible mode names + mode_names = ('init', 'config', 'final') + # Each action and its suboptions (if any) parser_init = subparsers.add_parser('init', help=('initializes cloud-init and' ' performs \'init\' transforms')) parser_init.add_argument("--local", '-l', action='store_true', - help="start in local mode", default=False) + help="start in local mode (default: %(default)s)", + default=False) # This is used so that we can know which action is selected parser_init.set_defaults(action='init') parser_config = subparsers.add_parser('config', help=('performs cloud-init ' '\'config\' transforms')) + parser_config.add_argument("--mode", '-m', action='store', + help=("transform configuration name " + "to use (default: %(default)s)"), + default='config', + choices=mode_names) parser_config.set_defaults(action='config') parser_final = subparsers.add_parser('final', |