mirror of
https://github.com/ansible/awx.git
synced 2026-02-28 00:08:44 -03:30
Fixing integration tests for deprecation warnings
This commit is contained in:
@@ -364,38 +364,41 @@ def main():
|
|||||||
# End backwards compatability
|
# End backwards compatability
|
||||||
state = module.params.get('state')
|
state = module.params.get('state')
|
||||||
|
|
||||||
# Attempt to look up the related items the user specified (these will fail the module if not found)
|
# Deprication warnings
|
||||||
if organization:
|
for legacy_input in OLD_INPUT_NAMES:
|
||||||
org_id = module.resolve_name_to_id('organizations', organization)
|
if module.params.get(legacy_input) is not None:
|
||||||
if user:
|
module.deprecate(msg='{0} parameter has been deprecated, please use inputs instead'.format(legacy_input), version="3.6")
|
||||||
user_id = module.resolve_name_to_id('users', user)
|
|
||||||
if team:
|
|
||||||
team_id = module.resolve_name_to_id('teams', team)
|
|
||||||
|
|
||||||
if kind:
|
if kind:
|
||||||
module.deprecate(msg='The kind parameter has been deprecated, please use credential_type instead', version="3.6")
|
module.deprecate(msg='The kind parameter has been deprecated, please use credential_type instead', version="3.6")
|
||||||
|
|
||||||
cred_type_id = module.resolve_name_to_id('credential_types', credential_type if credential_type else KIND_CHOICES[kind])
|
cred_type_id = module.resolve_name_to_id('credential_types', credential_type if credential_type else KIND_CHOICES[kind])
|
||||||
|
if organization:
|
||||||
|
org_id = module.resolve_name_to_id('organizations', organization)
|
||||||
|
|
||||||
# Attempt to look up the object based on the provided name, credential type and optional organization
|
# Attempt to look up the object based on the provided name, credential type and optional organization
|
||||||
lookup_data = {
|
lookup_data = {
|
||||||
'name': name,
|
'name': name,
|
||||||
'credential_type': cred_type_id,
|
'credential_type': cred_type_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
if organization:
|
if organization:
|
||||||
lookup_data['organization'] = org_id
|
lookup_data['organization'] = org_id
|
||||||
|
|
||||||
credential = module.get_one('credentials', **{'data': lookup_data})
|
credential = module.get_one('credentials', **{'data': lookup_data})
|
||||||
|
|
||||||
if state == 'absent':
|
if state == 'absent':
|
||||||
# If the state was absent we can let the module delete it if needed, the module will handle exiting from this
|
# If the state was absent we can let the module delete it if needed, the module will handle exiting from this
|
||||||
module.delete_if_needed(credential)
|
module.delete_if_needed(credential)
|
||||||
|
|
||||||
|
# Attempt to look up the related items the user specified (these will fail the module if not found)
|
||||||
|
if user:
|
||||||
|
user_id = module.resolve_name_to_id('users', user)
|
||||||
|
if team:
|
||||||
|
team_id = module.resolve_name_to_id('teams', team)
|
||||||
|
|
||||||
# Create credential input from legacy inputs
|
# Create credential input from legacy inputs
|
||||||
credential_inputs = {}
|
credential_inputs = {}
|
||||||
for legacy_input in OLD_INPUT_NAMES:
|
for legacy_input in OLD_INPUT_NAMES:
|
||||||
if module.params.get(legacy_input) is not None:
|
if module.params.get(legacy_input) is not None:
|
||||||
module.deprecate(msg='{0} parameter has been deprecated, please use inputs instead'.format(legacy_input), version="3.6")
|
|
||||||
credential_inputs[legacy_input] = module.params.get(legacy_input)
|
credential_inputs[legacy_input] = module.params.get(legacy_input)
|
||||||
if inputs:
|
if inputs:
|
||||||
credential_inputs.update(inputs)
|
credential_inputs.update(inputs)
|
||||||
|
|||||||
@@ -403,6 +403,11 @@ def main():
|
|||||||
messages = module.params.get('messages')
|
messages = module.params.get('messages')
|
||||||
state = module.params.get('state')
|
state = module.params.get('state')
|
||||||
|
|
||||||
|
# Deprecation warnings
|
||||||
|
for legacy_input in OLD_INPUT_NAMES:
|
||||||
|
if module.params.get(legacy_input) is not None:
|
||||||
|
module.deprecate(msg='{0} parameter has been deprecated, please use notification_configuration instead.'.format(legacy_input), version="3.6")
|
||||||
|
|
||||||
# Attempt to look up the related items the user specified (these will fail the module if not found)
|
# Attempt to look up the related items the user specified (these will fail the module if not found)
|
||||||
organization_id = None
|
organization_id = None
|
||||||
if organization:
|
if organization:
|
||||||
@@ -424,7 +429,6 @@ def main():
|
|||||||
final_notification_configuration = {}
|
final_notification_configuration = {}
|
||||||
for legacy_input in OLD_INPUT_NAMES:
|
for legacy_input in OLD_INPUT_NAMES:
|
||||||
if module.params.get(legacy_input) is not None:
|
if module.params.get(legacy_input) is not None:
|
||||||
module.deprecate(msg='{0} parameter has been deprecated, please use notification_configuration instead.'.format(legacy_input), version="3.6")
|
|
||||||
final_notification_configuration[legacy_input] = module.params.get(legacy_input)
|
final_notification_configuration[legacy_input] = module.params.get(legacy_input)
|
||||||
# Give anything in notification_configuration prescedence over the individual inputs
|
# Give anything in notification_configuration prescedence over the individual inputs
|
||||||
if notification_configuration is not None:
|
if notification_configuration is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user