Skip to content

Commit 0bf2018

Browse files
Merge pull request #1293 from caberos/issue1292
add system operation referenceCode in create-option
2 parents c6e6141 + 24456e9 commit 0bf2018

File tree

4 files changed

+30
-27
lines changed

4 files changed

+30
-27
lines changed

SoftLayer/CLI/hardware/create_options.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ def cli(env):
3333
tables.append(preset_table)
3434

3535
# Operating systems
36-
os_table = formatting.Table(['operating_system', 'value'])
36+
os_table = formatting.Table(['operating_system', 'value', 'operatingSystemReferenceCode '])
3737
os_table.sortby = 'value'
3838
for operating_system in options['operating_systems']:
39-
os_table.add_row([operating_system['name'], operating_system['key']])
39+
os_table.add_row([operating_system['name'], operating_system['key'], operating_system['referenceCode']])
4040
tables.append(os_table)
4141

4242
# Port speed

SoftLayer/managers/hardware.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,8 @@ def get_create_options(self):
403403
if item['itemCategory']['categoryCode'] == 'os':
404404
operating_systems.append({
405405
'name': item['softwareDescription']['longDescription'],
406-
'key': item['keyName']
406+
'key': item['keyName'],
407+
'referenceCode': item['softwareDescription']['referenceCode']
407408
})
408409

409410
# Port speeds

tests/CLI/modules/server_tests.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,8 @@ def test_create_options(self):
362362
{'size': 'Dual Xeon Gold, 384GB Ram, 4x960GB SSD, RAID 10',
363363
'value': 'DGOLD_6140_384GB_4X960GB_SSD_SED_RAID_10'}],
364364
[{'operating_system': 'Ubuntu / 14.04-64',
365-
'value': 'OS_UBUNTU_14_04_LTS_TRUSTY_TAHR_64_BIT'}],
365+
'value': 'OS_UBUNTU_14_04_LTS_TRUSTY_TAHR_64_BIT',
366+
'operatingSystemReferenceCode ': 'UBUNTU_14_64'}],
366367
[{'port_speed': '10 Mbps Public & Private Network Uplinks',
367368
'value': '10'}],
368369
[{'extras': '1 IPv6 Address', 'value': '1_IPV6_ADDRESS'}]]
@@ -694,19 +695,19 @@ def test_dns_sync_both(self, confirm_mock):
694695
'getResourceRecords')
695696
getResourceRecords.return_value = []
696697
createAargs = ({
697-
'type': 'a',
698-
'host': 'hardware-test1',
699-
'domainId': 12345, # from SoftLayer_Account::getDomains
700-
'data': '172.16.1.100',
701-
'ttl': 7200
702-
},)
698+
'type': 'a',
699+
'host': 'hardware-test1',
700+
'domainId': 12345, # from SoftLayer_Account::getDomains
701+
'data': '172.16.1.100',
702+
'ttl': 7200
703+
},)
703704
createPTRargs = ({
704-
'type': 'ptr',
705-
'host': '100',
706-
'domainId': 123456,
707-
'data': 'hardware-test1.test.sftlyr.ws',
708-
'ttl': 7200
709-
},)
705+
'type': 'ptr',
706+
'host': '100',
707+
'domainId': 123456,
708+
'data': 'hardware-test1.test.sftlyr.ws',
709+
'ttl': 7200
710+
},)
710711

711712
result = self.run_command(['hw', 'dns-sync', '1000'])
712713

@@ -749,12 +750,12 @@ def test_dns_sync_v6(self, confirm_mock):
749750
}
750751
}
751752
createV6args = ({
752-
'type': 'aaaa',
753-
'host': 'hardware-test1',
754-
'domainId': 12345, # from SoftLayer_Account::getDomains
755-
'data': '2607:f0d0:1b01:0023:0000:0000:0000:0004',
756-
'ttl': 7200
757-
},)
753+
'type': 'aaaa',
754+
'host': 'hardware-test1',
755+
'domainId': 12345, # from SoftLayer_Account::getDomains
756+
'data': '2607:f0d0:1b01:0023:0000:0000:0000:0004',
757+
'ttl': 7200
758+
},)
758759
server.return_value = test_server
759760
result = self.run_command(['hw', 'dns-sync', '--aaaa-record', '1000'])
760761
self.assert_no_fail(result)

tests/managers/hardware_tests.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ def test_get_create_options(self):
121121
'extras': [{'key': '1_IPV6_ADDRESS', 'name': '1 IPv6 Address'}],
122122
'locations': [{'key': 'wdc01', 'name': 'Washington 1'}],
123123
'operating_systems': [{'key': 'OS_UBUNTU_14_04_LTS_TRUSTY_TAHR_64_BIT',
124-
'name': 'Ubuntu / 14.04-64'}],
124+
'name': 'Ubuntu / 14.04-64',
125+
'referenceCode': 'UBUNTU_14_64'}],
125126
'port_speeds': [{
126127
'key': '10',
127128
'name': '10 Mbps Public & Private Network Uplinks'
@@ -374,10 +375,10 @@ def test_edit(self):
374375
self.assert_called_with('SoftLayer_Hardware_Server',
375376
'editObject',
376377
args=({
377-
'hostname': 'new-host',
378-
'domain': 'new.sftlyr.ws',
379-
'notes': 'random notes',
380-
},),
378+
'hostname': 'new-host',
379+
'domain': 'new.sftlyr.ws',
380+
'notes': 'random notes',
381+
},),
381382
identifier=100)
382383

383384
def test_rescue(self):

0 commit comments

Comments
 (0)