Fix install-node to work without --networks specified

Change-Id: I8c5b3dc3884b2982dccf423fd5e4feb67242754b
This commit is contained in:
Yuriy Taraday 2015-09-10 12:02:49 +03:00
parent 32b41b158d
commit 42f3da10cf
2 changed files with 9 additions and 1 deletions

View File

@ -142,7 +142,7 @@ class InstallNodeCommand(cmd.Command):
'node_ids', type=int, metavar='NODE_ID', nargs='+',
help="IDs of nodes to be moved")
parser.add_argument(
'--networks', type=str, nargs='+',
'--networks', type=str, nargs='+', default=[],
help="Names of networks which IPs should be copied")
return parser

View File

@ -26,6 +26,14 @@ def test_parser(mocker, octane_app):
networks=["public", "management"])
def test_parser_no_networks(mocker, octane_app):
m = mocker.patch('octane.commands.install_node.install_node')
octane_app.run(["install-node", "--isolated", "1", "2", "3", "4"])
assert not octane_app.stdout.getvalue()
assert not octane_app.stderr.getvalue()
m.assert_called_once_with(1, 2, [3, 4], isolated=True, networks=[])
@pytest.mark.parametrize("fail,side_effect", [
(False, ([{'name': 'public'}, {'name': 'management'}],
[{'name': 'public'}, {'name': 'management'}])),