Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions SoftLayer/CLI/hardware/detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,15 @@ def cli(env, identifier, passwords, price):
table.add_row(['notes', result['notes']])

if price:
table.add_row(['price rate',
utils.lookup(result,
'billingItem',
'nextInvoiceTotalRecurringAmount')])
total_price = utils.lookup(result,
'billingItem',
'nextInvoiceTotalRecurringAmount') or 0
total_price += sum(p['nextInvoiceTotalRecurringAmount']
for p
in utils.lookup(result,
'billingItem',
'children') or [])
table.add_row(['price_rate', total_price])

if passwords:
pass_table = formatting.Table(['username', 'password'])
Expand Down
11 changes: 9 additions & 2 deletions SoftLayer/CLI/virt/detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,15 @@ def cli(env, identifier, passwords=False, price=False):
table.add_row(['notes', result['notes']])

if price:
table.add_row(['price rate',
result['billingItem']['recurringFee']])
total_price = utils.lookup(result,
'billingItem',
'nextInvoiceTotalRecurringAmount') or 0
total_price += sum(p['nextInvoiceTotalRecurringAmount']
for p
in utils.lookup(result,
'billingItem',
'children') or [])
table.add_row(['price_rate', total_price])

if passwords:
pass_table = formatting.Table(['software', 'username', 'password'])
Expand Down
7 changes: 7 additions & 0 deletions SoftLayer/fixtures/SoftLayer_Hardware_Server.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
'id': 6327,
'recurringFee': 1.54,
'nextInvoiceTotalRecurringAmount': 16.08,
'children': [
{'nextInvoiceTotalRecurringAmount': 1},
{'nextInvoiceTotalRecurringAmount': 1},
{'nextInvoiceTotalRecurringAmount': 1},
{'nextInvoiceTotalRecurringAmount': 1},
{'nextInvoiceTotalRecurringAmount': 1},
],
'orderItem': {
'order': {
'userRecord': {
Expand Down
9 changes: 8 additions & 1 deletion SoftLayer/fixtures/SoftLayer_Virtual_Guest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
'status': {'keyName': 'ACTIVE', 'name': 'Active'},
'billingItem': {
'id': 6327,
'recurringFee': 1.54,
'nextInvoiceTotalRecurringAmount': 1.54,
'children': [
{'nextInvoiceTotalRecurringAmount': 1},
{'nextInvoiceTotalRecurringAmount': 1},
{'nextInvoiceTotalRecurringAmount': 1},
{'nextInvoiceTotalRecurringAmount': 1},
{'nextInvoiceTotalRecurringAmount': 1},
],
'orderItem': {
'order': {
'userRecord': {
Expand Down
7 changes: 5 additions & 2 deletions SoftLayer/managers/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,14 @@ def get_hardware(self, hardware_id, **kwargs):
version,
referenceCode]],
passwords[username,password]],'''
'billingItem.nextInvoiceTotalRecurringAmount,'
'billingItem['
'id,nextInvoiceTotalRecurringAmount,'
'children[nextInvoiceTotalRecurringAmount],'
'orderItem.order.userRecord[username]'
'],'
'hourlyBillingFlag,'
'tagReferences[id,tag[name,id]],'
'networkVlans[id,vlanNumber,networkSpace],'
'billingItem.orderItem.order.userRecord[username],'
'remoteManagementAccounts[username,password]'
)

Expand Down
9 changes: 6 additions & 3 deletions SoftLayer/managers/vs.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,13 @@ def get_instance(self, instance_id, **kwargs):
referenceCode]]],'''
'hourlyBillingFlag,'
'userData,'
'billingItem.recurringFee,'
'billingItem['
'id,nextInvoiceTotalRecurringAmount,'
'children[categoryCode,nextInvoiceTotalRecurringAmount],'
'orderItem.order.userRecord[username]'
'],'
'tagReferences[id,tag[name,id]],'
'networkVlans[id,vlanNumber,networkSpace],'
'billingItem.orderItem.order.userRecord[username]'
'networkVlans[id,vlanNumber,networkSpace]'
)

return self.guest.getObject(id=instance_id, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion tests/CLI/modules/server_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_server_details(self):
'os': 'Ubuntu',
'os_version': 'Ubuntu 12.04 LTS',
'owner': 'chechu',
'price rate': 16.08,
'price_rate': 21.08,
'private_ip': '10.1.0.2',
'ptr': '2.0.1.10.in-addr.arpa',
'public_ip': '172.16.1.100',
Expand Down
2 changes: 1 addition & 1 deletion tests/CLI/modules/vs_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_detail_vs(self):
'os': 'Ubuntu',
'os_version': '12.04-64 Minimal for VSI',
'notes': 'notes',
'price rate': 1.54,
'price_rate': 6.54,
'tags': ['production'],
'private_cpu': {},
'private_ip': '10.45.19.37',
Expand Down