From b2bdb0c81ddef6cb9ec055b0002d8d7e8db76ee5 Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Fri, 1 May 2020 09:38:17 -0400 Subject: [PATCH] lose cloudforms as inventory source option --- awx/main/constants.py | 3 +-- .../migrations/0115_auto_20200501_1325.py | 23 +++++++++++++++++++ awx/main/models/base.py | 3 ++- awx/main/models/inventory.py | 10 -------- awx/settings/defaults.py | 10 -------- .../NodeTypeStep/InventorySourcesList.jsx | 1 - .../plugins/modules/tower_inventory_source.py | 4 ++-- 7 files changed, 28 insertions(+), 26 deletions(-) create mode 100644 awx/main/migrations/0115_auto_20200501_1325.py diff --git a/awx/main/constants.py b/awx/main/constants.py index 6542fe4ae0..989abb8858 100644 --- a/awx/main/constants.py +++ b/awx/main/constants.py @@ -10,8 +10,7 @@ __all__ = [ 'ANSI_SGR_PATTERN', 'CAN_CANCEL', 'ACTIVE_STATES', 'STANDARD_INVENTORY_UPDATE_ENV' ] -# TODO: remove cloudforms -CLOUD_PROVIDERS = ('azure_rm', 'ec2', 'gce', 'vmware', 'openstack', 'rhv', 'satellite6', 'cloudforms', 'tower') +CLOUD_PROVIDERS = ('azure_rm', 'ec2', 'gce', 'vmware', 'openstack', 'rhv', 'satellite6', 'tower') SCHEDULEABLE_PROVIDERS = CLOUD_PROVIDERS + ('custom', 'scm',) PRIVILEGE_ESCALATION_METHODS = [ ('sudo', _('Sudo')), ('su', _('Su')), ('pbrun', _('Pbrun')), ('pfexec', _('Pfexec')), diff --git a/awx/main/migrations/0115_auto_20200501_1325.py b/awx/main/migrations/0115_auto_20200501_1325.py new file mode 100644 index 0000000000..aa3e08185e --- /dev/null +++ b/awx/main/migrations/0115_auto_20200501_1325.py @@ -0,0 +1,23 @@ +# Generated by Django 2.2.11 on 2020-05-01 13:25 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('main', '0114_v370_remove_deprecated_manual_inventory_sources'), + ] + + operations = [ + migrations.AlterField( + model_name='inventorysource', + name='source', + field=models.CharField(choices=[('file', 'File, Directory or Script'), ('scm', 'Sourced from a Project'), ('ec2', 'Amazon EC2'), ('gce', 'Google Compute Engine'), ('azure_rm', 'Microsoft Azure Resource Manager'), ('vmware', 'VMware vCenter'), ('satellite6', 'Red Hat Satellite 6'), ('openstack', 'OpenStack'), ('rhv', 'Red Hat Virtualization'), ('tower', 'Ansible Tower'), ('custom', 'Custom Script')], default=None, max_length=32), + ), + migrations.AlterField( + model_name='inventoryupdate', + name='source', + field=models.CharField(choices=[('file', 'File, Directory or Script'), ('scm', 'Sourced from a Project'), ('ec2', 'Amazon EC2'), ('gce', 'Google Compute Engine'), ('azure_rm', 'Microsoft Azure Resource Manager'), ('vmware', 'VMware vCenter'), ('satellite6', 'Red Hat Satellite 6'), ('openstack', 'OpenStack'), ('rhv', 'Red Hat Virtualization'), ('tower', 'Ansible Tower'), ('custom', 'Custom Script')], default=None, max_length=32), + ), + ] diff --git a/awx/main/models/base.py b/awx/main/models/base.py index 915b18977f..446b29e1b6 100644 --- a/awx/main/models/base.py +++ b/awx/main/models/base.py @@ -15,6 +15,7 @@ from crum import get_current_user # AWX from awx.main.utils import encrypt_field, parse_yaml_or_json +from awx.main.constants import CLOUD_PROVIDERS __all__ = ['prevent_search', 'VarsDictProperty', 'BaseModel', 'CreatedModifiedModel', 'PasswordFieldsModel', 'PrimordialModel', 'CommonModel', @@ -50,7 +51,7 @@ PROJECT_UPDATE_JOB_TYPE_CHOICES = [ (PERM_INVENTORY_CHECK, _('Check')), ] -CLOUD_INVENTORY_SOURCES = ['ec2', 'vmware', 'gce', 'azure_rm', 'openstack', 'rhv', 'custom', 'satellite6', 'cloudforms', 'scm', 'tower',] +CLOUD_INVENTORY_SOURCES = list(CLOUD_PROVIDERS) + ['scm', 'custom'] VERBOSITY_CHOICES = [ (0, '0 (Normal)'), diff --git a/awx/main/models/inventory.py b/awx/main/models/inventory.py index 6eb4088675..d4a1c5f3b7 100644 --- a/awx/main/models/inventory.py +++ b/awx/main/models/inventory.py @@ -11,10 +11,6 @@ import copy import os.path from urllib.parse import urljoin import yaml -import configparser -import tempfile -from io import StringIO -from distutils.version import LooseVersion as Version # Django from django.conf import settings @@ -829,7 +825,6 @@ class InventorySourceOptions(BaseModel): ('azure_rm', _('Microsoft Azure Resource Manager')), ('vmware', _('VMware vCenter')), ('satellite6', _('Red Hat Satellite 6')), - ('cloudforms', _('Red Hat CloudForms')), ('openstack', _('OpenStack')), ('rhv', _('Red Hat Virtualization')), ('tower', _('Ansible Tower')), @@ -1069,11 +1064,6 @@ class InventorySourceOptions(BaseModel): """Red Hat Satellite 6 region choices (not implemented)""" return [('all', 'All')] - @classmethod - def get_cloudforms_region_choices(self): - """Red Hat CloudForms region choices (not implemented)""" - return [('all', 'All')] - @classmethod def get_rhv_region_choices(self): """No region supprt""" diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index f5507262bf..7a477316da 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -865,16 +865,6 @@ SATELLITE6_EXCLUDE_EMPTY_GROUPS = True SATELLITE6_INSTANCE_ID_VAR = 'foreman.id' # SATELLITE6_GROUP_PREFIX and SATELLITE6_GROUP_PATTERNS defined in source vars -# --------------------- -# ----- CloudForms ----- -# --------------------- -CLOUDFORMS_ENABLED_VAR = 'cloudforms.power_state' -CLOUDFORMS_ENABLED_VALUE = 'on' -CLOUDFORMS_GROUP_FILTER = r'^.+$' -CLOUDFORMS_HOST_FILTER = r'^.+$' -CLOUDFORMS_EXCLUDE_EMPTY_GROUPS = True -CLOUDFORMS_INSTANCE_ID_VAR = 'cloudforms.id' - # --------------------- # ----- Custom ----- # --------------------- diff --git a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeTypeStep/InventorySourcesList.jsx b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeTypeStep/InventorySourcesList.jsx index 82e083d6cd..bc4d13db48 100644 --- a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeTypeStep/InventorySourcesList.jsx +++ b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeTypeStep/InventorySourcesList.jsx @@ -79,7 +79,6 @@ function InventorySourcesList({ i18n, nodeResource, onUpdateNodeResource }) { [`azure_rm`, i18n._(t`Microsoft Azure Resource Manager`)], [`vmware`, i18n._(t`VMware vCenter`)], [`satellite6`, i18n._(t`Red Hat Satellite 6`)], - [`cloudforms`, i18n._(t`Red Hat CloudForms`)], [`openstack`, i18n._(t`OpenStack`)], [`rhv`, i18n._(t`Red Hat Virtualization`)], [`tower`, i18n._(t`Ansible Tower`)], diff --git a/awx_collection/plugins/modules/tower_inventory_source.py b/awx_collection/plugins/modules/tower_inventory_source.py index 98d523837e..b094bb6b55 100644 --- a/awx_collection/plugins/modules/tower_inventory_source.py +++ b/awx_collection/plugins/modules/tower_inventory_source.py @@ -43,7 +43,7 @@ options: source: description: - The source to use for this group. - choices: [ "scm", "ec2", "gce", "azure_rm", "vmware", "satellite6", "cloudforms", "openstack", "rhv", "tower", "custom" ] + choices: [ "scm", "ec2", "gce", "azure_rm", "vmware", "satellite6", "openstack", "rhv", "tower", "custom" ] type: str source_path: description: @@ -162,7 +162,7 @@ def main(): # How do we handle manual and file? Tower does not seem to be able to activate them # source=dict(choices=["scm", "ec2", "gce", - "azure_rm", "vmware", "satellite6", "cloudforms", + "azure_rm", "vmware", "satellite6", "openstack", "rhv", "tower", "custom"]), source_path=dict(), source_script=dict(),