pycharm refactor rename files and class, linux rename tower_ controller_

This commit is contained in:
Seth Foster
2021-04-28 18:13:22 -04:00
parent 2ad84b60b3
commit 44fed1d7c1
93 changed files with 234 additions and 149 deletions

View File

@@ -111,7 +111,7 @@ status:
sample: pending
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def main():
@@ -135,7 +135,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
inventory = module.params.get('inventory')

View File

@@ -62,7 +62,7 @@ id:
import time
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def main():
@@ -75,7 +75,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
command_id = module.params.get('command_id')

View File

@@ -82,7 +82,7 @@ status:
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def main():
@@ -94,7 +94,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
command_id = module.params.get('command_id')

View File

@@ -91,7 +91,7 @@ EXAMPLES = '''
import time
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def main():
@@ -108,7 +108,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
name = module.params.get('name')

View File

@@ -289,7 +289,7 @@ EXAMPLES = '''
organization: Foo
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
KIND_CHOICES = {
'aws': 'Amazon Web Services',
@@ -378,7 +378,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec, required_one_of=[['kind', 'credential_type']])
module = ControllerAPIModule(argument_spec=argument_spec, required_one_of=[['kind', 'credential_type']])
# Extract our parameters
name = module.params.get('name')

View File

@@ -69,7 +69,7 @@ EXAMPLES = '''
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def main():
@@ -84,7 +84,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
description = module.params.get('description')

View File

@@ -80,7 +80,7 @@ EXAMPLES = '''
RETURN = ''' # '''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
KIND_CHOICES = {'ssh': 'Machine', 'vault': 'Ansible Vault', 'net': 'Network', 'scm': 'Source Control', 'cloud': 'Lots of others', 'insights': 'Insights'}
@@ -97,7 +97,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
name = module.params.get('name')

View File

@@ -67,7 +67,7 @@ EXAMPLES = '''
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
import json
@@ -84,7 +84,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
name = module.params.get('name')

View File

@@ -99,7 +99,7 @@ EXAMPLES = '''
from os import environ
import logging
from ansible.module_utils.six.moves import StringIO
from ..module_utils.tower_awxkit import TowerAWXKitModule
from ..module_utils.awxkit import ControllerAWXKitModule
try:
from awxkit.api.pages.api import EXPORTABLE_RESOURCES
@@ -114,12 +114,12 @@ def main():
all=dict(type='bool', default=False),
)
# We are not going to raise an error here because the __init__ method of TowerAWXKitModule will do that for us
# We are not going to raise an error here because the __init__ method of ControllerAWXKitModule will do that for us
if HAS_EXPORTABLE_RESOURCES:
for resource in EXPORTABLE_RESOURCES:
argument_spec[resource] = dict(type='str')
module = TowerAWXKitModule(argument_spec=argument_spec)
module = ControllerAWXKitModule(argument_spec=argument_spec)
if not HAS_EXPORTABLE_RESOURCES:
module.fail_json(msg="Your version of awxkit does not have import/export")

View File

@@ -99,7 +99,7 @@ EXAMPLES = '''
preserve_existing_children: True
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
import json
@@ -119,7 +119,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
name = module.params.get('name')

View File

@@ -71,7 +71,7 @@ EXAMPLES = '''
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
import json
@@ -88,7 +88,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
name = module.params.get('name')

View File

@@ -48,7 +48,7 @@ EXAMPLES = '''
assets: "{{ lookup('file', 'org.json') | from_json() }}"
'''
from ..module_utils.tower_awxkit import TowerAWXKitModule
from ..module_utils.awxkit import ControllerAWXKitModule
# These two lines are not needed if awxkit changes to do programatic notifications on issues
from ansible.module_utils.six.moves import StringIO
@@ -66,7 +66,7 @@ except ImportError:
def main():
argument_spec = dict(assets=dict(type='dict', required=True))
module = TowerAWXKitModule(argument_spec=argument_spec, supports_check_mode=False)
module = ControllerAWXKitModule(argument_spec=argument_spec, supports_check_mode=False)
assets = module.params.get('assets')

View File

@@ -80,7 +80,7 @@ extends_documentation_fragment: awx.awx.auth
EXAMPLES = '''
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def main():
@@ -99,7 +99,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
name = module.params.get('name')

View File

@@ -95,7 +95,7 @@ EXAMPLES = '''
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
import json
@@ -115,7 +115,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
name = module.params.get('name')

View File

@@ -150,7 +150,7 @@ EXAMPLES = '''
private: false
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
from json import dumps
@@ -189,7 +189,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
name = module.params.get('name')

View File

@@ -83,7 +83,7 @@ status:
sample: pending
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def main():
@@ -98,7 +98,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
name = module.params.get('name')

View File

@@ -49,7 +49,7 @@ id:
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def main():
@@ -60,7 +60,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
job_id = module.params.get('job_id')

View File

@@ -145,7 +145,7 @@ status:
sample: pending
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def main():
@@ -171,7 +171,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
optional_args = {}
# Extract our parameters

View File

@@ -79,7 +79,7 @@ results:
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def main():
@@ -92,7 +92,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(
module = ControllerAPIModule(
argument_spec=argument_spec,
mutually_exclusive=[
('page', 'all_pages'),

View File

@@ -343,7 +343,7 @@ EXAMPLES = '''
state: "present"
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
import json
@@ -417,7 +417,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
name = module.params.get('name')

