2010-09-27 16:58:02 +02:00
|
|
|
#!/usr/bin/python2.6
|
|
|
|
from qubes.qubes import QubesVmCollection
|
|
|
|
import sys
|
|
|
|
def main():
|
|
|
|
if len(sys.argv) != 2:
|
|
|
|
print 'Usage: fixconf templatename'
|
|
|
|
sys.exit(1)
|
|
|
|
qvm_collection = QubesVmCollection()
|
|
|
|
qvm_collection.lock_db_for_reading()
|
|
|
|
qvm_collection.load()
|
|
|
|
qvm_collection.unlock_db()
|
|
|
|
templ = sys.argv[1]
|
|
|
|
tvm = qvm_collection.get_vm_by_name(templ)
|
|
|
|
if tvm is None:
|
|
|
|
print 'Template', templ, 'does not exist'
|
|
|
|
sys.exit(1)
|
2011-03-05 15:13:31 +01:00
|
|
|
if not tvm.is_template():
|
2010-09-27 16:58:02 +02:00
|
|
|
print templ, 'is not a template'
|
|
|
|
sys.exit(1)
|
|
|
|
for vm in qvm_collection.values():
|
2012-03-09 11:01:20 +01:00
|
|
|
if vm.template is not None and vm.template.qid == tvm.qid:
|
2010-09-27 16:58:02 +02:00
|
|
|
vm.create_config_file()
|
|
|
|
|
|
|
|
main()
|