mirror of
https://github.com/ansible/awx.git
synced 2026-03-03 17:51:06 -03:30
Merge pull request #542 from jangsutsr/fix-7737
[3.2.2]support `AZURE_CLOUD_ENVIRONMENT`
This commit is contained in:
18
awx/main/migrations/0012_v322_update_cred_types.py
Normal file
18
awx/main/migrations/0012_v322_update_cred_types.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
# AWX
|
||||||
|
from awx.main.migrations import _credentialtypes as credentialtypes
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('main', '0011_v322_encrypt_survey_passwords'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(credentialtypes.add_azure_cloud_environment_field),
|
||||||
|
]
|
||||||
@@ -176,3 +176,13 @@ def migrate_job_credentials(apps, schema_editor):
|
|||||||
|
|
||||||
def create_ovirt4_credtype(apps, schema_editor):
|
def create_ovirt4_credtype(apps, schema_editor):
|
||||||
CredentialType.setup_tower_managed_defaults()
|
CredentialType.setup_tower_managed_defaults()
|
||||||
|
|
||||||
|
|
||||||
|
def add_azure_cloud_environment_field(apps, schema_editor):
|
||||||
|
azure_rm_credtype = CredentialType.defaults.get('azure_rm', None)
|
||||||
|
if azure_rm_credtype:
|
||||||
|
azure_rm_credtype = azure_rm_credtype()
|
||||||
|
azure_rm_credtype.pk = CredentialType.objects.get(
|
||||||
|
kind='cloud', name='Microsoft Azure Resource Manager'
|
||||||
|
).pk
|
||||||
|
azure_rm_credtype.save()
|
||||||
|
|||||||
@@ -977,6 +977,12 @@ def azure_rm(cls):
|
|||||||
'id': 'tenant',
|
'id': 'tenant',
|
||||||
'label': 'Tenant ID',
|
'label': 'Tenant ID',
|
||||||
'type': 'string'
|
'type': 'string'
|
||||||
|
}, {
|
||||||
|
'id': 'cloud_environment',
|
||||||
|
'label': 'Azure Cloud Environment',
|
||||||
|
'type': 'string',
|
||||||
|
'help_text': ('Environment variable AZURE_CLOUD_ENVIRONMENT when'
|
||||||
|
' using Azure GovCloud or Azure stack.')
|
||||||
}],
|
}],
|
||||||
'required': ['subscription'],
|
'required': ['subscription'],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1890,6 +1890,9 @@ class RunInventoryUpdate(BaseTask):
|
|||||||
env['AZURE_AD_USER'] = passwords.get('source_username', '')
|
env['AZURE_AD_USER'] = passwords.get('source_username', '')
|
||||||
env['AZURE_PASSWORD'] = passwords.get('source_password', '')
|
env['AZURE_PASSWORD'] = passwords.get('source_password', '')
|
||||||
env['AZURE_INI_PATH'] = cloud_credential
|
env['AZURE_INI_PATH'] = cloud_credential
|
||||||
|
if inventory_update.credential and \
|
||||||
|
inventory_update.credential.inputs.get('cloud_environment', None):
|
||||||
|
env['AZURE_CLOUD_ENVIRONMENT'] = inventory_update.credential.inputs['cloud_environment']
|
||||||
elif inventory_update.source == 'gce':
|
elif inventory_update.source == 'gce':
|
||||||
env['GCE_EMAIL'] = passwords.get('source_username', '')
|
env['GCE_EMAIL'] = passwords.get('source_username', '')
|
||||||
env['GCE_PROJECT'] = passwords.get('source_project', '')
|
env['GCE_PROJECT'] = passwords.get('source_project', '')
|
||||||
|
|||||||
Reference in New Issue
Block a user