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
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_resource_group', 'yes')
cp.set(section, 'group_by_location', 'yes') cp.set(section, 'group_by_location', 'yes')
cp.set(section, 'group_by_tag', '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. # Return INI content.
if cp.sections(): if cp.sections():
@@ -1747,6 +1752,7 @@ class RunInventoryUpdate(BaseTask):
env['AZURE_SUBSCRIPTION_ID'] = passwords.get('source_subscription', '') env['AZURE_SUBSCRIPTION_ID'] = passwords.get('source_subscription', '')
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
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', '')

View File

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