raise RuntimeException("Execution of %s failed: %s" % (cmd, str(err)))
return ret_code
+
+def set_permissions(tpath, modes=(0644, 0755)):
+ """
+ Recursively set permission bits for files and directories.
+ Parameters:
+ tpath: top directory path
+ modes: sequence of two modes: (mode_for_files, mode_for_directories)
+ """
+ for root, dirs, files in os.walk(tpath):
+ for fname in files + dirs:
+ path = os.path.join(root, fname)
+ os.chmod(path, os.stat(path).st_mode | modes[fname in dirs])
import subprocess
from common.buildtrigger import trigger_info, trigger_next
-from common.utils import sync
+from common.utils import sync, set_permissions
def get_xml(image_dir, ks_name):
""" Get the xml the image, return the body as string """
print 'starting mic inside VM to create image'
ret = run_inside_vm(vm_image, os.getenv("VM_MEMORY", 8192),
os.getenv("VM_CPUS", 8), basedir)
+ # workaround for qemu/9p bug in mapping permissions
+ set_permissions(outdir, (0644, 0755))
else:
log = os.path.join(outdir, '%s_%s.log.txt' % (build_id, name))
cache = os.path.join(basedir, 'cache')