remove custom_virtualenv support from the AWX collection and docs

This commit is contained in:
Ryan Petrello
2021-03-05 14:11:30 -05:00
parent ec3b225c76
commit 4c60999161
14 changed files with 6 additions and 414 deletions

View File

@@ -85,10 +85,6 @@ options:
description:
- Override vars in child groups and hosts with those from external source.
type: bool
custom_virtualenv:
description:
- Local absolute file path containing a custom Python virtualenv to use.
type: str
timeout:
description: The amount of time (in seconds) to run before the task is canceled.
type: int
@@ -181,7 +177,6 @@ def main():
organization=dict(),
overwrite=dict(type='bool'),
overwrite_vars=dict(type='bool'),
custom_virtualenv=dict(),
timeout=dict(type='int'),
verbosity=dict(type='int', choices=[0, 1, 2]),
update_on_launch=dict(type='bool'),
@@ -265,7 +260,7 @@ def main():
OPTIONAL_VARS = (
'description', 'source', 'source_path', 'source_vars',
'overwrite', 'overwrite_vars', 'custom_virtualenv',
'overwrite', 'overwrite_vars',
'timeout', 'verbosity', 'update_on_launch', 'update_cache_timeout',
'update_on_project_update', 'enabled_var', 'enabled_value', 'host_filter',
)

View File

@@ -227,10 +227,6 @@ options:
description:
- Maximum time in seconds to wait for a job to finish (server-side).
type: int
custom_virtualenv:
description:
- Local absolute file path containing a custom Python virtualenv to use.
type: str
job_slice_count:
description:
- The number of jobs to slice into at runtime. Will cause the Job Template to launch a workflow if value is greater than 1.
@@ -304,7 +300,6 @@ EXAMPLES = '''
tower_config_file: "~/tower_cli.cfg"
survey_enabled: yes
survey_spec: "{{ lookup('file', 'my_survey.json') }}"
custom_virtualenv: "/var/lib/awx/venv/custom-venv/"
- name: Add start notification to Job Template
tower_job_template:
@@ -352,7 +347,6 @@ def main():
playbook=dict(),
credential=dict(),
vault_credential=dict(),
custom_virtualenv=dict(),
credentials=dict(type='list', elements='str'),
execution_environment=dict(),
forks=dict(type='int'),
@@ -442,7 +436,7 @@ def main():
'host_config_key', 'ask_scm_branch_on_launch', 'ask_diff_mode_on_launch', 'ask_variables_on_launch',
'ask_limit_on_launch', 'ask_tags_on_launch', 'ask_skip_tags_on_launch', 'ask_job_type_on_launch',
'ask_verbosity_on_launch', 'ask_inventory_on_launch', 'ask_credential_on_launch', 'survey_enabled',
'become_enabled', 'diff_mode', 'allow_simultaneous', 'custom_virtualenv', 'job_slice_count', 'webhook_service',
'become_enabled', 'diff_mode', 'allow_simultaneous', 'job_slice_count', 'webhook_service',
):
field_val = module.params.get(field_name)
if field_val is not None:

View File

@@ -31,11 +31,6 @@ options:
description:
- The description to use for the organization.
type: str
custom_virtualenv:
description:
- Local absolute file path containing a custom Python virtualenv to use.
type: str
default: ''
default_environment:
description:
- Default Execution Environment to use for jobs owned by the Organization.
@@ -92,7 +87,6 @@ EXAMPLES = '''
tower_organization:
name: "Foo"
description: "Foo bar organization using foo-venv"
custom_virtualenv: "/var/lib/awx/venv/foo-venv/"
state: present
tower_config_file: "~/tower_cli.cfg"
@@ -113,7 +107,6 @@ def main():
argument_spec = dict(
name=dict(required=True),
description=dict(),
custom_virtualenv=dict(),
default_environment=dict(),
max_hosts=dict(type='int', default="0"),
notification_templates_started=dict(type="list", elements='str'),
@@ -130,7 +123,6 @@ def main():
# Extract our parameters
name = module.params.get('name')
description = module.params.get('description')
custom_virtualenv = module.params.get('custom_virtualenv')
default_ee = module.params.get('default_environment')
max_hosts = module.params.get('max_hosts')
# instance_group_names = module.params.get('instance_groups')
@@ -179,8 +171,6 @@ def main():
org_fields = {'name': module.get_item_name(organization) if organization else name}
if description is not None:
org_fields['description'] = description
if custom_virtualenv is not None:
org_fields['custom_virtualenv'] = custom_virtualenv
if default_ee is not None:
org_fields['default_environment'] = module.resolve_name_to_id('execution_environments', default_ee)
if max_hosts is not None:

View File

@@ -97,11 +97,6 @@ options:
type: int
aliases:
- job_timeout
custom_virtualenv:
description:
- Local absolute file path containing a custom Python virtualenv to use
type: str
default: ''
default_environment:
description:
- Default Execution Environment to use for jobs relating to the project.
@@ -172,7 +167,6 @@ EXAMPLES = '''
organization: "test"
scm_update_on_launch: True
scm_update_cache_timeout: 60
custom_virtualenv: "/var/lib/awx/var/lib/awx/venv/ansible-2.2"
state: present
tower_config_file: "~/tower_cli.cfg"
'''
@@ -242,7 +236,6 @@ def main():
scm_update_cache_timeout=dict(type='int', default=0),
allow_override=dict(type='bool', aliases=['scm_allow_override']),
timeout=dict(type='int', default=0, aliases=['job_timeout']),
custom_virtualenv=dict(),
default_environment=dict(),
organization=dict(),
notification_templates_started=dict(type="list", elements='str'),
@@ -274,7 +267,6 @@ def main():
scm_update_cache_timeout = module.params.get('scm_update_cache_timeout')
allow_override = module.params.get('allow_override')
timeout = module.params.get('timeout')
custom_virtualenv = module.params.get('custom_virtualenv')
default_ee = module.params.get('default_environment')
organization = module.params.get('organization')
state = module.params.get('state')
@@ -333,7 +325,6 @@ def main():
'organization': org_id,
'scm_update_on_launch': scm_update_on_launch,
'scm_update_cache_timeout': scm_update_cache_timeout,
'custom_virtualenv': custom_virtualenv,
}
if description is not None:
project_fields['description'] = description

