Exemple #1
0
    def set_kindo_setting(self, key, value):
        ini_path = os.path.join(self.kindo_settings_path, "kindo.ini")
        if not os.path.isdir(self.kindo_settings_path):
            os.makedirs(self.kindo_settings_path)

        cf = ConfigParser(ini_path)
        cf.set("default", key, value)
        cf.write(ini_path)
Exemple #2
0
    def add_image_info(self, image_info, path):
        if not path:
            return False

        ini_path = os.path.join(self.kindo_settings_path, "images.ini")
        if not os.path.isdir(self.kindo_settings_path):
            os.makedirs(self.kindo_settings_path)

        cf = ConfigParser(ini_path)
        cf.set(image_info["name"], "name", image_info["name"])
        cf.set(image_info["name"], "version", image_info["version"])
        cf.set(image_info["name"], "buildtime", image_info["buildtime"])
        cf.set(image_info["name"], "pusher", image_info["pusher"])
        cf.set(image_info["name"], "size", image_info["size"])
        cf.set(image_info["name"], "url", image_info["url"])
        cf.set(image_info["name"], "path", path)
        cf.write()

        return True
Exemple #3
0
    def add_image_info(self, image_info, path):
        if not path:
            return False

        ini_path = os.path.join(self.kindo_settings_path, "images.ini")
        if not os.path.isdir(self.kindo_settings_path):
            os.makedirs(self.kindo_settings_path)

        cf = ConfigParser(ini_path)
        section = "%s/%s:%s" % (image_info["author"], image_info["name"], image_info["version"])
        cf.set(section, "name", image_info["name"])
        cf.set(section, "author", image_info["author"])
        cf.set(section, "version", image_info["version"])
        cf.set(section, "buildtime", image_info.get("build_time", image_info.get("buildtime", "")))
        cf.set(section, "pusher", image_info.get("pusher", ""))
        cf.set(section, "size", os.path.getsize(path))
        cf.set(section, "url", "")
        cf.set(section, "path", path)
        cf.write()

        return True