mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-14 15:58:38 -05:00
Tower modules: move HAS_TOWER_CLI check in module_utils and minor improvements (#39809)
* tower_* modules: move HAS_TOWER_CLI in TowerModule Besides this change allows to define other common parameters such as mutually_exclusive. * tower_*: config file can not be used with auth params * tower module_utils: remove useless call to expanduser 'path' type: expanduser & expandvars are automatically called
This commit is contained in:
@@ -64,7 +64,7 @@ EXAMPLES = '''
|
||||
|
||||
import os
|
||||
|
||||
from ansible.module_utils.ansible_tower import tower_argument_spec, tower_auth_config, tower_check_mode, HAS_TOWER_CLI
|
||||
from ansible.module_utils.ansible_tower import TowerModule, tower_auth_config, tower_check_mode, HAS_TOWER_CLI
|
||||
|
||||
try:
|
||||
import tower_cli
|
||||
@@ -76,19 +76,15 @@ except ImportError:
|
||||
|
||||
|
||||
def main():
|
||||
argument_spec = tower_argument_spec()
|
||||
argument_spec.update(dict(
|
||||
argument_spec = dict(
|
||||
name=dict(required=True),
|
||||
description=dict(),
|
||||
inventory=dict(required=True),
|
||||
enabled=dict(type='bool', default=True),
|
||||
variables=dict(),
|
||||
state=dict(choices=['present', 'absent'], default='present'),
|
||||
))
|
||||
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
|
||||
|
||||
if not HAS_TOWER_CLI:
|
||||
module.fail_json(msg='ansible-tower-cli required for this module')
|
||||
)
|
||||
module = TowerModule(argument_spec=argument_spec, supports_check_mode=True)
|
||||
|
||||
name = module.params.get('name')
|
||||
description = module.params.get('description')
|
||||
@@ -129,6 +125,5 @@ def main():
|
||||
module.exit_json(**json_output)
|
||||
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user