Skip to content

Commit

Permalink
Merge pull request #2161 from d3rnn/master
Browse files Browse the repository at this point in the history
More efficient created_by
  • Loading branch information
allmightyspiff authored Jul 5, 2024
2 parents 2fd0c4d + 3adf56c commit 94a3c33
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion SoftLayer/CLI/dedicatedhost/list_guests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer.CLI import helpers
from SoftLayer import utils

COLUMNS = [
column_helper.Column('guid', ('globalIdentifier',)),
Expand All @@ -18,7 +19,8 @@
column_helper.Column('backend_ip', ('primaryBackendIpAddress',)),
column_helper.Column(
'created_by',
('billingItem', 'orderItem', 'order', 'userRecord', 'username')),
lambda created_by: utils.lookup(created_by, 'billingItem', 'orderItem', 'order', 'userRecord', 'username'),
mask='billingItem[id,orderItem[id,order[id,userRecord[username]]]]'),
column_helper.Column('power_state', ('powerState', 'name')),
column_helper.Column(
'tags',
Expand Down
4 changes: 3 additions & 1 deletion SoftLayer/CLI/hardware/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer.CLI import helpers
from SoftLayer import utils

# pylint: disable=unnecessary-lambda

Expand All @@ -22,7 +23,8 @@
mask='activeTransaction[id, transactionStatus[name, friendlyName]]'),
column_helper.Column(
'created_by',
('billingItem', 'orderItem', 'order', 'userRecord', 'username')),
lambda created_by: utils.lookup(created_by, 'billingItem', 'orderItem', 'order', 'userRecord', 'username'),
mask='billingItem[id,orderItem[id,order[id,userRecord[username]]]]'),
column_helper.Column(
'tags',
lambda server: formatting.tags(server.get('tagReferences')),
Expand Down
4 changes: 3 additions & 1 deletion SoftLayer/CLI/virt/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
column_helper.Column('action', lambda guest: formatting.active_txn(guest),
mask='activeTransaction[id,transactionStatus[name,friendlyName]]'),
column_helper.Column('power_state', ('powerState', 'name')),
column_helper.Column('created_by', ('billingItem', 'orderItem', 'order', 'userRecord', 'username')),
column_helper.Column('created_by', lambda created_by:
utils.lookup(created_by, 'billingItem', 'orderItem', 'order', 'userRecord', 'username'),
mask='billingItem[id,orderItem[id,order[id,userRecord[username]]]]'),
column_helper.Column('tags', lambda server: formatting.tags(server.get('tagReferences')),
mask="tagReferences.tag.name"),
column_helper.Column(
Expand Down

0 comments on commit 94a3c33

Please sign in to comment.