mirror of
https://github.com/thegeeklab/ansible-later.git
synced 2024-11-21 20:30:42 +00:00
add custom modules auto-detection
This commit is contained in:
parent
bec9789649
commit
d7dac43a72
@ -1,6 +1,2 @@
|
||||
* BUGFIX
|
||||
* fix typo in argparse description
|
||||
* INTERNAL
|
||||
* add markdown linting to CI (markdownlint-cli)
|
||||
* add spellchecking to CI (spellcheck-cli)
|
||||
* add broken link check to CI (broken-link-checker)
|
||||
* ENHANCEMENT
|
||||
* add custom modules auto-detection
|
||||
|
@ -88,6 +88,19 @@ class Settings(object):
|
||||
if cli_options and self._validate(cli_options):
|
||||
anyconfig.merge(defaults, cli_options, ac_merge=anyconfig.MS_DICTS)
|
||||
|
||||
library = os.path.relpath(os.path.normpath(os.path.join(os.getcwd(), "library")))
|
||||
autodetect = []
|
||||
if os.path.exists(library):
|
||||
autodetect = [
|
||||
os.path.splitext(f)[0]
|
||||
for f in os.listdir(library)
|
||||
if os.path.isfile(os.path.join(library, f)) and not f.startswith(".")
|
||||
]
|
||||
|
||||
for f in autodetect:
|
||||
if f not in defaults["ansible"]["custom_modules"]:
|
||||
defaults["ansible"]["custom_modules"].append(f)
|
||||
|
||||
return defaults
|
||||
|
||||
def _get_defaults(self):
|
||||
|
@ -8,9 +8,10 @@ title: Default settings
|
||||
{{< highlight YAML "linenos=table" >}}
|
||||
---
|
||||
ansible:
|
||||
# Add the name of used custom Ansible modules.
|
||||
# Otherwise ansible-later can't detect unknown modules
|
||||
# and will through an error.
|
||||
# Add the name of used custom Ansible modules. Otherwise ansible-later
|
||||
# can't detect unknown modules and will through an error.
|
||||
# Modules which are bundled with the role and placed in a './library'
|
||||
# directory will be auto-detected and don't need to be added to this list.
|
||||
custom_modules: []
|
||||
# Settings for variable formatting rule (ANSIBLE0004)
|
||||
double-braces:
|
||||
|
Loading…
Reference in New Issue
Block a user