mirror of
https://github.com/gryf/boxpy.git
synced 2026-03-27 08:03:31 +01:00
Compare commits
4 Commits
1.6
...
10543cb506
| Author | SHA1 | Date | |
|---|---|---|---|
| 10543cb506 | |||
| 1f1084f294 | |||
| f5ed3d37ac | |||
| 1483f49461 |
12
README.rst
12
README.rst
@@ -39,7 +39,7 @@ your operating system, or by using virtualenv for Python requirements, i.e.:
|
|||||||
|
|
||||||
$ python -m virtualenv .venv
|
$ python -m virtualenv .venv
|
||||||
$ . .venv/bin/activate
|
$ . .venv/bin/activate
|
||||||
(.venv) $ pip install requirements.txt
|
(.venv) $ pip install -r requirements.txt
|
||||||
|
|
||||||
then you can issue:
|
then you can issue:
|
||||||
|
|
||||||
@@ -91,13 +91,15 @@ use it ad-hoc, or place on your ``.bashrc`` or whatever:
|
|||||||
|
|
||||||
Currently, following commands are available:
|
Currently, following commands are available:
|
||||||
|
|
||||||
- ``list`` - for quickly listing all/running VMs
|
- ``completion`` - as described above
|
||||||
- ``info`` - to get summary about VM
|
|
||||||
- ``destroy`` - that is probably obvious one
|
|
||||||
- ``create`` - create new VM
|
- ``create`` - create new VM
|
||||||
|
- ``destroy`` - that is probably obvious one
|
||||||
|
- ``info`` - to get summary about VM
|
||||||
|
- ``list`` - for quickly listing all/running VMs
|
||||||
- ``rebuild`` - recreate specified VM
|
- ``rebuild`` - recreate specified VM
|
||||||
- ``ssh`` - connect to the VM using ssh
|
- ``ssh`` - connect to the VM using ssh
|
||||||
- ``completion`` - as described above
|
- ``start`` - stop the running VM
|
||||||
|
- ``stop`` - start stopped VM
|
||||||
|
|
||||||
All of the commands have a range of options, and can be examined by using
|
All of the commands have a range of options, and can be examined by using
|
||||||
``--help`` option.
|
``--help`` option.
|
||||||
|
|||||||
20
box.py
20
box.py
@@ -1445,6 +1445,13 @@ def vmrebuild(args):
|
|||||||
conf.disk_size = vbox.get_media_size(disk_path)
|
conf.disk_size = vbox.get_media_size(disk_path)
|
||||||
|
|
||||||
vmdestroy(args)
|
vmdestroy(args)
|
||||||
|
|
||||||
|
# Wait till VM is gone
|
||||||
|
while True:
|
||||||
|
vbox = VBoxManage(args.name)
|
||||||
|
if not vbox.get_vm_info():
|
||||||
|
break
|
||||||
|
|
||||||
vmcreate(args, conf)
|
vmcreate(args, conf)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -1470,11 +1477,14 @@ def connect(args):
|
|||||||
return 16
|
return 16
|
||||||
|
|
||||||
username = conf.username or DISTROS[conf.distro]["username"]
|
username = conf.username or DISTROS[conf.distro]["username"]
|
||||||
return Run(['ssh', '-o', 'StrictHostKeyChecking=no',
|
cmd = ['ssh', '-o', 'StrictHostKeyChecking=no',
|
||||||
'-o', 'UserKnownHostsFile=/dev/null',
|
'-o', 'UserKnownHostsFile=/dev/null',
|
||||||
'-i', conf.ssh_key_path[:-4],
|
'-i', conf.ssh_key_path[:-4],
|
||||||
f'ssh://{username}'
|
f'ssh://{username}'
|
||||||
f'@localhost:{conf.port}'], False).returncode
|
f'@localhost:{conf.port}']
|
||||||
|
LOG.debug('Connecting to vm `%s` using command:\n%s', args.name,
|
||||||
|
' '.join(cmd))
|
||||||
|
return Run(cmd, False).returncode
|
||||||
|
|
||||||
|
|
||||||
def _set_vmstate(name, state):
|
def _set_vmstate(name, state):
|
||||||
|
|||||||
Reference in New Issue
Block a user