Proxmox-Encrypted-Remote-Backup icon indicating copy to clipboard operation
Proxmox-Encrypted-Remote-Backup copied to clipboard

Script stopped working due to changed phase name

Open mattjes04 opened this issue 2 years ago • 0 comments

Reference: https://forum.proxmox.com/threads/info-backup-exit-code-255-vzdump-mit-hook-script.107163/#post-460678

A new backup phase 'job-init' was added to pve-manager and causes the Encrypted-Remote-Backup to stop with an error due to the new unkown phase. It worked again after adding the new phase and changing the phase 'job-start' in ProxmoxEventHandler.py. DUMPDIR is not defined in phase 'job-init' except when --dumpdir is used directly

if self.args.phase == 'job-init':

            storeid = os.environ["STOREID"]

            self.jobinfo[self.args.phase].append(
                {
                    'storeid': storeid
                }
            )

            logging.debug("Environment Variables:" + str(self.jobinfo[self.args.phase]))

            if os.path.isfile(self.jobFilePath):
                logging.error("Existing job file found: " + self.jobFilePath)
                sys.exit(1)

            with open(self.jobFilePath, 'w') as outfile:
                logging.info("Creating new job file:" + self.jobFilePath)
                json.dump(self.jobinfo, outfile)

            return self.args.phase

        elif self.args.phase == 'job-start':

            dumpdir = os.environ["DUMPDIR"]
            storeid = os.environ["STOREID"]

            logging.debug("Environment Variables:" + str(self.jobinfo[self.args.phase]))

            if os.path.isfile(self.jobFilePath) is False:
                logging.error("Existing job file not found: " + self.jobFilePath)
                sys.exit(1)

            with open(self.jobFilePath) as json_file:
                logging.info("Parsing existing job file:" + self.jobFilePath)
                self.jobinfo = json.load(json_file)


            self.jobinfo[self.args.phase] = {
                    'dumpdir': dumpdir,
                    'storeid': storeid
                }


            logging.debug("Environment Variables:" + str(self.jobinfo[self.args.phase]))

            with open(self.jobFilePath, 'w') as outfile:
                logging.info("Updating existing job file:" + self.jobFilePath)
                json.dump(self.jobinfo, outfile)

            return self.args.phase

mattjes04 avatar Mar 27 '22 19:03 mattjes04