AC-615 Handle Rackspace inventory import when source_regions is empty string.

This commit is contained in:
Chris Church 2013-11-06 22:47:52 -05:00
parent 56a4bc8d3a
commit 475c0d87c2
2 changed files with 8 additions and 1 deletions

View File

@ -782,7 +782,7 @@ class RunInventoryUpdate(BaseTask):
env['EC2_INI_PATH'] = kwargs.get('private_data_file', '')
elif inventory_source.source == 'rackspace':
env['RAX_CREDS_FILE'] = kwargs.get('private_data_file', '')
env['RAX_REGION'] = inventory_source.source_regions
env['RAX_REGION'] = inventory_source.source_regions or 'all'
# Set this environment variable so the vendored package won't
# complain about not being able to determine its version number.
env['PBR_VERSION'] = '0.5.21'

View File

@ -967,6 +967,8 @@ class InventoryUpdatesTest(BaseTransactionTest):
self.organization.users.add(self.normal_django_user)
self.inventory = self.organization.inventories.create(name='Cloud Inventory')
self.group = self.inventory.groups.create(name='Cloud Group')
self.inventory2 = self.organization.inventories.create(name='Cloud Inventory 2')
self.group2 = self.inventory2.groups.create(name='Cloud Group 2')
def update_inventory_source(self, group, **kwargs):
inventory_source = group.inventory_source
@ -1055,3 +1057,8 @@ class InventoryUpdatesTest(BaseTransactionTest):
source='rackspace', credential=credential,
source_regions=source_regions)
self.check_inventory_source(inventory_source)
# If test source regions is given, test again with empty string.
if source_regions:
inventory_source2 = self.update_inventory_source(self.group2,
source='rackspace', credential=credential, source_regions='')
self.check_inventory_source(inventory_source2)