From: garciadeblas Date: Tue, 12 Mar 2024 15:59:46 +0000 (+0100) Subject: Fix bug 2176 to update properly VCA without modifying the name X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2Fosmclient.git;a=commitdiff_plain;h=16cfdeb081fd412099175c67e68d6345bc2abbc6 Fix bug 2176 to update properly VCA without modifying the name Change-Id: I4e7a571e7da73790f981f1262bdcfd4ba89510e4 Signed-off-by: garciadeblas --- diff --git a/osmclient/cli_commands/vca.py b/osmclient/cli_commands/vca.py index f60f98f..fc33962 100755 --- a/osmclient/cli_commands/vca.py +++ b/osmclient/cli_commands/vca.py @@ -133,6 +133,7 @@ def load_file(file_path: str) -> Dict: @click.option( "--endpoints", help="Comma-separated list of IP or hostnames of the Juju controller" ) +@click.option("--newname", help="New name for the VCA") @click.option("--user", help="Username with admin priviledges") @click.option("--secret", help="Password of the specified username") @click.option("--cacert", help="CA certificate") @@ -161,6 +162,7 @@ def load_file(file_path: str) -> Dict: def vca_update( ctx, name, + newname, endpoints, user, secret, @@ -179,7 +181,8 @@ def vca_update( logger.debug("") utils.check_client_version(ctx.obj, ctx.command.name) vca = {} - vca["name"] = name + if newname: + vca["name"] = newname if endpoints: vca["endpoints"] = endpoints.split(",") if user: diff --git a/osmclient/scripts/tests/tests_vca.py b/osmclient/scripts/tests/tests_vca.py index f1ebb5f..7bfc1c8 100644 --- a/osmclient/scripts/tests/tests_vca.py +++ b/osmclient/scripts/tests/tests_vca.py @@ -172,7 +172,7 @@ class TestVca(unittest.TestCase): args=["name"], ) mock_check_client_version.assert_called() - self.ctx_obj.vca.update.assert_called_with("name", {"name": "name"}) + self.ctx_obj.vca.update.assert_called_with("name", {}) mock_pretty_table.assert_not_called() self.table.add_row.assert_not_called() mock_print.assert_not_called() @@ -191,6 +191,8 @@ class TestVca(unittest.TestCase): obj=self.ctx_obj, args=[ "name", + "--newname", + "newname", "--endpoints", "1.2.3.4:17070", "--user", @@ -217,7 +219,7 @@ class TestVca(unittest.TestCase): self.ctx_obj.vca.update.assert_called_with( "name", { - "name": "name", + "name": "newname", "endpoints": ["1.2.3.4:17070"], "user": "user", "secret": "secret",