diff options
author | Brian Coca <brian.coca+git@gmail.com> | 2017-01-19 19:01:58 -0500 |
---|---|---|
committer | Brian Coca <brian.coca+git@gmail.com> | 2017-01-19 19:37:36 -0500 |
commit | bcdfdc0cc33155598edfd4752db85c6358b17864 (patch) | |
tree | c28c32c8be9312a11496d0406f1459b8a23c9549 /hacking | |
parent | b4fb4420bb8c76ec7853d5d1a14a1bc17c665c4e (diff) | |
download | ansible-bcdfdc0cc33155598edfd4752db85c6358b17864.tar.gz |
minor cleanups
removed redundant print/exits
removed unused import and var
Diffstat (limited to 'hacking')
-rwxr-xr-x | hacking/module_formatter.py | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/hacking/module_formatter.py b/hacking/module_formatter.py index 1ae4d2a2fb..33204ff1b7 100755 --- a/hacking/module_formatter.py +++ b/hacking/module_formatter.py @@ -38,7 +38,6 @@ from six import iteritems from ansible.errors import AnsibleError from ansible.module_utils._text import to_bytes from ansible.utils import module_docs -from ansible.utils.vars import merge_hash ##################################################################################### # constants and paths @@ -254,16 +253,13 @@ def process_module(module, options, env, template, outputname, module_map, alias # crash if module is missing documentation and not explicitly hidden from docs index if doc is None: - sys.stderr.write("*** ERROR: MODULE MISSING DOCUMENTATION: %s, %s ***\n" % (fname, module)) - sys.exit(1) + sys.exit("*** ERROR: MODULE MISSING DOCUMENTATION: %s, %s ***\n" % (fname, module)) if metadata is None: - sys.stderr.write("*** ERROR: MODULE MISSING METADATA: %s, %s ***\n" % (fname, module)) - sys.exit(1) + sys.exit("*** ERROR: MODULE MISSING METADATA: %s, %s ***\n" % (fname, module)) if deprecated and 'deprecated' not in doc: - sys.stderr.write("*** ERROR: DEPRECATED MODULE MISSING 'deprecated' DOCUMENTATION: %s, %s ***\n" % (fname, module)) - sys.exit(1) + sys.exit("*** ERROR: DEPRECATED MODULE MISSING 'deprecated' DOCUMENTATION: %s, %s ***\n" % (fname, module)) if module in aliases: doc['aliases'] = aliases[module] @@ -271,8 +267,7 @@ def process_module(module, options, env, template, outputname, module_map, alias all_keys = [] if not 'version_added' in doc: - sys.stderr.write("*** ERROR: missing version_added in: %s ***\n" % module) - sys.exit(1) + sys.exit("*** ERROR: missing version_added in: %s ***\n" % module) added = 0 if doc['version_added'] == 'historical': @@ -429,14 +424,11 @@ def validate_options(options): ''' validate option parser options ''' if not options.module_dir: - print("--module-dir is required", file=sys.stderr) - sys.exit(1) + sys.exit("--module-dir is required", file=sys.stderr) if not os.path.exists(options.module_dir): - print("--module-dir does not exist: %s" % options.module_dir, file=sys.stderr) - sys.exit(1) + sys.exit("--module-dir does not exist: %s" % options.module_dir, file=sys.stderr) if not options.template_dir: - print("--template-dir must be specified") - sys.exit(1) + sys.exit("--template-dir must be specified") ##################################################################################### @@ -471,7 +463,6 @@ def main(): # Import all the docs into memory # module_map = mod_info.copy() - skipped_modules = set() for modname in module_map: result = process_module(modname, options, env, template, outputname, module_map, aliases) |