From f4fee95a9a83dd746388c9e37c9df1bc521febe7 Mon Sep 17 00:00:00 2001 From: caberos Date: Tue, 9 Mar 2021 15:14:54 -0400 Subject: [PATCH 1/3] Add preset datatype in `slcli virtual detail` --- SoftLayer/CLI/virt/detail.py | 1 + SoftLayer/fixtures/SoftLayer_Virtual_Guest.py | 37 ++++++++++--------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/SoftLayer/CLI/virt/detail.py b/SoftLayer/CLI/virt/detail.py index 94c0c7994..731df19ea 100644 --- a/SoftLayer/CLI/virt/detail.py +++ b/SoftLayer/CLI/virt/detail.py @@ -69,6 +69,7 @@ def cli(env, identifier, passwords=False, price=False): table.add_row(['transient', result.get('transientGuestFlag', False)]) table.add_row(['created', result['createDate']]) table.add_row(['modified', result['modifyDate']]) + table.add_row(['preset', result['billingItem']['orderItem']['preset']['keyName']]) table.add_row(_get_owner_row(result)) table.add_row(_get_vlan_table(result)) diff --git a/SoftLayer/fixtures/SoftLayer_Virtual_Guest.py b/SoftLayer/fixtures/SoftLayer_Virtual_Guest.py index ca72350c1..5a3bcc105 100644 --- a/SoftLayer/fixtures/SoftLayer_Virtual_Guest.py +++ b/SoftLayer/fixtures/SoftLayer_Virtual_Guest.py @@ -28,7 +28,8 @@ 'userRecord': { 'username': 'chechu', } - } + }, + 'preset': {'keyName': 'B1_8X16X100'} } }, 'datacenter': {'id': 50, 'name': 'TEST00', @@ -480,16 +481,16 @@ "categoryCode": "guest_disk0", "id": 81 }}, { - "description": "250 GB (SAN)", - "attributes": [ - { - "id": 198, - "attributeTypeKeyName": "SAN_DISK" - }], - "itemCategory": { - "categoryCode": "guest_disk0", - "id": 89 - }}], + "description": "250 GB (SAN)", + "attributes": [ + { + "id": 198, + "attributeTypeKeyName": "SAN_DISK" + }], + "itemCategory": { + "categoryCode": "guest_disk0", + "id": 89 + }}], 'guest_core': [{ "description": "4 x 2.0 GHz or higher Cores (Dedicated)", "attributes": [], @@ -497,13 +498,13 @@ "categoryCode": "guest_core", "id": 80 }}, - { - "description": "8 x 2.0 GHz or higher Cores", - "attributes": [], - "itemCategory": { - "categoryCode": "guest_core", - "id": 90 - }}] + { + "description": "8 x 2.0 GHz or higher Cores", + "attributes": [], + "itemCategory": { + "categoryCode": "guest_core", + "id": 90 + }}] } getReverseDomainRecords = [{ From 4443f0b3d796e07f44b55cec7d64b11aff31bc68 Mon Sep 17 00:00:00 2001 From: caberos Date: Mon, 15 Mar 2021 09:33:37 -0400 Subject: [PATCH 2/3] Fix Teams code review comments --- SoftLayer/CLI/virt/detail.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SoftLayer/CLI/virt/detail.py b/SoftLayer/CLI/virt/detail.py index 731df19ea..0829f782f 100644 --- a/SoftLayer/CLI/virt/detail.py +++ b/SoftLayer/CLI/virt/detail.py @@ -69,7 +69,10 @@ def cli(env, identifier, passwords=False, price=False): table.add_row(['transient', result.get('transientGuestFlag', False)]) table.add_row(['created', result['createDate']]) table.add_row(['modified', result['modifyDate']]) - table.add_row(['preset', result['billingItem']['orderItem']['preset']['keyName']]) + table.add_row(['preset', utils.lookup(result, 'billingItem', + 'orderItem', + 'preset', + 'keyName') or {}]) table.add_row(_get_owner_row(result)) table.add_row(_get_vlan_table(result)) From 60a6febaa00bf86f370bf76da7f7a2a0454f4b16 Mon Sep 17 00:00:00 2001 From: caberos Date: Tue, 16 Mar 2021 09:07:09 -0400 Subject: [PATCH 3/3] Fix Teams code review comments --- SoftLayer/CLI/virt/detail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SoftLayer/CLI/virt/detail.py b/SoftLayer/CLI/virt/detail.py index 0829f782f..01a66cc9f 100644 --- a/SoftLayer/CLI/virt/detail.py +++ b/SoftLayer/CLI/virt/detail.py @@ -72,7 +72,7 @@ def cli(env, identifier, passwords=False, price=False): table.add_row(['preset', utils.lookup(result, 'billingItem', 'orderItem', 'preset', - 'keyName') or {}]) + 'keyName') or '-']) table.add_row(_get_owner_row(result)) table.add_row(_get_vlan_table(result))