minor cleanups

removed redundant print/exits
removed unused import and var
This commit is contained in:
Brian Coca 2017-01-19 19:01:58 -05:00
parent b4fb4420bb
commit bcdfdc0cc3

View file

@ -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)