mirror of
https://github.com/gryf/boxpy.git
synced 2025-12-19 05:30:18 +01:00
Added option for forwarding ports.
This commit is contained in:
17
box.py
17
box.py
@@ -133,8 +133,8 @@ _boxpy() {
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
create|rebuild)
|
create|rebuild)
|
||||||
items=(--cpus --disk-size --distro --key --memory --hostname
|
items=(--cpus --disk-size --distro --forwarding --key --memory
|
||||||
--port --config --version)
|
--hostname --port --config --version)
|
||||||
if [[ ${prev} == ${cmd} ]]; then
|
if [[ ${prev} == ${cmd} ]]; then
|
||||||
if [[ ${cmd} = "rebuild" ]]; then
|
if [[ ${cmd} = "rebuild" ]]; then
|
||||||
_vms_comp vms
|
_vms_comp vms
|
||||||
@@ -332,8 +332,8 @@ class FakeLogger:
|
|||||||
|
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
ATTRS = ('cpus', 'config', 'creator', 'disk_size', 'distro', 'hostname',
|
ATTRS = ('cpus', 'config', 'creator', 'disk_size', 'distro', 'forwarding',
|
||||||
'key', 'memory', 'name', 'port', 'version')
|
'hostname', 'key', 'memory', 'name', 'port', 'version')
|
||||||
|
|
||||||
def __init__(self, args, vbox=None):
|
def __init__(self, args, vbox=None):
|
||||||
self.advanced = None
|
self.advanced = None
|
||||||
@@ -341,6 +341,7 @@ class Config:
|
|||||||
self.cpus = None
|
self.cpus = None
|
||||||
self.creator = None
|
self.creator = None
|
||||||
self.disk_size = None
|
self.disk_size = None
|
||||||
|
self.forwarding = {}
|
||||||
self.hostname = None
|
self.hostname = None
|
||||||
self.key = None
|
self.key = None
|
||||||
self.memory = None
|
self.memory = None
|
||||||
@@ -1247,6 +1248,10 @@ def main():
|
|||||||
help="Alternative user-data template filepath")
|
help="Alternative user-data template filepath")
|
||||||
create.add_argument('-d', '--distro', help="Image name. 'ubuntu' is "
|
create.add_argument('-d', '--distro', help="Image name. 'ubuntu' is "
|
||||||
"default")
|
"default")
|
||||||
|
create.add_argument('-f', '--forwarding', action='append', help="expose "
|
||||||
|
"port from VM to the host. It should be in format "
|
||||||
|
"'hostport:vmport'. this option can be used multiple "
|
||||||
|
"times for multiple ports.")
|
||||||
create.add_argument('-k', '--key', help="SSH key to be add to the config "
|
create.add_argument('-k', '--key', help="SSH key to be add to the config "
|
||||||
"drive. Default ~/.ssh/id_rsa")
|
"drive. Default ~/.ssh/id_rsa")
|
||||||
create.add_argument('-m', '--memory', help="amount of memory in "
|
create.add_argument('-m', '--memory', help="amount of memory in "
|
||||||
@@ -1281,6 +1286,10 @@ def main():
|
|||||||
rebuild.add_argument('-c', '--config',
|
rebuild.add_argument('-c', '--config',
|
||||||
help="Alternative user-data template filepath")
|
help="Alternative user-data template filepath")
|
||||||
rebuild.add_argument('-d', '--distro', help="Image name.")
|
rebuild.add_argument('-d', '--distro', help="Image name.")
|
||||||
|
rebuild.add_argument('-f', '--forwarding', action='append', help="expose "
|
||||||
|
"port from VM to the host. It should be in format "
|
||||||
|
"'hostport:vmport'. this option can be used multiple "
|
||||||
|
"times for multiple ports.")
|
||||||
rebuild.add_argument('-k', '--key',
|
rebuild.add_argument('-k', '--key',
|
||||||
help='SSH key to be add to the config drive')
|
help='SSH key to be add to the config drive')
|
||||||
rebuild.add_argument('-m', '--memory', help='amount of memory in '
|
rebuild.add_argument('-m', '--memory', help='amount of memory in '
|
||||||
|
|||||||
Reference in New Issue
Block a user