Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix up ansible-test sanity checks due to ansible 2.17 release #15208

Merged
merged 6 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions awx_collection/plugins/module_utils/controller_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def __init__(self, argument_spec=None, direct_params=None, error_callback=None,
# Perform magic depending on whether controller_oauthtoken is a string or a dict
if self.params.get('controller_oauthtoken'):
token_param = self.params.get('controller_oauthtoken')
if type(token_param) is dict:
if isinstance(token_param, dict):
if 'token' in token_param:
self.oauth_token = self.params.get('controller_oauthtoken')['token']
else:
Expand Down Expand Up @@ -215,7 +215,7 @@ def load_config(self, config_path):
try:
config_data = yaml.load(config_string, Loader=yaml.SafeLoader)
# If this is an actual ini file, yaml will return the whole thing as a string instead of a dict
if type(config_data) is not dict:
if not isinstance(config_data, dict):
raise AssertionError("The yaml config file is not properly formatted as a dict.")
try_config_parsing = False

Expand Down Expand Up @@ -257,7 +257,7 @@ def load_config(self, config_path):
if honorred_setting in config_data:
# Veriffy SSL must be a boolean
if honorred_setting == 'verify_ssl':
if type(config_data[honorred_setting]) is str:
if isinstance(config_data[honorred_setting], str):
setattr(self, honorred_setting, strtobool(config_data[honorred_setting]))
else:
setattr(self, honorred_setting, bool(config_data[honorred_setting]))
Expand Down
2 changes: 1 addition & 1 deletion awx_collection/plugins/modules/ad_hoc_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def main():
for arg in ['job_type', 'limit', 'forks', 'verbosity', 'extra_vars', 'become_enabled', 'diff_mode']:
if module.params.get(arg):
# extra_var can receive a dict or a string, if a dict covert it to a string
if arg == 'extra_vars' and type(module.params.get(arg)) is not str:
if arg == 'extra_vars' and not isinstance(module.params.get(arg), str):
post_data[arg] = json.dumps(module.params.get(arg))
else:
post_data[arg] = module.params.get(arg)
Expand Down
2 changes: 1 addition & 1 deletion awx_collection/plugins/modules/import.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

# In this module we don't use EXPORTABLE_RESOURCES, we just want to validate that our installed awxkit has import/export
try:
from awxkit.api.pages.api import EXPORTABLE_RESOURCES # noqa
from awxkit.api.pages.api import EXPORTABLE_RESOURCES # noqa: F401; pylint: disable=unused-import

fosterseth marked this conversation as resolved.
Show resolved Hide resolved
HAS_EXPORTABLE_RESOURCES = True
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion awx_collection/test/awx/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from ansible_base.rbac.models import RoleDefinition, DABPermission
from awx.main.tests.functional.conftest import _request
from awx.main.tests.functional.conftest import credentialtype_scm, credentialtype_ssh # noqa: F401; pylint: disable=unused-variable
from awx.main.tests.functional.conftest import credentialtype_scm, credentialtype_ssh # noqa: F401; pylint: disable=unused-import
from awx.main.models import (
Organization,
Project,
Expand Down
1 change: 1 addition & 0 deletions awx_collection/tests/sanity/ignore-2.17.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
plugins/modules/export.py validate-modules:nonexistent-parameter-documented # needs awxkit to construct argspec
Loading