diff --git a/ansiblelater/command/base.py b/ansiblelater/command/base.py index 0707164..fb5a4ba 100644 --- a/ansiblelater/command/base.py +++ b/ansiblelater/command/base.py @@ -27,25 +27,25 @@ def get_settings(args): def get_standards(filepath): - sys.path.append(os.path.abspath(os.path.expanduser(filepath))) - try: - standards = importlib.import_module("standards") - except ImportError as e: - utils.sysexit_with_message( - "Could not import standards from directory %s: %s" % (filepath, str(e))) + sys.path.append(os.path.abspath(os.path.expanduser(filepath))) + try: + standards = importlib.import_module("standards") + except ImportError as e: + utils.sysexit_with_message( + "Could not import standards from directory %s: %s" % (filepath, str(e))) - if getattr(standards, "ansible_min_version", None) and \ - LooseVersion(standards.ansible_min_version) > LooseVersion(ansible.__version__): - utils.sysexit_with_message("Standards require ansible version %s (current version %s). " - "Please upgrade ansible." % - (standards.ansible_min_version, ansible.__version__)) + if getattr(standards, "ansible_min_version", None) and \ + LooseVersion(standards.ansible_min_version) > LooseVersion(ansible.__version__): + utils.sysexit_with_message("Standards require ansible version %s (current version %s). " + "Please upgrade ansible." % + (standards.ansible_min_version, ansible.__version__)) - if getattr(standards, "ansible_review_min_version", None) and \ - LooseVersion(standards.ansible_review_min_version) > LooseVersion( - utils.get_property("__version__")): - utils.sysexit_with_message( - "Standards require ansible-later version %s (current version %s). " - "Please upgrade ansible-later." % - (standards.ansible_review_min_version, utils.get_property("__version__"))) + if getattr(standards, "ansible_review_min_version", None) and \ + LooseVersion(standards.ansible_review_min_version) > LooseVersion( + utils.get_property("__version__")): + utils.sysexit_with_message( + "Standards require ansible-later version %s (current version %s). " + "Please upgrade ansible-later." % + (standards.ansible_review_min_version, utils.get_property("__version__"))) - return standards.standards + return standards.standards diff --git a/ansiblelater/logger.py b/ansiblelater/logger.py index 73356b9..3fd24ea 100644 --- a/ansiblelater/logger.py +++ b/ansiblelater/logger.py @@ -27,11 +27,11 @@ colorama.init(autoreset=True, strip=not _should_do_markup()) def flag_extra(extra): """Ensure extra args are prefixed.""" - assert isinstance(extra, dict) - flagged = dict() - for key, value in iteritems(extra): - flagged["later_" + key] = value + + if isinstance(extra, dict): + for key, value in iteritems(extra): + flagged["later_" + key] = value return flagged