diff --git a/awx/main/constants.py b/awx/main/constants.py index aabcc0b2e3..3ddb4791a8 100644 --- a/awx/main/constants.py +++ b/awx/main/constants.py @@ -5,7 +5,7 @@ import re from django.utils.translation import ugettext_lazy as _ -CLOUD_PROVIDERS = ('azure_rm', 'ec2', 'gce', 'vmware', 'openstack', 'ovirt4', 'satellite6', 'cloudforms', 'tower') +CLOUD_PROVIDERS = ('azure_rm', 'ec2', 'gce', 'vmware', 'openstack', 'rhv', 'satellite6', 'cloudforms', 'tower') SCHEDULEABLE_PROVIDERS = CLOUD_PROVIDERS + ('custom', 'scm',) PRIVILEGE_ESCALATION_METHODS = [ ('sudo', _('Sudo')), ('su', _('Su')), ('pbrun', _('Pbrun')), ('pfexec', _('Pfexec')), ('dzdo', _('DZDO')), ('pmrun', _('Pmrun')), ('runas', _('Runas'))] ANSI_SGR_PATTERN = re.compile(r'\x1b\[[0-9;]*m') diff --git a/awx/main/management/commands/inventory_import.py b/awx/main/management/commands/inventory_import.py index f4ee1401fd..811dd03991 100644 --- a/awx/main/management/commands/inventory_import.py +++ b/awx/main/management/commands/inventory_import.py @@ -229,6 +229,7 @@ def load_inventory_source(source, group_filter_re=None, ''' # Sanity check: We sanitize these module names for our API but Ansible proper doesn't follow # good naming conventions + source = source.replace('rhv.py', 'ovirt4.py') source = source.replace('satellite6.py', 'foreman.py') source = source.replace('vmware.py', 'vmware_inventory.py') if not os.path.exists(source): diff --git a/awx/main/migrations/0010_v322_add_ovirt4_tower_inventory.py b/awx/main/migrations/0010_v322_add_ovirt4_tower_inventory.py index aa00d66163..aac423cd1c 100644 --- a/awx/main/migrations/0010_v322_add_ovirt4_tower_inventory.py +++ b/awx/main/migrations/0010_v322_add_ovirt4_tower_inventory.py @@ -14,15 +14,15 @@ class Migration(migrations.Migration): ] operations = [ - migrations.RunPython(credentialtypes.create_ovirt4_tower_credtype), + migrations.RunPython(credentialtypes.create_rhv_tower_credtype), migrations.AlterField( model_name='inventorysource', name='source', - field=models.CharField(default=b'', max_length=32, blank=True, choices=[(b'', 'Manual'), (b'file', 'File, Directory or Script'), (b'scm', 'Sourced from a Project'), (b'ec2', 'Amazon EC2'), (b'gce', 'Google Compute Engine'), (b'azure_rm', 'Microsoft Azure Resource Manager'), (b'vmware', 'VMware vCenter'), (b'satellite6', 'Red Hat Satellite 6'), (b'cloudforms', 'Red Hat CloudForms'), (b'openstack', 'OpenStack'), (b'ovirt4', 'oVirt4'), (b'tower', 'Ansible Tower'), (b'custom', 'Custom Script')]), + field=models.CharField(default=b'', max_length=32, blank=True, choices=[(b'', 'Manual'), (b'file', 'File, Directory or Script'), (b'scm', 'Sourced from a Project'), (b'ec2', 'Amazon EC2'), (b'gce', 'Google Compute Engine'), (b'azure_rm', 'Microsoft Azure Resource Manager'), (b'vmware', 'VMware vCenter'), (b'satellite6', 'Red Hat Satellite 6'), (b'cloudforms', 'Red Hat CloudForms'), (b'openstack', 'OpenStack'), (b'rhv', 'Red Hat Virtualization'), (b'tower', 'Ansible Tower'), (b'custom', 'Custom Script')]), ), migrations.AlterField( model_name='inventoryupdate', name='source', - field=models.CharField(default=b'', max_length=32, blank=True, choices=[(b'', 'Manual'), (b'file', 'File, Directory or Script'), (b'scm', 'Sourced from a Project'), (b'ec2', 'Amazon EC2'), (b'gce', 'Google Compute Engine'), (b'azure_rm', 'Microsoft Azure Resource Manager'), (b'vmware', 'VMware vCenter'), (b'satellite6', 'Red Hat Satellite 6'), (b'cloudforms', 'Red Hat CloudForms'), (b'openstack', 'OpenStack'), (b'ovirt4', 'oVirt4'), (b'tower', 'Ansible Tower'), (b'custom', 'Custom Script')]), + field=models.CharField(default=b'', max_length=32, blank=True, choices=[(b'', 'Manual'), (b'file', 'File, Directory or Script'), (b'scm', 'Sourced from a Project'), (b'ec2', 'Amazon EC2'), (b'gce', 'Google Compute Engine'), (b'azure_rm', 'Microsoft Azure Resource Manager'), (b'vmware', 'VMware vCenter'), (b'satellite6', 'Red Hat Satellite 6'), (b'cloudforms', 'Red Hat CloudForms'), (b'openstack', 'OpenStack'), (b'rhv', 'Red Hat Virtualization'), (b'tower', 'Ansible Tower'), (b'custom', 'Custom Script')]), ), ] diff --git a/awx/main/migrations/_credentialtypes.py b/awx/main/migrations/_credentialtypes.py index 9b008a2b24..ee8475f18a 100644 --- a/awx/main/migrations/_credentialtypes.py +++ b/awx/main/migrations/_credentialtypes.py @@ -174,7 +174,7 @@ def migrate_job_credentials(apps, schema_editor): utils.get_current_apps = orig_current_apps -def create_ovirt4_tower_credtype(apps, schema_editor): +def create_rhv_tower_credtype(apps, schema_editor): CredentialType.setup_tower_managed_defaults() diff --git a/awx/main/models/base.py b/awx/main/models/base.py index 9c7f58d096..4eb1d15ed5 100644 --- a/awx/main/models/base.py +++ b/awx/main/models/base.py @@ -52,7 +52,7 @@ PROJECT_UPDATE_JOB_TYPE_CHOICES = [ (PERM_INVENTORY_CHECK, _('Check')), ] -CLOUD_INVENTORY_SOURCES = ['ec2', 'vmware', 'gce', 'azure_rm', 'openstack', 'ovirt4', 'custom', 'satellite6', 'cloudforms', 'scm', 'tower',] +CLOUD_INVENTORY_SOURCES = ['ec2', 'vmware', 'gce', 'azure_rm', 'openstack', 'rhv', 'custom', 'satellite6', 'cloudforms', 'scm', 'tower',] VERBOSITY_CHOICES = [ (0, '0 (Normal)'), diff --git a/awx/main/models/credential.py b/awx/main/models/credential.py index b6cf191b28..f33ed07ee4 100644 --- a/awx/main/models/credential.py +++ b/awx/main/models/credential.py @@ -62,7 +62,7 @@ class V1Credential(object): ('gce', 'Google Compute Engine'), ('azure_rm', 'Microsoft Azure Resource Manager'), ('openstack', 'OpenStack'), - ('ovirt4', 'oVirt4'), + ('rhv', 'Red Hat Virtualization'), ('insights', 'Insights'), ('tower', 'Ansible Tower'), ] @@ -1019,10 +1019,10 @@ def insights(cls): @CredentialType.default -def ovirt4(cls): +def rhv(cls): return cls( kind='cloud', - name='oVirt4', + name='Red Hat Virtualization', managed_by_tower=True, inputs={ 'fields': [{ diff --git a/awx/main/models/inventory.py b/awx/main/models/inventory.py index 4bb3c8838f..fbf00f0af4 100644 --- a/awx/main/models/inventory.py +++ b/awx/main/models/inventory.py @@ -883,7 +883,7 @@ class InventorySourceOptions(BaseModel): ('satellite6', _('Red Hat Satellite 6')), ('cloudforms', _('Red Hat CloudForms')), ('openstack', _('OpenStack')), - ('ovirt4', _('oVirt4')), + ('rhv', _('Red Hat Virtualization')), ('tower', _('Ansible Tower')), ('custom', _('Custom Script')), ] @@ -1134,7 +1134,7 @@ class InventorySourceOptions(BaseModel): return [('all', 'All')] @classmethod - def get_ovirt4_region_choices(self): + def get_rhv_region_choices(self): """No region supprt""" return [('all', 'All')] diff --git a/awx/main/tests/functional/test_credential.py b/awx/main/tests/functional/test_credential.py index d69ee9ce37..a9463ddcfb 100644 --- a/awx/main/tests/functional/test_credential.py +++ b/awx/main/tests/functional/test_credential.py @@ -25,7 +25,7 @@ def test_default_cred_types(): 'insights', 'net', 'openstack', - 'ovirt4', + 'rhv', 'satellite6', 'scm', 'ssh', diff --git a/awx/main/tests/unit/test_tasks.py b/awx/main/tests/unit/test_tasks.py index 28d24f62cc..0b54b310d8 100644 --- a/awx/main/tests/unit/test_tasks.py +++ b/awx/main/tests/unit/test_tasks.py @@ -704,8 +704,8 @@ class TestJobCredentials(TestJobExecution): self.task.run(self.pk) @pytest.mark.parametrize("ca_file", [None, '/path/to/some/file']) - def test_ovirt4_credentials(self, ca_file): - ovirt4 = CredentialType.defaults['ovirt4']() + def test_rhv_credentials(self, ca_file): + rhv = CredentialType.defaults['rhv']() inputs = { 'host': 'some-ovirt-host.example.org', 'username': 'bob', @@ -715,7 +715,7 @@ class TestJobCredentials(TestJobExecution): inputs['ca_file'] = ca_file credential = Credential( pk=1, - credential_type=ovirt4, + credential_type=rhv, inputs=inputs ) credential.inputs['password'] = encrypt_field(credential, 'password') diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index d6c1b1140e..b381548668 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -825,12 +825,12 @@ OPENSTACK_INSTANCE_ID_VAR = 'openstack.id' # --------------------- # ----- oVirt4 ----- # --------------------- -OVIRT4_ENABLED_VAR = 'status' -OVIRT4_ENABLED_VALUE = 'up' -OVIRT4_GROUP_FILTER = r'^.+$' -OVIRT4_HOST_FILTER = r'^.+$' -OVIRT4_EXCLUDE_EMPTY_GROUPS = True -OVIRT4_INSTANCE_ID_VAR = 'id' +RHV_ENABLED_VAR = 'status' +RHV_ENABLED_VALUE = 'up' +RHV_GROUP_FILTER = r'^.+$' +RHV_HOST_FILTER = r'^.+$' +RHV_EXCLUDE_EMPTY_GROUPS = True +RHV_INSTANCE_ID_VAR = 'id' # --------------------- # ----- Tower -----