Skip to content

Commit 94a3c33

Browse files
Merge pull request #2161 from d3rnn/master
More efficient created_by
2 parents 2fd0c4d + 3adf56c commit 94a3c33

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

Diff for: SoftLayer/CLI/dedicatedhost/list_guests.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from SoftLayer.CLI import environment
99
from SoftLayer.CLI import formatting
1010
from SoftLayer.CLI import helpers
11+
from SoftLayer import utils
1112

1213
COLUMNS = [
1314
column_helper.Column('guid', ('globalIdentifier',)),
@@ -18,7 +19,8 @@
1819
column_helper.Column('backend_ip', ('primaryBackendIpAddress',)),
1920
column_helper.Column(
2021
'created_by',
21-
('billingItem', 'orderItem', 'order', 'userRecord', 'username')),
22+
lambda created_by: utils.lookup(created_by, 'billingItem', 'orderItem', 'order', 'userRecord', 'username'),
23+
mask='billingItem[id,orderItem[id,order[id,userRecord[username]]]]'),
2224
column_helper.Column('power_state', ('powerState', 'name')),
2325
column_helper.Column(
2426
'tags',

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from SoftLayer.CLI import environment
99
from SoftLayer.CLI import formatting
1010
from SoftLayer.CLI import helpers
11+
from SoftLayer import utils
1112

1213
# pylint: disable=unnecessary-lambda
1314

@@ -22,7 +23,8 @@
2223
mask='activeTransaction[id, transactionStatus[name, friendlyName]]'),
2324
column_helper.Column(
2425
'created_by',
25-
('billingItem', 'orderItem', 'order', 'userRecord', 'username')),
26+
lambda created_by: utils.lookup(created_by, 'billingItem', 'orderItem', 'order', 'userRecord', 'username'),
27+
mask='billingItem[id,orderItem[id,order[id,userRecord[username]]]]'),
2628
column_helper.Column(
2729
'tags',
2830
lambda server: formatting.tags(server.get('tagReferences')),

Diff for: SoftLayer/CLI/virt/list.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
column_helper.Column('action', lambda guest: formatting.active_txn(guest),
2222
mask='activeTransaction[id,transactionStatus[name,friendlyName]]'),
2323
column_helper.Column('power_state', ('powerState', 'name')),
24-
column_helper.Column('created_by', ('billingItem', 'orderItem', 'order', 'userRecord', 'username')),
24+
column_helper.Column('created_by', lambda created_by:
25+
utils.lookup(created_by, 'billingItem', 'orderItem', 'order', 'userRecord', 'username'),
26+
mask='billingItem[id,orderItem[id,order[id,userRecord[username]]]]'),
2527
column_helper.Column('tags', lambda server: formatting.tags(server.get('tagReferences')),
2628
mask="tagReferences.tag.name"),
2729
column_helper.Column(

0 commit comments

Comments
 (0)