mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-07-25 00:44:42 +00:00
Merge pull request #1112 from rjeffman/future_pylint
Bump linter versions.
This commit is contained in:
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
@@ -76,7 +76,7 @@ jobs:
|
|||||||
python-version: "3.x"
|
python-version: "3.x"
|
||||||
- name: Run pylint
|
- name: Run pylint
|
||||||
run: |
|
run: |
|
||||||
pip install pylint==2.14.4 wrapt==1.14.0
|
pip install pylint==2.17.2
|
||||||
pylint plugins roles --disable=import-error
|
pylint plugins roles --disable=import-error
|
||||||
|
|
||||||
shellcheck:
|
shellcheck:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ repos:
|
|||||||
pass_filenames: true
|
pass_filenames: true
|
||||||
files: \.(yaml|yml)$
|
files: \.(yaml|yml)$
|
||||||
exclude: /env[^/]*.(yaml|yml)$
|
exclude: /env[^/]*.(yaml|yml)$
|
||||||
entry: >-
|
entry: |-
|
||||||
env
|
env
|
||||||
ANSIBLE_LIBRARY=./plugins/modules
|
ANSIBLE_LIBRARY=./plugins/modules
|
||||||
ANSIBLE_MODULE_UTILS=./plugins/module_utils
|
ANSIBLE_MODULE_UTILS=./plugins/module_utils
|
||||||
@@ -21,12 +21,12 @@ repos:
|
|||||||
--parseable
|
--parseable
|
||||||
--nocolor
|
--nocolor
|
||||||
- repo: https://github.com/adrienverge/yamllint.git
|
- repo: https://github.com/adrienverge/yamllint.git
|
||||||
rev: v1.28.0
|
rev: v1.32.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: yamllint
|
- id: yamllint
|
||||||
files: \.(yaml|yml)$
|
files: \.(yaml|yml)$
|
||||||
- repo: https://github.com/pycqa/flake8
|
- repo: https://github.com/pycqa/flake8
|
||||||
rev: 5.0.3
|
rev: 6.0.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: flake8
|
||||||
- repo: https://github.com/pycqa/pydocstyle
|
- repo: https://github.com/pycqa/pydocstyle
|
||||||
@@ -34,7 +34,7 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: pydocstyle
|
- id: pydocstyle
|
||||||
- repo: https://github.com/pycqa/pylint
|
- repo: https://github.com/pycqa/pylint
|
||||||
rev: v2.14.4
|
rev: v2.17.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: pylint
|
- id: pylint
|
||||||
args:
|
args:
|
||||||
|
|||||||
@@ -121,8 +121,7 @@ class AutomountKey(IPAAnsibleModule):
|
|||||||
resp = self.ipa_command("automountkey_show", location, args)
|
resp = self.ipa_command("automountkey_show", location, args)
|
||||||
except ipalib_errors.NotFound:
|
except ipalib_errors.NotFound:
|
||||||
return None
|
return None
|
||||||
else:
|
return resp.get("result")
|
||||||
return resp.get("result")
|
|
||||||
|
|
||||||
def check_ipa_params(self):
|
def check_ipa_params(self):
|
||||||
invalid = []
|
invalid = []
|
||||||
|
|||||||
@@ -92,8 +92,7 @@ class AutomountLocation(IPAAnsibleModule):
|
|||||||
)
|
)
|
||||||
except ipalib_errors.NotFound:
|
except ipalib_errors.NotFound:
|
||||||
return None
|
return None
|
||||||
else:
|
return response.get("result", None)
|
||||||
return response.get("result", None)
|
|
||||||
|
|
||||||
def check_ipa_params(self):
|
def check_ipa_params(self):
|
||||||
if len(self.params_get("name")) == 0:
|
if len(self.params_get("name")) == 0:
|
||||||
|
|||||||
@@ -126,8 +126,7 @@ class AutomountMap(IPAAnsibleModule):
|
|||||||
)
|
)
|
||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
return None
|
return None
|
||||||
else:
|
return response["result"]
|
||||||
return response["result"]
|
|
||||||
|
|
||||||
def get_indirect_map_keys(self, location, name):
|
def get_indirect_map_keys(self, location, name):
|
||||||
"""Check if 'name' is an indirect map for 'parentmap'."""
|
"""Check if 'name' is an indirect map for 'parentmap'."""
|
||||||
|
|||||||
@@ -358,8 +358,7 @@ def get_netbios_name(module):
|
|||||||
_result = module.ipa_command_no_name("trustconfig_show", {"all": True})
|
_result = module.ipa_command_no_name("trustconfig_show", {"all": True})
|
||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
return None
|
return None
|
||||||
else:
|
return _result["result"]["ipantflatname"][0]
|
||||||
return _result["result"]["ipantflatname"][0]
|
|
||||||
|
|
||||||
|
|
||||||
def is_enable_sid(module):
|
def is_enable_sid(module):
|
||||||
@@ -477,7 +476,7 @@ def main():
|
|||||||
params = {}
|
params = {}
|
||||||
for x in field_map:
|
for x in field_map:
|
||||||
val = ansible_module.params_get(
|
val = ansible_module.params_get(
|
||||||
x, allow_empty_string=(x in allow_empty_string))
|
x, allow_empty_string=x in allow_empty_string)
|
||||||
|
|
||||||
if val is not None:
|
if val is not None:
|
||||||
params[field_map.get(x, x)] = val
|
params[field_map.get(x, x)] = val
|
||||||
@@ -620,7 +619,7 @@ def main():
|
|||||||
# boolean values, so we need to convert it to str
|
# boolean values, so we need to convert it to str
|
||||||
# for comparison.
|
# for comparison.
|
||||||
# See: https://github.com/freeipa/freeipa/pull/6294
|
# See: https://github.com/freeipa/freeipa/pull/6294
|
||||||
exit_args[k] = (str(value[0]).upper() == "TRUE")
|
exit_args[k] = str(value[0]).upper() == "TRUE"
|
||||||
else:
|
else:
|
||||||
if arg_type not in type_map:
|
if arg_type not in type_map:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
|
|||||||
@@ -134,8 +134,7 @@ def find_delegation(module, name):
|
|||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
# An exception is raised if delegation name is not found.
|
# An exception is raised if delegation name is not found.
|
||||||
return None
|
return None
|
||||||
else:
|
return _result["result"]
|
||||||
return _result["result"]
|
|
||||||
|
|
||||||
|
|
||||||
def gen_args(permission, attribute, membergroup, group):
|
def gen_args(permission, attribute, membergroup, group):
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ def main():
|
|||||||
invalid = [
|
invalid = [
|
||||||
"forwarders", "forwardpolicy", "skip_overlap_check", "permission"
|
"forwarders", "forwardpolicy", "skip_overlap_check", "permission"
|
||||||
]
|
]
|
||||||
wants_enable = (state == "enabled")
|
wants_enable = state == "enabled"
|
||||||
|
|
||||||
if operation == "del":
|
if operation == "del":
|
||||||
invalid = [
|
invalid = [
|
||||||
|
|||||||
@@ -1453,7 +1453,7 @@ def define_commands_for_present_state(module, zone_name, entry, res_find):
|
|||||||
else:
|
else:
|
||||||
# Create reverse records for existing records
|
# Create reverse records for existing records
|
||||||
for ipv in ['a', 'aaaa']:
|
for ipv in ['a', 'aaaa']:
|
||||||
record = ('%srecord' % ipv)
|
record = '%srecord' % ipv
|
||||||
if record in args and ('%s_extra_create_reverse' % ipv) in args:
|
if record in args and ('%s_extra_create_reverse' % ipv) in args:
|
||||||
cmds = create_reverse_ip_record(
|
cmds = create_reverse_ip_record(
|
||||||
module, zone_name, name, args[record])
|
module, zone_name, name, args[record])
|
||||||
|
|||||||
@@ -157,8 +157,7 @@ def find_idrange(module, name):
|
|||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
# An exception is raised if idrange name is not found.
|
# An exception is raised if idrange name is not found.
|
||||||
return None
|
return None
|
||||||
else:
|
return _result["result"]
|
||||||
return _result["result"]
|
|
||||||
|
|
||||||
|
|
||||||
def gen_args(
|
def gen_args(
|
||||||
|
|||||||
@@ -141,8 +141,7 @@ def find_idview(module, name):
|
|||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
# An exception is raised if idview name is not found.
|
# An exception is raised if idview name is not found.
|
||||||
return None
|
return None
|
||||||
else:
|
return _result["result"]
|
||||||
return _result["result"]
|
|
||||||
|
|
||||||
|
|
||||||
def gen_args(description, domain_resolution_order):
|
def gen_args(description, domain_resolution_order):
|
||||||
|
|||||||
@@ -86,8 +86,7 @@ def find_location(module, name):
|
|||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
# An exception is raised if location name is not found.
|
# An exception is raised if location name is not found.
|
||||||
return None
|
return None
|
||||||
else:
|
return _result["result"]
|
||||||
return _result["result"]
|
|
||||||
|
|
||||||
|
|
||||||
def gen_args(description):
|
def gen_args(description):
|
||||||
|
|||||||
@@ -164,8 +164,7 @@ def find_permission(module, name):
|
|||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
# An exception is raised if permission name is not found.
|
# An exception is raised if permission name is not found.
|
||||||
return None
|
return None
|
||||||
else:
|
return _result["result"]
|
||||||
return _result["result"]
|
|
||||||
|
|
||||||
|
|
||||||
def gen_args(right, attrs, bindtype, subtree,
|
def gen_args(right, attrs, bindtype, subtree,
|
||||||
|
|||||||
@@ -138,8 +138,7 @@ def find_privilege(module, name):
|
|||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
# An exception is raised if privilege name is not found.
|
# An exception is raised if privilege name is not found.
|
||||||
return None
|
return None
|
||||||
else:
|
return _result["result"]
|
||||||
return _result["result"]
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
@@ -143,8 +143,7 @@ def find_role(module, name):
|
|||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
# An exception is raised if role name is not found.
|
# An exception is raised if role name is not found.
|
||||||
return None
|
return None
|
||||||
else:
|
return _result["result"]
|
||||||
return _result["result"]
|
|
||||||
|
|
||||||
|
|
||||||
def gen_args(module):
|
def gen_args(module):
|
||||||
|
|||||||
@@ -123,8 +123,7 @@ def find_selfservice(module, name):
|
|||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
# An exception is raised if selfservice name is not found.
|
# An exception is raised if selfservice name is not found.
|
||||||
return None
|
return None
|
||||||
else:
|
return _result["result"]
|
||||||
return _result["result"]
|
|
||||||
|
|
||||||
|
|
||||||
def gen_args(permission, attribute):
|
def gen_args(permission, attribute):
|
||||||
|
|||||||
@@ -202,8 +202,7 @@ def find_server(module, name):
|
|||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
# An exception is raised if server name is not found.
|
# An exception is raised if server name is not found.
|
||||||
return None
|
return None
|
||||||
else:
|
return _result["result"]
|
||||||
return _result["result"]
|
|
||||||
|
|
||||||
|
|
||||||
def server_role_status(module, name):
|
def server_role_status(module, name):
|
||||||
@@ -218,8 +217,7 @@ def server_role_status(module, name):
|
|||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
# An exception is raised if server name is not found.
|
# An exception is raised if server name is not found.
|
||||||
return None
|
return None
|
||||||
else:
|
return _result["result"][0]
|
||||||
return _result["result"][0]
|
|
||||||
|
|
||||||
|
|
||||||
def gen_args(location, service_weight, no_members, delete_continue,
|
def gen_args(location, service_weight, no_members, delete_continue,
|
||||||
|
|||||||
@@ -414,15 +414,15 @@ def gen_args(pac_type, auth_ind, skip_host_check, force, requires_pre_auth,
|
|||||||
if auth_ind is not None:
|
if auth_ind is not None:
|
||||||
_args['krbprincipalauthind'] = auth_ind
|
_args['krbprincipalauthind'] = auth_ind
|
||||||
if skip_host_check is not None:
|
if skip_host_check is not None:
|
||||||
_args['skip_host_check'] = (skip_host_check)
|
_args['skip_host_check'] = skip_host_check
|
||||||
if force is not None:
|
if force is not None:
|
||||||
_args['force'] = (force)
|
_args['force'] = force
|
||||||
if requires_pre_auth is not None:
|
if requires_pre_auth is not None:
|
||||||
_args['ipakrbrequirespreauth'] = (requires_pre_auth)
|
_args['ipakrbrequirespreauth'] = requires_pre_auth
|
||||||
if ok_as_delegate is not None:
|
if ok_as_delegate is not None:
|
||||||
_args['ipakrbokasdelegate'] = (ok_as_delegate)
|
_args['ipakrbokasdelegate'] = ok_as_delegate
|
||||||
if ok_to_auth_as_delegate is not None:
|
if ok_to_auth_as_delegate is not None:
|
||||||
_args['ipakrboktoauthasdelegate'] = (ok_to_auth_as_delegate)
|
_args['ipakrboktoauthasdelegate'] = ok_to_auth_as_delegate
|
||||||
|
|
||||||
return _args
|
return _args
|
||||||
|
|
||||||
@@ -433,9 +433,9 @@ def gen_args_smb(netbiosname, ok_as_delegate, ok_to_auth_as_delegate):
|
|||||||
if netbiosname is not None:
|
if netbiosname is not None:
|
||||||
_args['ipantflatname'] = netbiosname
|
_args['ipantflatname'] = netbiosname
|
||||||
if ok_as_delegate is not None:
|
if ok_as_delegate is not None:
|
||||||
_args['ipakrbokasdelegate'] = (ok_as_delegate)
|
_args['ipakrbokasdelegate'] = ok_as_delegate
|
||||||
if ok_to_auth_as_delegate is not None:
|
if ok_to_auth_as_delegate is not None:
|
||||||
_args['ipakrboktoauthasdelegate'] = (ok_to_auth_as_delegate)
|
_args['ipakrboktoauthasdelegate'] = ok_to_auth_as_delegate
|
||||||
|
|
||||||
return _args
|
return _args
|
||||||
|
|
||||||
|
|||||||
@@ -145,8 +145,7 @@ def find_servicedelegationrule(module, name):
|
|||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
# An exception is raised if servicedelegationrule name is not found.
|
# An exception is raised if servicedelegationrule name is not found.
|
||||||
return None
|
return None
|
||||||
else:
|
return _result["result"]
|
||||||
return _result["result"]
|
|
||||||
|
|
||||||
|
|
||||||
def check_targets(module, targets):
|
def check_targets(module, targets):
|
||||||
|
|||||||
@@ -121,8 +121,7 @@ def find_servicedelegationtarget(module, name):
|
|||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
# An exception is raised if servicedelegationtarget name is not found.
|
# An exception is raised if servicedelegationtarget name is not found.
|
||||||
return None
|
return None
|
||||||
else:
|
return _result["result"]
|
||||||
return _result["result"]
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
@@ -122,8 +122,7 @@ def find_sudocmdgroup(module, name):
|
|||||||
_result = module.ipa_command("sudocmdgroup_show", name, args)
|
_result = module.ipa_command("sudocmdgroup_show", name, args)
|
||||||
except ipalib_errors.NotFound:
|
except ipalib_errors.NotFound:
|
||||||
return None
|
return None
|
||||||
else:
|
return _result["result"]
|
||||||
return _result["result"]
|
|
||||||
|
|
||||||
|
|
||||||
def gen_args(description, nomembers):
|
def gen_args(description, nomembers):
|
||||||
|
|||||||
@@ -977,12 +977,14 @@ def main():
|
|||||||
changed = 'Archived data into' in result['summary']
|
changed = 'Archived data into' in result['summary']
|
||||||
elif command == 'vault_retrieve':
|
elif command == 'vault_retrieve':
|
||||||
if 'result' not in result:
|
if 'result' not in result:
|
||||||
|
# pylint: disable=W0012,broad-exception-raised
|
||||||
raise Exception("No result obtained.")
|
raise Exception("No result obtained.")
|
||||||
if "data" in result["result"]:
|
if "data" in result["result"]:
|
||||||
data_return = exit_args.setdefault("vault", {})
|
data_return = exit_args.setdefault("vault", {})
|
||||||
data_return["data"] = result["result"]["data"]
|
data_return["data"] = result["result"]["data"]
|
||||||
else:
|
else:
|
||||||
if not datafile_out:
|
if not datafile_out:
|
||||||
|
# pylint: disable=W0012,broad-exception-raised
|
||||||
raise Exception("No data retrieved.")
|
raise Exception("No data retrieved.")
|
||||||
changed = False
|
changed = False
|
||||||
else:
|
else:
|
||||||
@@ -993,7 +995,7 @@ def main():
|
|||||||
changed = True
|
changed = True
|
||||||
except ipalib_errors.EmptyModlist:
|
except ipalib_errors.EmptyModlist:
|
||||||
result = {}
|
result = {}
|
||||||
except Exception as exception:
|
except Exception as exception: # pylint: disable=broad-except
|
||||||
ansible_module.fail_json(
|
ansible_module.fail_json(
|
||||||
msg="%s: %s: %s" % (command, name, str(exception)))
|
msg="%s: %s: %s" % (command, name, str(exception)))
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
-r requirements-tests.txt
|
-r requirements-tests.txt
|
||||||
ipdb==0.13.4
|
ipdb==0.13.4
|
||||||
pre-commit==2.20.0
|
pre-commit==2.20.0
|
||||||
flake8==5.0.3
|
flake8==6.0.0
|
||||||
flake8-bugbear==22.10.27
|
flake8-bugbear
|
||||||
pylint==2.14.4
|
pylint==2.17.2
|
||||||
wrapt == 1.14.0
|
wrapt==1.14.1
|
||||||
pydocstyle==6.0.0
|
pydocstyle==6.3.0
|
||||||
yamllint==1.28.0
|
yamllint==1.32.0
|
||||||
ansible-lint
|
ansible-lint
|
||||||
|
|||||||
@@ -307,8 +307,7 @@ try:
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
# IPA version < 4.4
|
# IPA version < 4.4
|
||||||
|
raise RuntimeError("freeipa version '%s' is too old" % VERSION)
|
||||||
raise Exception("freeipa version '%s' is too old" % VERSION)
|
|
||||||
|
|
||||||
except ImportError as _err:
|
except ImportError as _err:
|
||||||
ANSIBLE_IPA_CLIENT_MODULE_IMPORT_ERROR = str(_err)
|
ANSIBLE_IPA_CLIENT_MODULE_IMPORT_ERROR = str(_err)
|
||||||
|
|||||||
@@ -171,8 +171,7 @@ try:
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
# IPA version < 4.6
|
# IPA version < 4.6
|
||||||
|
raise RuntimeError("freeipa version '%s' is too old" % VERSION)
|
||||||
raise Exception("freeipa version '%s' is too old" % VERSION)
|
|
||||||
|
|
||||||
except ImportError as _err:
|
except ImportError as _err:
|
||||||
ANSIBLE_IPA_REPLICA_MODULE_IMPORT_ERROR = str(_err)
|
ANSIBLE_IPA_REPLICA_MODULE_IMPORT_ERROR = str(_err)
|
||||||
|
|||||||
@@ -212,8 +212,7 @@ try:
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
# IPA version < 4.5
|
# IPA version < 4.5
|
||||||
|
raise RuntimeError("freeipa version '%s' is too old" % VERSION)
|
||||||
raise Exception("freeipa version '%s' is too old" % VERSION)
|
|
||||||
|
|
||||||
except ImportError as _err:
|
except ImportError as _err:
|
||||||
ANSIBLE_IPA_SERVER_MODULE_IMPORT_ERROR = str(_err)
|
ANSIBLE_IPA_SERVER_MODULE_IMPORT_ERROR = str(_err)
|
||||||
|
|||||||
@@ -55,7 +55,8 @@ disable =
|
|||||||
broad-except,
|
broad-except,
|
||||||
too-many-branches,
|
too-many-branches,
|
||||||
too-many-locals,
|
too-many-locals,
|
||||||
fixme
|
fixme,
|
||||||
|
use-dict-literal
|
||||||
|
|
||||||
[pylint.BASIC]
|
[pylint.BASIC]
|
||||||
good-names =
|
good-names =
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ def set_env_if_not_set(envvar, value):
|
|||||||
os.environ[envvar] = value
|
os.environ[envvar] = value
|
||||||
|
|
||||||
|
|
||||||
def pytest_configure(config):
|
def pytest_configure(config): # pylint: disable=unused-argument
|
||||||
test_dir = os.getenv("TWD")
|
test_dir = os.getenv("TWD")
|
||||||
if not test_dir:
|
if not test_dir:
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
def get_roles(dir):
|
def get_roles(directory):
|
||||||
roles = []
|
roles = []
|
||||||
|
|
||||||
_rolesdir = "%s/roles/" % dir
|
_rolesdir = "%s/roles/" % directory
|
||||||
for _role in os.listdir(_rolesdir):
|
for _role in os.listdir(_rolesdir):
|
||||||
_roledir = "%s/%s" % (_rolesdir, _role)
|
_roledir = "%s/%s" % (_rolesdir, _role)
|
||||||
if not os.path.isdir(_roledir) or \
|
if not os.path.isdir(_roledir) or \
|
||||||
@@ -16,19 +16,19 @@ def get_roles(dir):
|
|||||||
return sorted(roles)
|
return sorted(roles)
|
||||||
|
|
||||||
|
|
||||||
def get_modules(dir):
|
def get_modules(directory):
|
||||||
management_modules = []
|
management_modules = []
|
||||||
roles_modules = []
|
roles_modules = []
|
||||||
|
|
||||||
for root, _dirs, files in os.walk(dir):
|
for root, _dirs, files in os.walk(directory):
|
||||||
if not root.startswith("%s/plugins/" % dir) and \
|
if not root.startswith("%s/plugins/" % directory) and \
|
||||||
not root.startswith("%s/roles/" % dir):
|
not root.startswith("%s/roles/" % directory):
|
||||||
continue
|
continue
|
||||||
for _file in files:
|
for _file in files:
|
||||||
if _file.endswith(".py"):
|
if _file.endswith(".py"):
|
||||||
if root == "%s/plugins/modules" % dir:
|
if root == "%s/plugins/modules" % directory:
|
||||||
management_modules.append(_file[:-3])
|
management_modules.append(_file[:-3])
|
||||||
elif root.startswith("%s/roles/" % dir):
|
elif root.startswith("%s/roles/" % directory):
|
||||||
if root.endswith("/library"):
|
if root.endswith("/library"):
|
||||||
roles_modules.append(_file[:-3])
|
roles_modules.append(_file[:-3])
|
||||||
|
|
||||||
|
|||||||
@@ -62,8 +62,7 @@ def get_plugins_from_playbook(playbook):
|
|||||||
return []
|
return []
|
||||||
except yaml.parser.ParserError: # If not a YAML/JSON file.
|
except yaml.parser.ParserError: # If not a YAML/JSON file.
|
||||||
return []
|
return []
|
||||||
else:
|
return data if data else []
|
||||||
return data if data else []
|
|
||||||
|
|
||||||
data = load_playbook(playbook)
|
data = load_playbook(playbook)
|
||||||
task_blocks = [t.get("tasks", []) if "tasks" in t else [] for t in data]
|
task_blocks = [t.get("tasks", []) if "tasks" in t else [] for t in data]
|
||||||
|
|||||||
@@ -127,8 +127,7 @@ def find_$name(module, name):
|
|||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
# An exception is raised if $name name is not found.
|
# An exception is raised if $name name is not found.
|
||||||
return None
|
return None
|
||||||
else:
|
return _result["result"]
|
||||||
return _result["result"]
|
|
||||||
|
|
||||||
|
|
||||||
def gen_args(PARAMETER1):
|
def gen_args(PARAMETER1):
|
||||||
|
|||||||
@@ -103,8 +103,7 @@ def find_$name(module, name):
|
|||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
# An exception is raised if $name name is not found.
|
# An exception is raised if $name name is not found.
|
||||||
return None
|
return None
|
||||||
else:
|
return _result["result"]
|
||||||
return _result["result"]
|
|
||||||
|
|
||||||
|
|
||||||
def gen_args(PARAMETER1, PARAMETER2):
|
def gen_args(PARAMETER1, PARAMETER2):
|
||||||
|
|||||||
Reference in New Issue
Block a user