From 2f7e29fc3aa0adf59a7d5b6c89d23d3c642932d0 Mon Sep 17 00:00:00 2001 From: Sergio Carlos Morales Angeles Date: Wed, 19 Jul 2017 11:02:25 -0500 Subject: [PATCH] Fix dedicated/private VSI price retrieval for upgrades --- SoftLayer/fixtures/SoftLayer_Product_Package.py | 5 ++++- SoftLayer/managers/vs.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/SoftLayer/fixtures/SoftLayer_Product_Package.py b/SoftLayer/fixtures/SoftLayer_Product_Package.py index 237b64a70..b910b26f6 100644 --- a/SoftLayer/fixtures/SoftLayer_Product_Package.py +++ b/SoftLayer/fixtures/SoftLayer_Product_Package.py @@ -348,7 +348,8 @@ { 'id': 1240, 'capacity': '4', - 'description': 'Private Computing Instance', + 'units': 'PRIVATE_CORE', + 'description': 'Computing Instance (Dedicated)', 'itemCategory': {'categoryCode': 'Computing Instance'}, 'prices': [{'id': 1007, 'categories': [{'id': 80, @@ -358,6 +359,7 @@ { 'id': 1250, 'capacity': '4', + 'units': 'CORE', 'description': 'Computing Instance', 'itemCategory': {'categoryCode': 'Computing Instance'}, 'prices': [{'id': 1144, @@ -369,6 +371,7 @@ { 'id': 112233, 'capacity': '55', + 'units': 'CORE', 'description': 'Computing Instance', 'itemCategory': {'categoryCode': 'Computing Instance'}, 'prices': [{'id': 332211, diff --git a/SoftLayer/managers/vs.py b/SoftLayer/managers/vs.py index 467bd4ce8..2e27b99fb 100644 --- a/SoftLayer/managers/vs.py +++ b/SoftLayer/managers/vs.py @@ -819,6 +819,7 @@ def _get_package_items(self): mask = [ 'description', 'capacity', + 'units', 'prices[id,locationGroupId,categories[name,id,categoryCode]]' ] mask = "mask[%s]" % ','.join(mask) @@ -848,7 +849,7 @@ def _get_price_id_for_upgrade(self, package_items, option, value, } category_code = option_category[option] for item in package_items: - is_private = str(item['description']).startswith('Private') + is_private = (item.get('units') == 'PRIVATE_CORE') for price in item['prices']: if 'locationGroupId' in price and price['locationGroupId']: # Skip location based prices