View File

@@ -97,61 +97,6 @@ def test_create_inventory_source_multiple_orgs(run_module, admin_user):
}
@pytest.mark.django_db
def test_create_inventory_source_with_venv(run_module, admin_user, base_inventory, mocker, project):
path = '/var/lib/awx/venv/custom-venv/foobar13489435/'
source_path = '/var/lib/awx/example_source_path/'
with mocker.patch('awx.main.models.mixins.get_custom_venv_choices', return_value=[path]):
result = run_module('tower_inventory_source', dict(
name='foo',
inventory=base_inventory.name,
state='present',
source='scm',
source_project=project.name,
custom_virtualenv=path,
source_path=source_path
), admin_user)
assert result.pop('changed'), result
inv_src = InventorySource.objects.get(name='foo')
assert inv_src.inventory == base_inventory
result.pop('invocation')
assert inv_src.custom_virtualenv == path
@pytest.mark.django_db
def test_custom_venv_no_op(run_module, admin_user, base_inventory, mocker, project):
"""If the inventory source is modified, then it should not blank fields
unrelated to the params that the user passed.
This enforces assumptions about the behavior of the AnsibleModule
default argument_spec behavior.
"""
source_path = '/var/lib/awx/example_source_path/'
inv_src = InventorySource.objects.create(
name='foo',
inventory=base_inventory,
source_project=project,
source='scm',
custom_virtualenv='/var/lib/awx/venv/foobar/'
)
# mock needed due to API behavior, not incorrect client behavior
with mocker.patch('awx.main.models.mixins.get_custom_venv_choices', return_value=['/var/lib/awx/venv/foobar/']):
result = run_module('tower_inventory_source', dict(
name='foo',
description='this is the changed description',
inventory=base_inventory.name,
source='scm', # is required, but behavior is arguable
state='present',
source_project=project.name,
source_path=source_path
), admin_user)
assert result.pop('changed', None), result
inv_src.refresh_from_db()
assert inv_src.custom_virtualenv == '/var/lib/awx/venv/foobar/'
assert inv_src.description == 'this is the changed description'
@pytest.mark.django_db
def test_falsy_value(run_module, admin_user, base_inventory):
result = run_module('tower_inventory_source', dict(

View File

@@ -20,7 +20,6 @@ def test_create_organization(run_module, admin_user):
'validate_certs': None,
'tower_oauthtoken': None,
'tower_config_file': None,
'custom_virtualenv': None
}
result = run_module('tower_organization', module_args, admin_user)
@@ -37,24 +36,3 @@ def test_create_organization(run_module, admin_user):
}
assert org.description == 'barfoo'
@pytest.mark.django_db
def test_create_organization_with_venv(run_module, admin_user, mocker):
path = '/var/lib/awx/venv/custom-venv/foobar13489435/'
with mocker.patch('awx.main.models.mixins.get_custom_venv_choices', return_value=[path]):
result = run_module('tower_organization', {
'name': 'foo',
'custom_virtualenv': path,
'state': 'present'
}, admin_user)
assert result.pop('changed'), result
org = Organization.objects.get(name='foo')
result.pop('invocation')
assert result == {
"name": "foo",
"id": org.id
}
assert org.custom_virtualenv == path

View File

@@ -17,7 +17,6 @@
- name: "{{ org_name1 }}"
description: ""
max_hosts: 0
custom_virtualenv: null
related:
notification_templates: []
notification_templates_started: []
@@ -40,7 +39,6 @@
- name: "{{ org_name1 }}"
description: ""
max_hosts: 0
custom_virtualenv: null
related:
notification_templates: []
notification_templates_started: []
@@ -67,7 +65,6 @@
"name": "{{ org_name2 }}",
"description": "",
"max_hosts": 0,
"custom_virtualenv": null,
"related": {
"notification_templates": [],
"notification_templates_started": [],

View File

@@ -28,22 +28,10 @@
that:
- "result is not changed"
- name: "Try adding a bad custom_virtualenv"
tower_organization:
name: "{{ org_name }}"
custom_virtualenv: "/does/not/exit"
register: result
ignore_errors: true
- assert:
that:
- "result is failed"
- name: "Pass in all parameters"
tower_organization:
name: "{{ org_name }}"
description: "A description"
custom_virtualenv: ""
register: result
- assert:
@@ -54,7 +42,6 @@
tower_organization:
name: "{{ org_name }}"
description: "A new description"
custom_virtualenv: ""
register: result
- assert:

View File

@@ -49,4 +49,3 @@ examples:
tower_config_file: "~/tower_cli.cfg"
survey_enabled: yes
survey_spec: "{{ '{{' }} lookup('file', 'my_survey.json') {{ '}}' }}"
custom_virtualenv: "/var/lib/awx/venv/custom-venv/"