Skip to content

Commit

Permalink
Merge pull request #1618 from edsonarios/issue1616-virtual-edit
Browse files Browse the repository at this point in the history
Improved successful response to command - slcli virtual edit
  • Loading branch information
allmightyspiff authored Apr 21, 2022
2 parents c03851f + d4aac0d commit 96ec44d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
13 changes: 9 additions & 4 deletions SoftLayer/CLI/virt/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,16 @@ def cli(env, identifier, domain, userfile, tag, hostname, userdata,

vsi = SoftLayer.VSManager(env.client)
vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS')
if not vsi.edit(vs_id, **data):
raise exceptions.CLIAbort("Failed to update virtual server")

if vsi.edit(vs_id, **data):
for key, value in data.items():
if value is not None:
env.fout("The {} of virtual server instance: {} was updated.".format(key, vs_id))

if public_speed is not None:
vsi.change_port_speed(vs_id, True, int(public_speed))
if vsi.change_port_speed(vs_id, True, int(public_speed)):
env.fout("The public speed of virtual server instance: {} was updated.".format(vs_id))

if private_speed is not None:
vsi.change_port_speed(vs_id, False, int(private_speed))
if vsi.change_port_speed(vs_id, False, int(private_speed)):
env.fout("The private speed of virtual server instance: {} was updated.".format(vs_id))
8 changes: 7 additions & 1 deletion tests/CLI/modules/vs/vs_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,13 @@ def test_edit(self):
'100'])

self.assert_no_fail(result)
self.assertEqual(result.output, '')
expected_output = '"The userdata of virtual server instance: 100 was updated."\n' \
+ '"The hostname of virtual server instance: 100 was updated."\n' \
+ '"The domain of virtual server instance: 100 was updated."\n' \
+ '"The tags of virtual server instance: 100 was updated."\n' \
+ '"The public speed of virtual server instance: 100 was updated."\n' \
+ '"The private speed of virtual server instance: 100 was updated."\n'
self.assertEqual(result.output, expected_output)

self.assert_called_with(
'SoftLayer_Virtual_Guest', 'editObject',
Expand Down

0 comments on commit 96ec44d

Please sign in to comment.