sanity tests

This commit is contained in:
Seth Foster
2021-06-03 16:28:12 -04:00
parent cd100fd770
commit 4bd910493a
11 changed files with 36 additions and 50 deletions

View File

@@ -22,7 +22,7 @@ class ControllerAWXKitModule(ControllerModule):
def __init__(self, argument_spec, **kwargs):
kwargs['supports_check_mode'] = False
super(ControllerAWXKitModule, self).__init__(argument_spec=argument_spec, **kwargs)
super().__init__(argument_spec=argument_spec, **kwargs)
# Die if we don't have AWX_KIT installed
if not HAS_AWX_KIT:

View File

@@ -30,7 +30,7 @@ class ControllerAPIModule(ControllerModule):
def __init__(self, argument_spec, direct_params=None, error_callback=None, warn_callback=None, **kwargs):
kwargs['supports_check_mode'] = True
super(ControllerAPIModule, self).__init__(
super().__init__(
argument_spec=argument_spec, direct_params=direct_params, error_callback=error_callback, warn_callback=warn_callback, **kwargs
)
self.session = Request(cookies=CookieJar(), validate_certs=self.verify_ssl)

View File

@@ -95,7 +95,7 @@ class ControllerModule(AnsibleModule):
if direct_params is not None:
self.params = direct_params
else:
super(ControllerModule, self).__init__(argument_spec=full_argspec, **kwargs)
super().__init__(argument_spec=full_argspec, **kwargs)
self.load_config_files()
@@ -238,10 +238,10 @@ class ControllerModule(AnsibleModule):
pass
except Exception as e:
raise ConfigFileException("An unknown exception occured trying to ini load config file: {0}".format(e))
raise ConfigFileException("An unknown exception occured trying to ini load config file: {0}".format(e)) from e
except Exception as e:
raise ConfigFileException("An unknown exception occured trying to load config file: {0}".format(e))
raise ConfigFileException("An unknown exception occured trying to load config file: {0}".format(e)) from e
# If we made it here, we have a dict which has values in it from our config, any final settings logic can be performed here
for honorred_setting in self.short_params:
@@ -265,15 +265,15 @@ class ControllerModule(AnsibleModule):
if self.error_callback:
self.error_callback(**kwargs)
else:
super(ControllerModule, self).fail_json(**kwargs)
super().fail_json(**kwargs)
def exit_json(self, **kwargs):
# Try to log out if we are authenticated
self.logout()
super(ControllerModule, self).exit_json(**kwargs)
super().exit_json(**kwargs)
def warn(self, warning):
if self.warn_callback is not None:
self.warn_callback(warning)
else:
super(ControllerModule, self).warn(warning)
super().warn(warning)

View File

@@ -113,7 +113,7 @@ class TowerLegacyModule(AnsibleModule):
)
)
super(TowerLegacyModule, self).__init__(argument_spec=args, **kwargs)
super().__init__(argument_spec=args, **kwargs)
if not HAS_TOWER_CLI:
self.fail_json(msg=missing_required_lib('ansible-tower-cli'), exception=TOWER_CLI_IMP_ERR)