mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-13 02:30:30 +03:00
added box handling to vmtools
This commit is contained in:
parent
01b6473823
commit
5dbcd0e9bd
2 changed files with 60 additions and 23 deletions
|
|
@ -12,6 +12,7 @@ import hashlib
|
|||
import yaml
|
||||
import json
|
||||
import logging
|
||||
import textwrap
|
||||
from clint.textui import progress
|
||||
from optparse import OptionParser
|
||||
import fdroidserver.tail
|
||||
|
|
@ -525,12 +526,27 @@ def main():
|
|||
if os.path.exists(boxfile):
|
||||
os.remove(boxfile)
|
||||
|
||||
vm.package(output=boxfile, debug_keep_box_file=options.debug_keep_box_file)
|
||||
vagrantfile = textwrap.dedent("""\
|
||||
Vagrant.configure("2") do |config|
|
||||
config.ssh.username = "vagrant"
|
||||
config.ssh.password = "vagrant"
|
||||
|
||||
config.vm.provider :libvirt do |libvirt|
|
||||
|
||||
libvirt.driver = "kvm"
|
||||
libvirt.host = ""
|
||||
libvirt.connect_via_ssh = false
|
||||
libvirt.storage_pool_name = "default"
|
||||
|
||||
end
|
||||
end""")
|
||||
|
||||
vm.package(output=boxfile, vagrantfile=vagrantfile, keep_box_file=options.keep_box_file)
|
||||
|
||||
logger.info("Adding box")
|
||||
v.box_add('buildserver', boxfile, force=True)
|
||||
vm.box_add('buildserver', boxfile, force=True)
|
||||
|
||||
if not 'buildserver' in subprocess.check_output(['vagrant', 'box', 'list']).decode('utf-8'):
|
||||
if 'buildserver' not in subprocess.check_output(['vagrant', 'box', 'list']).decode('utf-8'):
|
||||
logger.critical('could not add box \'%s\' as \'buildserver\', terminating', boxfile)
|
||||
sys.exit(1)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue