Skip to content
This repository was archived by the owner on Jul 8, 2020. It is now read-only.

Commit c542045

Browse files
committed
make bridge interface a configuration setting
1 parent 7b0dd95 commit c542045

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

bin/create-host.sh

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#!/bin/sh -e
22

33
NAME="${1}"
4-
INTERFACE="${2}"
54

6-
if [ "${NAME}" = "" ] || [ "${INTERFACE}" = "" ]; then
7-
echo "Usage: ${0} NAME INTERFACE"
5+
if [ "${NAME}" = "" ]; then
6+
echo "Usage: ${0} NAME"
87

98
exit 1
109
fi
1110

12-
vbt host create --name "${NAME}" --bridge-interface "${INTERFACE}"
11+
vbt host create --name "${NAME}"
1312
sleep 5
1413
vbt host start --name "${NAME}"
1514
sleep 60

virtual-box-tools.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
token: example
33
sudo_user: virtualbox
44
listen_address: 0.0.0.0
5+
bridge_interface: eth0

virtual_box_tools/virtual_box_tools.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def __init__(self, arguments: list) -> None:
6565
self.parsed_arguments = self.parser.parse_args(arguments)
6666
config = YamlConfig('~/.virtual-box-tools.yaml')
6767
self.sudo_user = config.get('sudo_user')
68+
self.bridge_interface = config.get('bridge_interface')
6869

6970
@staticmethod
7071
def main() -> int:
@@ -160,7 +161,10 @@ def add_host_parser(self, subparsers) -> None:
160161

161162
create_parent = CustomArgumentParser(add_help=False)
162163
create_parent.add_argument('--name', required=True)
163-
create_parent.add_argument('--bridge-interface', required=True)
164+
create_parent.add_argument(
165+
'--bridge-interface',
166+
default=self.bridge_interface,
167+
)
164168
create_parent.add_argument(
165169
'--cores',
166170
default=VirtualBoxTools.DEFAULT_CORES,

0 commit comments

Comments
 (0)