1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-30 05:25:29 +03:00

Making variables work for hosts

Clear up sanity test and remove redundant import statement
This commit is contained in:
John Westcott IV 2020-02-13 16:56:47 -05:00 committed by beeankha
parent badd667efa
commit d8513a4e86
2 changed files with 5 additions and 9 deletions

View File

@ -79,8 +79,6 @@ EXAMPLES = '''
'''
import os
from ..module_utils.tower_api import TowerModule
@ -106,13 +104,10 @@ def main():
inventory = module.params.get('inventory')
enabled = module.params.get('enabled')
state = module.params.get('state')
variables = module.params.get('variables')
if variables:
if variables.startswith('@'):
filename = os.path.expanduser(variables[1:])
with open(filename, 'r') as f:
variables = f.read()
variables = module.load_variables_if_file_specified(variables, 'variables')
# Attempt to look up the related items the user specified (these will fail the module if not found)
inventory_id = module.resolve_name_to_id('inventories', inventory)
@ -130,8 +125,10 @@ def main():
'name': new_name if new_name else name,
'description': description,
'inventory': inventory_id,
'enabled': enabled
'enabled': enabled,
}
if variables:
host_fields['variables'] = variables
if state == 'absent':
# If the state was absent we can let the module delete it if needed, the module will handle exiting from this

View File

@ -1 +0,0 @@
plugins/modules/tower_host.py use-argspec-type-path