View File

@@ -97,7 +97,7 @@ status:
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def main():
@@ -112,7 +112,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
job_id = module.params.get('job_id')

View File

@@ -53,7 +53,7 @@ EXAMPLES = '''
organization: My Organization
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def main():
@@ -66,7 +66,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
name = module.params.get('name')

View File

@@ -44,12 +44,12 @@ EXAMPLES = '''
'''
import base64
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def main():
module = TowerAPIModule(
module = ControllerAPIModule(
argument_spec=dict(
manifest=dict(type='str', required=True),
force=dict(type='bool', required=False),

View File

@@ -61,11 +61,11 @@ EXAMPLES = '''
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def main():
module = TowerAPIModule(argument_spec={})
module = ControllerAPIModule(argument_spec={})
namespace = {'awx': 'awx', 'tower': 'ansible'}.get(module._COLLECTION_TYPE, 'unknown')
namespace_name = '{0}.{1}'.format(namespace, module._COLLECTION_TYPE)
module.exit_json(prefix=namespace_name, name=module._COLLECTION_TYPE, namespace=namespace, version=module._COLLECTION_VERSION)

View File

@@ -313,7 +313,7 @@ EXAMPLES = '''
RETURN = ''' # '''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
OLD_INPUT_NAMES = (
'username',
@@ -384,7 +384,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
name = module.params.get('name')

View File

@@ -109,7 +109,7 @@ EXAMPLES = '''
tower_config_file: "~/tower_cli.cfg"
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def main():
@@ -130,7 +130,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
name = module.params.get('name')

View File

@@ -199,7 +199,7 @@ EXAMPLES = '''
import time
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def wait_for_project_update(module, last_request):
@@ -280,7 +280,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
name = module.params.get('name')

View File

@@ -77,7 +77,7 @@ EXAMPLES = '''
wait: False
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
import json
import time
@@ -93,7 +93,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
name = module.params.get('name')

View File

@@ -148,7 +148,7 @@ EXAMPLES = '''
state: present
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def main():
@@ -194,7 +194,7 @@ def main():
state=dict(choices=['present', 'absent'], default='present'),
)
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
role_type = module.params.pop('role')
role_field = role_type + '_role'

View File

@@ -135,7 +135,7 @@ EXAMPLES = '''
register: result
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def main():
@@ -160,7 +160,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
rrule = module.params.get('rrule')

View File

@@ -69,7 +69,7 @@ EXAMPLES = '''
last_name: "surname"
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
try:
import yaml
@@ -107,7 +107,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(
module = ControllerAPIModule(
argument_spec=argument_spec,
required_one_of=[['name', 'settings']],
mutually_exclusive=[['name', 'settings']],

View File

@@ -59,7 +59,7 @@ EXAMPLES = '''
tower_config_file: "~/tower_cli.cfg"
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def main():
@@ -73,7 +73,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
name = module.params.get('name')

View File

@@ -116,7 +116,7 @@ tower_token:
returned: on successful create
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def return_token(module, last_response):
@@ -142,7 +142,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(
module = ControllerAPIModule(
argument_spec=argument_spec,
mutually_exclusive=[
('existing_token', 'existing_token_id'),

View File

@@ -107,7 +107,7 @@ EXAMPLES = '''
tower_config_file: "~/tower_cli.cfg"
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def main():
@@ -125,7 +125,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
username = module.params.get('username')

View File

@@ -77,7 +77,7 @@ RETURN = """
"""
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def main():
@@ -91,7 +91,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
workflow_job_id = module.params.get("workflow_job_id")

View File

@@ -455,7 +455,7 @@ EXAMPLES = '''
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
import json
@@ -689,7 +689,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
name = module.params.get('name')

View File

@@ -224,7 +224,7 @@ EXAMPLES = '''
- my-third-node
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
def main():
@@ -259,7 +259,7 @@ def main():
]
# Create a module for ourselves
module = TowerAPIModule(
module = ControllerAPIModule(
argument_spec=argument_spec,
mutually_exclusive=mutually_exclusive,
required_if=required_if,

View File

@@ -90,7 +90,7 @@ EXAMPLES = '''
wait: False
'''
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
import json
@@ -109,7 +109,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
optional_args = {}
# Extract our parameters

View File

@@ -69,7 +69,7 @@ RETURN = """
"""
from ..module_utils.tower_api import TowerAPIModule
from ..module_utils.controller_api import ControllerAPIModule
import time
@@ -83,7 +83,7 @@ def main():
)
# Create a module for ourselves
module = TowerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(argument_spec=argument_spec)
# Extract our parameters
workflow_job_id = module.params.get("workflow_job_id")