mirror of
https://github.com/gryf/boxpy.git
synced 2026-03-26 23:33:32 +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
|
||||
$ . .venv/bin/activate
|
||||
(.venv) $ pip install requirements.txt
|
||||
(.venv) $ pip install -r requirements.txt
|
||||
|
||||
then you can issue:
|
||||
|
||||
@@ -91,13 +91,15 @@ use it ad-hoc, or place on your ``.bashrc`` or whatever:
|
||||
|
||||
Currently, following commands are available:
|
||||
|
||||
- ``list`` - for quickly listing all/running VMs
|
||||
- ``info`` - to get summary about VM
|
||||
- ``destroy`` - that is probably obvious one
|
||||
- ``completion`` - as described above
|
||||
- ``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
|
||||
- ``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
|
||||
``--help`` option.
|
||||
|
||||
20
box.py
20
box.py
@@ -1445,6 +1445,13 @@ def vmrebuild(args):
|
||||
conf.disk_size = vbox.get_media_size(disk_path)
|
||||
|
||||
vmdestroy(args)
|
||||
|
||||
# Wait till VM is gone
|
||||
while True:
|
||||
vbox = VBoxManage(args.name)
|
||||
if not vbox.get_vm_info():
|
||||
break
|
||||
|
||||
vmcreate(args, conf)
|
||||
return 0
|
||||
|
||||
@@ -1470,11 +1477,14 @@ def connect(args):
|
||||
return 16
|
||||
|
||||
username = conf.username or DISTROS[conf.distro]["username"]
|
||||
return Run(['ssh', '-o', 'StrictHostKeyChecking=no',
|
||||
'-o', 'UserKnownHostsFile=/dev/null',
|
||||
'-i', conf.ssh_key_path[:-4],
|
||||
f'ssh://{username}'
|
||||
f'@localhost:{conf.port}'], False).returncode
|
||||
cmd = ['ssh', '-o', 'StrictHostKeyChecking=no',
|
||||
'-o', 'UserKnownHostsFile=/dev/null',
|
||||
'-i', conf.ssh_key_path[:-4],
|
||||
f'ssh://{username}'
|
||||
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):
|
||||
|
||||
Reference in New Issue
Block a user