def onlinecheck(self): self.logger.info("Online check") if self._active_side == "left": depot = self._ui_box_left.currentText().split()[0] else: depot = self._ui_box_right.currentText().split()[0] msg = "\n\n" + translate("depotmanagerController", "Selected depot:") + "\n" + depot self.logger.debug("Selected depot: " + depot) ret = Helper.test_port(depot, ConfigHandler.cfg.sshport, 0.5) print(ret) if ret is True: self._parent.msgbox(translate("depotmanagerController", "The selected depot is ONLINE.") + msg, oPB.MsgEnum.MS_ALWAYS, parent=self.ui) else: msg += "\n\n" + str(ret) self._parent.msgbox(translate("depotmanagerController", "The selected depot is OFFLINE.") + msg, oPB.MsgEnum.MS_ALWAYS, parent=self.ui)
def check_online_status(self): # check if server is generally available # use SSH port for connection test ret = Helper.test_port(confighandler.ConfigHandler.cfg.opsi_server, confighandler.ConfigHandler.cfg.sshport, 0.5) if type(ret) != tuple: # check network access and mount network drive if on linux if sys.platform == 'win32': self.logger.info("System platform: "+ sys.platform) if confighandler.ConfigHandler.cfg.usenetdrive == "False": drives = Helper.get_available_drive_letters() if not drives: self.logger.error("No free drive letter found") else: self.logger.info("Free drive letter found: " + repr(drives)) self.logger.info("Using drive letter: " + drives[::-1][0]) path = "\\\\" + confighandler.ConfigHandler.cfg.opsi_server + "\\" + "opsi_workbench" self.logger.info("Trying to mount path: " + path) ret = MapDrive.mapDrive(drives[::-1][0] + ":", path, confighandler.ConfigHandler.cfg.opsi_user, confighandler.ConfigHandler.cfg.opsi_pass) if ret[0] != 0: self.logger.error("Error mounting path: " + str(ret)) else: self.logger.info("Network drive successfully mounted") oPB.NETDRV = drives[::-1][0] + ":" else: self.logger.info("System platform: "+ sys.platform) self.logger.warning("This is not a windows based system. No network drive will be associated") self.logger.warning("Please take care, if the specified development base path is correct.") else: self.logger.warning("opsi server not available. Offline mode activated.") self.logger.warning("Return value from connection test: " + str(ret)) oPB.NETMODE = "offline"
def onlinecheck(self): self.logger.info("Online check") if self._active_side == "left": depot = self._ui_box_left.currentText().split()[0] else: depot = self._ui_box_right.currentText().split()[0] msg = "\n\n" + translate("depotmanagerController", "Selected depot:") + "\n" + depot self.logger.debug("Selected depot: " + depot) ret = Helper.test_port(depot, ConfigHandler.cfg.sshport, 0.5) print(ret) if ret is True: self._parent.msgbox(translate("depotmanagerController", "The selected depot is ONLINE.") + msg, oPB.MsgEnum.MS_ALWAYS, parent = self.ui) else: msg += "\n\n" + str(ret) self._parent.msgbox(translate("depotmanagerController", "The selected depot is OFFLINE.") + msg, oPB.MsgEnum.MS_ALWAYS, parent = self.ui)
def check_online_status(self): self.logger.debug("Check online status") # check if server is generally available # use SSH port for connection test ret = Helper.test_port(confighandler.ConfigHandler.cfg.opsi_server, confighandler.ConfigHandler.cfg.sshport, 0.5) if ret is True: # check network access and mount network drive if on linux if sys.platform == 'win32': self.logger.info("System platform: "+ sys.platform) if self.args.nonetdrive is False: if confighandler.ConfigHandler.cfg.usenetdrive == "False": drives = Helper.get_available_drive_letters() if not drives: self.logger.error("No free drive letter found") else: self.logger.info("Free drive letter found: " + repr(drives)) self.logger.info("Using drive letter: " + drives[::-1][0]) path = "\\\\" + confighandler.ConfigHandler.cfg.opsi_server + "\\" + "opsi_workbench" self.logger.info("Trying to mount path: " + path) ret = MapDrive.mapDrive(drives[::-1][0] + ":", path, confighandler.ConfigHandler.cfg.opsi_user, confighandler.ConfigHandler.cfg.opsi_pass) if ret[0] != 0: self.logger.error("Error mounting path: " + str(ret)) else: self.logger.info("Network drive successfully mounted") oPB.NETDRV = drives[::-1][0] + ":" else: self.logger.info("Using existing network drive") else: self.logger.info("Mounting of network drive via command line disabled") else: self.logger.info("System platform: "+ sys.platform) self.logger.warning("This is not a windows based system. No network drive will be associated") self.logger.warning("Please take care, that the specified development base path is correct.") else: self.logger.warning("opsi server not available. Offline mode activated.") self.logger.warning("Return value from connection test: " + str(ret)) oPB.NETMODE = "offline"