mirror of
https://github.com/thegeeklab/ansible-doctor.git
synced 2024-11-24 13:50:42 +00:00
feat: add new CLI flag --no-role-detection to parse loose files (#135)
Co-authored-by: P. Tomas <ptomas@astr-ptomas.edcs.fr>
This commit is contained in:
parent
6941fdf448
commit
e07184fe6b
@ -68,6 +68,14 @@ class AnsibleDoctor:
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--version", action="version", version="%(prog)s {}".format(__version__)
|
"--version", action="version", version="%(prog)s {}".format(__version__)
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-n",
|
||||||
|
"--no-role-detection",
|
||||||
|
dest="no_role_detection",
|
||||||
|
action="store_true",
|
||||||
|
default=None,
|
||||||
|
help="disable role detection"
|
||||||
|
)
|
||||||
|
|
||||||
return parser.parse_args().__dict__
|
return parser.parse_args().__dict__
|
||||||
|
|
||||||
@ -82,10 +90,13 @@ class AnsibleDoctor:
|
|||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
self.log.sysexit_with_message("Can not set log level.\n{}".format(str(e)))
|
self.log.sysexit_with_message("Can not set log level.\n{}".format(str(e)))
|
||||||
|
|
||||||
if config.is_role:
|
if not config.config["no_role_detection"]:
|
||||||
self.logger.info("Ansible role detected")
|
if config.is_role:
|
||||||
|
self.logger.info("Ansible role detected")
|
||||||
|
else:
|
||||||
|
self.log.sysexit_with_message("No Ansible role detected")
|
||||||
else:
|
else:
|
||||||
self.log.sysexit_with_message("No Ansible role detected")
|
self.logger.info("Ansible role detection disabled")
|
||||||
|
|
||||||
self.logger.info("Using config file {}".format(config.config_file))
|
self.logger.info("Using config file {}".format(config.config_file))
|
||||||
|
|
||||||
|
@ -97,6 +97,12 @@ class Config():
|
|||||||
"file": True,
|
"file": True,
|
||||||
"type": environs.Env().list
|
"type": environs.Env().list
|
||||||
},
|
},
|
||||||
|
"no_role_detection": {
|
||||||
|
"default": False,
|
||||||
|
"env": "NO_ROLE_DETECTION",
|
||||||
|
"file": True,
|
||||||
|
"type": environs.Env().bool
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
ANNOTATIONS = {
|
ANNOTATIONS = {
|
||||||
|
Loading…
Reference in New Issue
Block a user