Exemple #1
0
 def _install(self, package_):
     inst = install.Installer(_PACKAGE_PATH, _UNPACK_PATH, package_)
     if inst.install():
         # set install marker
         LOG.info("intall package [%s] done." % package_)
         util.package_set_status(package_, util.PackageStatus.INSTALLED)
         LOG.debug("restart service.")
         inst.restart()
     else:
         LOG.error("install package [%s] failed." % package_)
Exemple #2
0
 def _install(self, package_):
     inst = install.Installer(_PACKAGE_PATH, _UNPACK_PATH, package_)
     if inst.install():
         # set install marker
         LOG.info("intall package [%s] done." % package_)
         util.package_set_status(package_, util.PackageStatus.INSTALLED)
         LOG.debug("restart service.")
         inst.restart()
     else:
         LOG.error("install package [%s] failed." % package_)
Exemple #3
0
    def _after_download(self, package_):
        # delete old version, set done file
        local_packs = util.get_all_packages()
        if not local_packs:
            LOG.warn("find nothing in local paths after download.")
            return False

        if package_ not in local_packs:
            LOG.warn("not found new download package [%s] in local "
                     "store path, do nothing." % package_)
            return False

        pinfo = package.PackageInfo(package_)
        for l in local_packs:
            linfo = package.PackageInfo(l)
            if linfo.TYPE == pinfo.TYPE and package_ != l:
                # delete same type old package.
                util.delete_package(l)

        # set status to downloaded.
        return util.package_set_status(package_, util.PackageStatus.DOWNLOADED)
Exemple #4
0
    def _after_download(self, package_):
        # delete old version, set done file
        local_packs = util.get_all_packages()
        if not local_packs:
            LOG.warn("find nothing in local paths after download.")
            return False

        if package_ not in local_packs:
            LOG.warn("not found new download package [%s] in local "
                     "store path, do nothing." % package_)
            return False

        pinfo = package.PackageInfo(package_)
        for l in local_packs:
            linfo = package.PackageInfo(l)
            if linfo.TYPE == pinfo.TYPE and package_ != l:
                # delete same type old package.
                util.delete_package(l)

        # set status to downloaded.
        return util.package_set_status(package_, util.PackageStatus.DOWNLOADED)