From 576ab309a287ea7a3ff7e51163d884e8435aa8cb Mon Sep 17 00:00:00 2001 From: d3rn <84808889+d3rnn@users.noreply.github.com> Date: Wed, 3 Jul 2024 13:55:11 -0500 Subject: [PATCH 1/5] Update list.py --- SoftLayer/CLI/virt/list.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SoftLayer/CLI/virt/list.py b/SoftLayer/CLI/virt/list.py index b16d5602f..b350f75bc 100644 --- a/SoftLayer/CLI/virt/list.py +++ b/SoftLayer/CLI/virt/list.py @@ -21,7 +21,8 @@ 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( From c1789ff0fc84dc8c2f653ad86b75359fbefd0f3e Mon Sep 17 00:00:00 2001 From: d3rn <84808889+d3rnn@users.noreply.github.com> Date: Wed, 3 Jul 2024 13:55:47 -0500 Subject: [PATCH 2/5] Update list.py --- SoftLayer/CLI/hardware/list.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SoftLayer/CLI/hardware/list.py b/SoftLayer/CLI/hardware/list.py index 42b298155..0dae57a11 100644 --- a/SoftLayer/CLI/hardware/list.py +++ b/SoftLayer/CLI/hardware/list.py @@ -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 @@ -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')), From 6581ed122b7e40cd0f2f13de41583e3700632833 Mon Sep 17 00:00:00 2001 From: d3rn <84808889+d3rnn@users.noreply.github.com> Date: Wed, 3 Jul 2024 13:56:15 -0500 Subject: [PATCH 3/5] Update list_guests.py --- SoftLayer/CLI/dedicatedhost/list_guests.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SoftLayer/CLI/dedicatedhost/list_guests.py b/SoftLayer/CLI/dedicatedhost/list_guests.py index 6d263941d..bf00a236c 100644 --- a/SoftLayer/CLI/dedicatedhost/list_guests.py +++ b/SoftLayer/CLI/dedicatedhost/list_guests.py @@ -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',)), @@ -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', From 5c411a61e4b0d6ffda39651a86003e131a55f6db Mon Sep 17 00:00:00 2001 From: d3rnn <84808889+d3rnn@users.noreply.github.com> Date: Wed, 3 Jul 2024 19:24:30 +0000 Subject: [PATCH 4/5] fix E131 and E501 --- SoftLayer/CLI/dedicatedhost/list_guests.py | 4 ++-- SoftLayer/CLI/hardware/list.py | 4 ++-- SoftLayer/CLI/virt/list.py | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/SoftLayer/CLI/dedicatedhost/list_guests.py b/SoftLayer/CLI/dedicatedhost/list_guests.py index bf00a236c..5d8f2c3bc 100644 --- a/SoftLayer/CLI/dedicatedhost/list_guests.py +++ b/SoftLayer/CLI/dedicatedhost/list_guests.py @@ -19,8 +19,8 @@ column_helper.Column('backend_ip', ('primaryBackendIpAddress',)), 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]]]]'), + 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', diff --git a/SoftLayer/CLI/hardware/list.py b/SoftLayer/CLI/hardware/list.py index 0dae57a11..734f379d4 100644 --- a/SoftLayer/CLI/hardware/list.py +++ b/SoftLayer/CLI/hardware/list.py @@ -23,8 +23,8 @@ mask='activeTransaction[id, transactionStatus[name, friendlyName]]'), 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]]]]'), + 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')), diff --git a/SoftLayer/CLI/virt/list.py b/SoftLayer/CLI/virt/list.py index b350f75bc..b491c471e 100644 --- a/SoftLayer/CLI/virt/list.py +++ b/SoftLayer/CLI/virt/list.py @@ -21,7 +21,8 @@ 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', lambda created_by: utils.lookup(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"), From 3adf56cdee1194f22736db3057d7a99e17d8d900 Mon Sep 17 00:00:00 2001 From: d3rnn <84808889+d3rnn@users.noreply.github.com> Date: Wed, 3 Jul 2024 19:30:23 +0000 Subject: [PATCH 5/5] fix W291 and E501 --- SoftLayer/CLI/virt/list.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SoftLayer/CLI/virt/list.py b/SoftLayer/CLI/virt/list.py index b491c471e..d30b4ff6a 100644 --- a/SoftLayer/CLI/virt/list.py +++ b/SoftLayer/CLI/virt/list.py @@ -21,8 +21,8 @@ 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', - lambda created_by: utils.lookup(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"),