def install_manifest(ns, manifest): log.info("Installing files from manifest") for target_item in manifest: target = target_item.get("target") if target is None: raise Exception( "Target must be specified in manifest configuration") target = re.sub('^/', '', target) owner = target_item.get("owner", "root") group = target_item.get("group", "root") mode = target_item.get("mode", 0644) ftype = target_item.get("type", "file") if ftype == "file": source = target_item.get("source") if source is None: raise Exception( "source must be specified in manifest configuration") log.info("Installing {0} to /{1}".format(source, target)) copy_file(ns, source, target, owner=owner, group=group, mode=mode) elif ftype == "directory": log.info("Creating directory /{0}".format(target)) create_directory(ns, target, owner=owner, group=group, mode=mode) else: raise Exception("Uknown manifest type: {0} ({1})".format( ftype, target))
def install_manifest(ns, manifest): log.info("Installing files from manifest") for target_item in manifest: target = target_item.get("target") if target is None: raise Exception("Target must be specified in manifest configuration") target = re.sub("^/", "", target) owner = target_item.get("owner", "root") group = target_item.get("group", "root") mode = target_item.get("mode", 0644) ftype = target_item.get("type", "file") if ftype == "file": source = target_item.get("source") if source is None: raise Exception("source must be specified in manifest configuration") log.info("Installing {0} to /{1}".format(source, target)) copy_file(ns, source, target, owner=owner, group=group, mode=mode) elif ftype == "directory": log.info("Creating directory /{0}".format(target)) create_directory(ns, target, owner=owner, group=group, mode=mode) else: raise Exception("Uknown manifest type: {0} ({1})".format(ftype, target))
def insert_apt_preferences(ns, mountpoint, preferences): for preference in preferences: preference_path = os.path.join(ns.root, "preferences", preference) if not os.path.isfile(preference_path): raise Exception("No such preference: {0}".format(preference_path)) log.info("Inserting apt preference: {0}".format(preference_path)) copy_file(ns, preference_path, "etc/apt/preferences.d/{0}".format(preference))
def install_manifest(ns, manifest): log.info("Installing files from manifest") for target, opts in manifest.items(): source = opts.get("source") if source is None: raise Exception( "source must be specified in manifest configuration") owner = opts.get("owner", "root") group = opts.get("group", "root") mode = opts.get("mode", 0644) log.info("Installing {0} to {1}".format(source, target)) copy_file(ns, source, target, owner=owner, group=group, mode=mode)