diff --git a/octane/commands/install_node.py b/octane/commands/install_node.py index 82561708..38d4101d 100644 --- a/octane/commands/install_node.py +++ b/octane/commands/install_node.py @@ -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 diff --git a/octane/tests/test_install_node.py b/octane/tests/test_install_node.py index 0664917f..f34c4389 100644 --- a/octane/tests/test_install_node.py +++ b/octane/tests/test_install_node.py @@ -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'}])),