Skip to content

Commit 20908f6

Browse files
issues877 changed pricing in the HW details to show sub items, along with properly calculating total cost
1 parent 178dc1e commit 20908f6

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

Diff for: SoftLayer/CLI/hardware/detail.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,15 @@ def cli(env, identifier, passwords, price):
8484
table.add_row(['notes', result['notes']])
8585

8686
if price:
87-
total_price = utils.lookup(result,
88-
'billingItem',
89-
'nextInvoiceTotalRecurringAmount') or 0
90-
total_price += sum(p['nextInvoiceTotalRecurringAmount']
91-
for p
92-
in utils.lookup(result,
93-
'billingItem',
94-
'children') or [])
95-
table.add_row(['price_rate', total_price])
87+
price_table = formatting.Table(['Item', 'Recurring Price'])
88+
89+
total_price = utils.lookup(result, 'billingItem', 'nextInvoiceTotalRecurringAmount') or 0
90+
price_table.add_row(['Total', total_price])
91+
92+
for item in utils.lookup(result, 'billingItem', 'children') or []:
93+
price_table.add_row([item['description'], item['nextInvoiceTotalRecurringAmount']])
94+
95+
table.add_row(['prices', price_table])
9696

9797
if passwords:
9898
pass_table = formatting.Table(['username', 'password'])

Diff for: SoftLayer/fixtures/SoftLayer_Hardware_Server.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@
88
'recurringFee': 1.54,
99
'nextInvoiceTotalRecurringAmount': 16.08,
1010
'children': [
11-
{'nextInvoiceTotalRecurringAmount': 1},
12-
{'nextInvoiceTotalRecurringAmount': 1},
13-
{'nextInvoiceTotalRecurringAmount': 1},
14-
{'nextInvoiceTotalRecurringAmount': 1},
15-
{'nextInvoiceTotalRecurringAmount': 1},
11+
{'description': 'test', 'nextInvoiceTotalRecurringAmount': 1},
1612
],
1713
'orderItem': {
1814
'order': {

Diff for: tests/CLI/modules/server_tests.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ def test_server_details(self):
4444
'os': 'Ubuntu',
4545
'os_version': 'Ubuntu 12.04 LTS',
4646
'owner': 'chechu',
47-
'price_rate': 21.08,
47+
'prices': [{'Item': 'Total', 'Recurring Price': 16.08},
48+
{'Item': 'test', 'Recurring Price': 1}],
4849
'private_ip': '10.1.0.2',
4950
'ptr': '2.0.1.10.in-addr.arpa',
5051
'public_ip': '172.16.1.100',

0 commit comments

Comments
 (0)