From abe6ba9759dc6335435e712750b1b9e34624e208 Mon Sep 17 00:00:00 2001 From: "Dr. Jens Harbott" Date: Mon, 7 Nov 2022 07:44:08 +0100 Subject: [PATCH] Add username to detailed node list output With the static driver it is possible to have multiple static nodes defined that only differ by their username. In order to be able to distinguish them, include the username in the output of the "nodepool list --detail" output. Signed-off-by: Dr. Jens Harbott Change-Id: I702ccbf412731ef3400eb722386629356a244334 --- nodepool/cmd/nodepoolcmd.py | 2 +- nodepool/status.py | 2 ++ nodepool/tests/unit/test_commands.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/nodepool/cmd/nodepoolcmd.py b/nodepool/cmd/nodepoolcmd.py index 65e3f4257..28ebe47da 100644 --- a/nodepool/cmd/nodepoolcmd.py +++ b/nodepool/cmd/nodepoolcmd.py @@ -198,7 +198,7 @@ class NodePoolCmd(NodepoolApp): 'public_ipv4', 'ipv6', 'state', 'age', 'locked'] if detail: fields.extend(['pool', 'hostname', 'private_ipv4', 'AZ', - 'connection_port', 'launcher', + 'username', 'connection_port', 'launcher', 'allocated_to', 'hold_job', 'comment', 'user_data', 'driver_data']) results = status.node_list(self.zk, node_id) diff --git a/nodepool/status.py b/nodepool/status.py index 18828d5b7..46dbbfe6f 100644 --- a/nodepool/status.py +++ b/nodepool/status.py @@ -123,6 +123,7 @@ def node_list(zk, node_id=None): ("hostname", "Hostname"), ("private_ipv4", "Private IPv4"), ("AZ", "AZ"), + ("username", "Username"), ("connection_port", "Port"), ("launcher", "Launcher"), ("allocated_to", "Allocated To"), @@ -155,6 +156,7 @@ def node_list(zk, node_id=None): node.hostname, node.private_ipv4, node.az, + node.username, node.connection_port, node.launcher, node.allocated_to, diff --git a/nodepool/tests/unit/test_commands.py b/nodepool/tests/unit/test_commands.py index d6252f57b..e035c0c45 100644 --- a/nodepool/tests/unit/test_commands.py +++ b/nodepool/tests/unit/test_commands.py @@ -77,7 +77,7 @@ class TestNodepoolCMD(tests.DBTestCase): col_count = 9 if detail: cmd += ['--detail'] - col_count = 20 + col_count = 21 if not validate_col_count: col_count = 0 self.assert_listed(configfile, cmd, 6, status, node_cnt, col_count)