1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Merge pull request #6997 from jangsutsr/625_enable_source_region_for_azure_inv_src

Enable source_region for azure_rm inventory source
This commit is contained in:
Aaron Tan 2017-07-11 17:02:41 -04:00 committed by GitHub
commit 19e3071fec
2 changed files with 31 additions and 24 deletions

View File

@ -1670,6 +1670,11 @@ class RunInventoryUpdate(BaseTask):
cp.set(section, 'group_by_resource_group', 'yes')
cp.set(section, 'group_by_location', 'yes')
cp.set(section, 'group_by_tag', 'yes')
if inventory_update.source_regions:
cp.set(
section, 'locations',
','.join([x.strip() for x in inventory_update.source_regions.split(',')])
)
# Return INI content.
if cp.sections():
@ -1747,6 +1752,7 @@ class RunInventoryUpdate(BaseTask):
env['AZURE_SUBSCRIPTION_ID'] = passwords.get('source_subscription', '')
env['AZURE_AD_USER'] = passwords.get('source_username', '')
env['AZURE_PASSWORD'] = passwords.get('source_password', '')
env['AZURE_INI_PATH'] = cloud_credential
elif inventory_update.source == 'gce':
env['GCE_EMAIL'] = passwords.get('source_username', '')
env['GCE_PROJECT'] = passwords.get('source_project', '')

View File

@ -777,30 +777,31 @@ GCE_INSTANCE_ID_VAR = None
# It's not possible to get zones in Azure without authenticating, so we
# provide a list here.
AZURE_REGION_CHOICES = [
('Central_US', _('US Central')),
('East_US_1', _('US East')),
('East_US_2', _('US East 2')),
('North_Central_US', _('US North Central')),
('South_Central_US', _('US South Central')),
('West_Central_US', _('US West Central')),
('West_US', _('US West')),
('East_Canada', _('Canada East')),
('Central_Canada', _('Canada Central')),
('South_Brazil', _('Brazil South')),
('North_Europe', _('Europe North')),
('West_Europe', _('Europe West')),
('West_UK', _('UK West')),
('South_UK', _('UK South')),
('East_Asia', _('Asia East')),
('Southest_Asia', _('Asia Southeast')),
('East_Australia', _('Australia East')),
('Southest_Australia', _('Australia Southeast')),
('West_India', _('India West')),
('South_India', _('India South')),
('East_Japan', _('Japan East')),
('West_Japan', _('Japan West')),
('Central_Korea', _('Korea Central')),
('South_Korea', _('Korea South')),
('eastus', _('US East')),
('eastus2', _('US East 2')),
('centralus', _('US Central')),
('northcentralus', _('US North Central')),
('southcentralus', _('US South Central')),
('westcentralus', _('US West Central')),
('westus', _('US West')),
('westus2', _('US West 2')),
('canadaeast', _('Canada East')),
('canadacentral', _('Canada Central')),
('brazilsouth', _('Brazil South')),
('northeurope', _('Europe North')),
('westeurope', _('Europe West')),
('ukwest', _('UK West')),
('uksouth', _('UK South')),
('eastasia', _('Asia East')),
('southestasia', _('Asia Southeast')),
('australiaeast', _('Australia East')),
('australiasoutheast', _('Australia Southeast')),
('westindia', _('India West')),
('southindia', _('India South')),
('japaneast', _('Japan East')),
('japanwest', _('Japan West')),
('koreacentral', _('Korea Central')),
('koreasouth', _('Korea South')),
]
AZURE_REGIONS_BLACKLIST = []