Repository: softlayer/softlayer-python
Pull request #1172 (2019-09-24 23:06:44)

Fix Issue #1162


Patch:
diff --git a/SoftLayer/managers/hardware.py b/SoftLayer/managers/hardware.py
index fb85c328..6cbeb91f 100644
--- a/SoftLayer/managers/hardware.py
+++ b/SoftLayer/managers/hardware.py
@@ -403,7 +403,7 @@ def get_create_options(self):
             if item['itemCategory']['categoryCode'] == 'os':
                 operating_systems.append({
                     'name': item['softwareDescription']['longDescription'],
-                    'key': item['softwareDescription']['referenceCode'],
+                    'key': item['keyName']
                 })
 
         # Port speeds
@@ -777,8 +777,7 @@ def _get_os_price_id(items, os, location):
                              'itemCategory',
                              'categoryCode') != 'os',
                 utils.lookup(item,
-                             'softwareDescription',
-                             'referenceCode') != os]):
+                             'keyName') != os]):
             continue
 
         for price in item['prices']:


Test patch:
diff --git a/tests/CLI/modules/server_tests.py b/tests/CLI/modules/server_tests.py
index f14118bc..70d4c316 100644
--- a/tests/CLI/modules/server_tests.py
+++ b/tests/CLI/modules/server_tests.py
@@ -317,7 +317,7 @@ def test_create_options(self):
              {'size': 'Dual Xeon Gold, 384GB Ram, 4x960GB SSD, RAID 10',
               'value': 'DGOLD_6140_384GB_4X960GB_SSD_SED_RAID_10'}],
             [{'operating_system': 'Ubuntu / 14.04-64',
-              'value': 'UBUNTU_14_64'}],
+              'value': 'OS_UBUNTU_14_04_LTS_TRUSTY_TAHR_64_BIT'}],
             [{'port_speed': '10 Mbps Public & Private Network Uplinks',
               'value': '10'}],
             [{'extras': '1 IPv6 Address', 'value': '1_IPV6_ADDRESS'}]]
@@ -336,7 +336,7 @@ def test_create_server(self, order_mock):
                                    '--domain=example.com',
                                    '--datacenter=TEST00',
                                    '--port-speed=100',
-                                   '--os=UBUNTU_12_64',
+                                   '--os=OS_UBUNTU_14_04_LTS_TRUSTY_TAHR_64_BIT',
                                    '--no-public',
                                    '--key=10',
                                    ])
diff --git a/tests/managers/hardware_tests.py b/tests/managers/hardware_tests.py
index 7cff1130..cf10224a 100644
--- a/tests/managers/hardware_tests.py
+++ b/tests/managers/hardware_tests.py
@@ -123,7 +123,7 @@ def test_get_create_options(self):
         expected = {
             'extras': [{'key': '1_IPV6_ADDRESS', 'name': '1 IPv6 Address'}],
             'locations': [{'key': 'wdc01', 'name': 'Washington 1'}],
-            'operating_systems': [{'key': 'UBUNTU_14_64',
+            'operating_systems': [{'key': 'OS_UBUNTU_14_04_LTS_TRUSTY_TAHR_64_BIT',
                                    'name': 'Ubuntu / 14.04-64'}],
             'port_speeds': [{
                 'key': '10',
@@ -180,7 +180,7 @@ def test_generate_create_dict_invalid_size(self):
             'hostname': 'unicorn',
             'domain': 'giggles.woo',
             'location': 'wdc01',
-            'os': 'UBUNTU_14_64',
+            'os': 'OS_UBUNTU_14_04_LTS_TRUSTY_TAHR_64_BIT',
             'port_speed': 10,
         }
 
@@ -194,7 +194,7 @@ def test_generate_create_dict(self):
             'hostname': 'unicorn',
             'domain': 'giggles.woo',
             'location': 'wdc01',
-            'os': 'UBUNTU_14_64',
+            'os': 'OS_UBUNTU_14_04_LTS_TRUSTY_TAHR_64_BIT',
             'port_speed': 10,
             'hourly': True,
             'extras': ['1_IPV6_ADDRESS'],
@@ -514,11 +514,11 @@ def test_get_bandwidth_price_mismatched(self):
     def test_get_os_price_mismatched(self):
         items = [
             {'itemCategory': {'categoryCode': 'os'},
-             'softwareDescription': {'referenceCode': 'TEST_OS'},
+             'keyName': 'OS_TEST',
              'prices': [{'id': 2, 'locationGroupId': 55, 'recurringFee': 99}]
              },
             {'itemCategory': {'categoryCode': 'os'},
-             'softwareDescription': {'referenceCode': 'TEST_OS'},
+             'keyName': 'OS_TEST',
              'prices': [{'id': 3, 'locationGroupId': None, 'recurringFee': 99}]
              },
         ]
@@ -532,7 +532,7 @@ def test_get_os_price_mismatched(self):
                 }
             }
         }
-        result = managers.hardware._get_os_price_id(items, 'TEST_OS', location)
+        result = managers.hardware._get_os_price_id(items, 'OS_TEST', location)
         self.assertEqual(3, result)
 
     def test_get_default_price_id_item_not_first(self):