Example #1
0
    def isShutdownRequested(self):
        try:
            shutdownRequested = System.getRegistryValue(
                System.HKEY_LOCAL_MACHINE, "SOFTWARE\\opsi.org\\winst",
                "ShutdownRequested")
        except Exception as err:  # pylint: disable=broad-except
            logger.info("Failed to get shutdownRequested from registry: %s",
                        err)
            shutdownRequested = 0

        logger.notice("Shutdown request in Registry: %s", shutdownRequested)
        return forceBool(shutdownRequested)
Example #2
0
    def isRebootRequested(self):
        try:
            rebootRequested = System.getRegistryValue(
                System.HKEY_LOCAL_MACHINE, "SOFTWARE\\opsi.org\\winst",
                "RebootRequested")
        except Exception as error:  # pylint: disable=broad-except
            logger.warning("Failed to get RebootRequested from registry: %s",
                           error)
            rebootRequested = 0

        logger.notice("Reboot request in Registry: %s", rebootRequested)
        if rebootRequested == 2:
            # Logout
            logger.info("Logout requested")
            self.clearRebootRequest()
            return False

        return forceBool(rebootRequested)