Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script stopped working due to changed phase name #8

Open
mattjes04 opened this issue Mar 27, 2022 · 0 comments
Open

Script stopped working due to changed phase name #8

mattjes04 opened this issue Mar 27, 2022 · 0 comments

Comments

@mattjes04
Copy link

mattjes04 commented Mar 27, 2022

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant