Optional tower cli (#3)

* Allow running tests without tower_cli

* patch up test mutability

* Fix test import error, warning mock

* flake8 error

Update documentation for non-converted modules
This commit is contained in:
Alan Rominger
2020-02-17 09:20:54 -05:00
committed by beeankha
parent d8513a4e86
commit 2e4e687d69
17 changed files with 67 additions and 45 deletions

View File

@@ -36,9 +36,6 @@ options:
- Path to the Tower or AWX config file.
type: path
requirements:
- ansible-tower-cli >= 3.0.2
notes:
- If no I(config_file) is provided we will attempt to use the tower-cli library
defaults to find your Tower host information.

View File

@@ -33,7 +33,7 @@ class ItemNotDefined(Exception):
class TowerModule(AnsibleModule):
url = None
honorred_settings = ['host', 'username', 'password', 'verify_ssl', 'oauth_token']
honorred_settings = ('host', 'username', 'password', 'verify_ssl', 'oauth_token')
host = '127.0.0.1'
username = None
password = None
@@ -43,7 +43,6 @@ class TowerModule(AnsibleModule):
session = None
cookie_jar = CookieJar()
authenticated = False
json_output = {'changed': False}
config_name = 'tower_cli.cfg'
def __init__(self, argument_spec, **kwargs):
@@ -58,6 +57,8 @@ class TowerModule(AnsibleModule):
args.update(argument_spec)
kwargs['supports_check_mode'] = True
self.json_output = {'changed': False}
# We have to take off mutually_exclusive_if in order to init with Ansible
mutually_exclusive_if = kwargs.pop('mutually_exclusive_if', None)
@@ -136,7 +137,7 @@ class TowerModule(AnsibleModule):
raise ConfigFileException('The specified config file does not exist')
if not access(config_path, R_OK):
raise ConfigFileException("The specified config file can not be read")
raise ConfigFileException("The specified config file cannot be read")
# Read in the file contents:
with open(config_path, 'r') as f:

View File

@@ -160,6 +160,10 @@ options:
choices: ["present", "absent"]
default: "present"
type: str
requirements:
- ansible-tower-cli >= 3.0.2
extends_documentation_fragment: awx.awx.auth
'''

View File

@@ -219,7 +219,12 @@ options:
default: "present"
choices: ["present", "absent"]
type: str
requirements:
- ansible-tower-cli >= 3.0.2
extends_documentation_fragment: awx.awx.auth
notes:
- JSON for survey_spec can be found in Tower API Documentation. See
U(https://docs.ansible.com/ansible-tower/latest/html/towerapi/api_ref.html#/Job_Templates/Job_Templates_job_templates_survey_spec_create)

View File

@@ -42,6 +42,10 @@ options:
description:
- Maximum time in seconds to wait for a job to finish.
type: int
requirements:
- ansible-tower-cli >= 3.0.2
extends_documentation_fragment: awx.awx.auth
'''

View File

@@ -39,6 +39,10 @@ options:
default: "present"
choices: ["present", "absent"]
type: str
requirements:
- ansible-tower-cli >= 3.0.2
extends_documentation_fragment: awx.awx.auth
'''

View File

@@ -191,6 +191,10 @@ options:
default: "present"
choices: ["present", "absent"]
type: str
requirements:
- ansible-tower-cli >= 3.0.2
extends_documentation_fragment: awx.awx.auth
'''

View File

@@ -68,6 +68,10 @@ options:
default: "present"
choices: ["present", "absent"]
type: str
requirements:
- ansible-tower-cli >= 3.0.2
extends_documentation_fragment: awx.awx.auth
'''

View File

@@ -44,6 +44,8 @@ options:
requirements:
- "python >= 2.6"
- ansible-tower-cli >= 3.0.2
extends_documentation_fragment: awx.awx.auth
'''

View File

@@ -81,6 +81,10 @@ options:
default: "present"
choices: ["present", "absent"]
type: str
requirements:
- ansible-tower-cli >= 3.0.2
extends_documentation_fragment: awx.awx.auth
'''