mirror of
https://github.com/thegeeklab/ansible-doctor.git
synced 2024-11-28 07:40:36 +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(
|
||||
"--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__
|
||||
|
||||
@ -82,10 +90,13 @@ class AnsibleDoctor:
|
||||
except ValueError as e:
|
||||
self.log.sysexit_with_message("Can not set log level.\n{}".format(str(e)))
|
||||
|
||||
if config.is_role:
|
||||
self.logger.info("Ansible role detected")
|
||||
if not config.config["no_role_detection"]:
|
||||
if config.is_role:
|
||||
self.logger.info("Ansible role detected")
|
||||
else:
|
||||
self.log.sysexit_with_message("No Ansible role detected")
|
||||
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))
|
||||
|
||||
|
@ -97,6 +97,12 @@ class Config():
|
||||
"file": True,
|
||||
"type": environs.Env().list
|
||||
},
|
||||
"no_role_detection": {
|
||||
"default": False,
|
||||
"env": "NO_ROLE_DETECTION",
|
||||
"file": True,
|
||||
"type": environs.Env().bool
|
||||
},
|
||||
}
|
||||
|
||||
ANNOTATIONS = {
|
||||
|
Loading…
Reference in New Issue
Block a user