def action(self): self.ncs.screen.setColor("BUTTON", "black", "red") self.ncs.screen.setColor("ACTBUTTON", "blue", "white") if self.root_password_1.value() != "" and self.root_password_2.value( ) != "" and self.root_password_1.value() == self.root_password_2.value( ): set_password(self.root_password_1.value(), "root") augtool("set", "/files/etc/ssh/sshd_config/PasswordAuthentication", "yes") dn = file('/dev/null', 'w+') subprocess.Popen(['/sbin/service', 'sshd', 'restart'], stdout=dn, stderr=dn) if len(self.rhevm_server.value()) > 0: deployUtil.nodeCleanup() if self.verify_rhevm_cert.selected(): if deployUtil.getRhevmCert(self.rhevm_server.value(), self.rhevm_server_port.value()): path, dontCare = deployUtil.certPaths('') fp = deployUtil.generateFingerPrint(path) approval = ButtonChoiceWindow( self.ncs.screen, "Certificate Fingerprint:", fp, buttons=['Approve', 'Reject']) if 'reject' == approval: ButtonChoiceWindow(self.ncs.screen, "Fingerprint rejected", "RHEV-M Configuration Failed", buttons=['Ok']) return False else: ovirt_store_config(path) self.ncs.reset_screen_colors() else: ButtonChoiceWindow(self.ncs.screen, "RHEV-M Configuration", "Failed downloading RHEV-M certificate", buttons=['Ok']) self.ncs.reset_screen_colors() # Stopping vdsm-reg may fail but its ok - its in the case when the menus are run after installation deployUtil._logExec([constants.EXT_SERVICE, 'vdsm-reg', 'stop']) if write_vdsm_config(self.rhevm_server.value(), self.rhevm_server_port.value()): deployUtil._logExec( [constants.EXT_SERVICE, 'vdsm-reg', 'start']) ButtonChoiceWindow(self.ncs.screen, "RHEV-M Configuration", "RHEV-M Configuration Successfully Updated", buttons=['Ok']) self.ncs.reset_screen_colors() return True else: ButtonChoiceWindow(self.ncs.screen, "RHEV-M Configuration", "RHEV-M Configuration Failed", buttons=['Ok']) self.ncs.reset_screen_colors() return False
def imvp_apply(self, obj): from ocsetup.ocsetup import ocs log("enter imvp apply %s") imvp_server_address = ocs.imvp_server_addr_val_Entry.get_text() imvp_server_port = ocs.imvp_serve_port_val_Entry.get_text() compatPort, sslPort = compatiblePort(imvp_server_port) if len(imvp_server_address) > 0: deployUtil.nodeCleanup() if not isHostReachable(host=imvp_server_address, port=imvp_server_port, ssl=sslPort, timeout=TIMEOUT_FIND_HOST_SEC): if compatPort is None: # Try one more time with SSL=False if not isHostReachable(host=imvp_server_address, port=imvp_server_port, ssl=False, timeout=TIMEOUT_FIND_HOST_SEC): msgConn = "Can't connect to oVirt Engine in the specific" \ " port %s" % enginePort resp_id = ConfirmDialog(message=msgConn).run_and_close() return False else: msgConn = "Can't connect to oVirt Engine port %s," \ " trying compatible port %s" % \ (enginePort, compatPort) resp_id = ConfirmDialog(message=msgConn).run_and_close() if not isHostReachable(host=imvp_server_address, port=compatPort, ssl=sslPort, timeout=TIMEOUT_FIND_HOST_SEC): msgConn = "Can't connect to oVirt Engine using" \ " compatible port %s" % compatPort resp_id = ConfirmDialog(message=msgConn).run_and_close() return False else: # compatible port found enginePort = compatPort if True: if deployUtil.getRhevmCert(imvp_server_address, enginePort): path, dontCare = deployUtil.certPaths('') fp = deployUtil.generateFingerPrint(path) ovirt_store_config(path) else: msgConn = "Failed downloading IMVP certificate" resp_id = ConfirmDialog(message=msgConn).run_and_close() # Stopping vdsm-reg may fail but its ok - its in the case when the menus are run after installation deployUtil._logExec([constants.EXT_SERVICE, 'vdsm-reg', 'stop']) if write_vdsm_config(imvp_server_address, enginePort): deployUtil._logExec([constants.EXT_SERVICE, 'vdsm-reg', 'start']) msgConn = "@ENGINENAME@ Configuration Successfully Updated" resp_id = ConfirmDialog(message=msgConn).run_and_close() retWriteConf = True else: msgConn = "@ENGINENAME@ Configuration Failed" resp_id = ConfirmDialog(message=msgConn).run_and_close() retWriteConf = False return retWriteConf
def retrieveCetrificate(engineServer, enginePort): """Function to retrieve and store the certificate from an Engine """ fingerprint = None # pylint: disable-msg=E0611,F0401 sys.path.append('/usr/share/vdsm-reg') import deployUtil # @UnresolvedImport # pylint: enable-msg=E0611,F0401 if deployUtil.getRhevmCert(engineServer, enginePort): _, _, path = deployUtil.certPaths('') fingerprint = deployUtil.generateFingerPrint(path) else: msgCert = "Failed downloading @ENGINENAME@ certificate" raise RuntimeError(msgCert) return path, fingerprint
def retrieveCetrificate(engineServer, enginePort): """Function to retrieve and store the certificate from an Engine """ fingerprint = None # pylint: disable-msg=E0611,F0401 sys.path.append('/usr/share/vdsm-reg') import deployUtil # @UnresolvedImport # pylint: enable-msg=E0611,F0401 if deployUtil.getRhevmCert(engineServer, enginePort): _, _, path = deployUtil.certPaths('') fingerprint = deployUtil.generateFingerPrint(path) else: msgCert = "Failed downloading " \ "{engine_name} certificate".format( engine_name=config.engine_name) raise RuntimeError(msgCert) return path, fingerprint
def action(self): self.ncs.screen.setColor("BUTTON", "black", "red") self.ncs.screen.setColor("ACTBUTTON", "blue", "white") if self.root_password_1.value() != "" and self.root_password_2.value() != "" and self.root_password_1.value() == self.root_password_2.value(): set_password(self.root_password_1.value(), "root") augtool("set", "/files/etc/ssh/sshd_config/PasswordAuthentication", "yes") dn = file('/dev/null', 'w+') subprocess.Popen(['/sbin/service', 'sshd', 'restart'], stdout=dn, stderr=dn) if len(self.rhevm_server.value()) > 0: deployUtil.nodeCleanup() if self.verify_rhevm_cert.selected(): if deployUtil.getRhevmCert(self.rhevm_server.value(), self.rhevm_server_port.value()): path, dontCare = deployUtil.certPaths('') fp = deployUtil.generateFingerPrint(path) approval = ButtonChoiceWindow(self.ncs.screen, "Certificate Fingerprint:", fp, buttons = ['Approve', 'Reject']) if 'reject' == approval: ButtonChoiceWindow(self.ncs.screen, "Fingerprint rejected", "oVirt Engine Configuration Failed", buttons = ['Ok']) return False else: ovirt_store_config(path) self.ncs.reset_screen_colors() else: ButtonChoiceWindow(self.ncs.screen, "oVirt Engine Configuration", "Failed downloading oVirt Engine certificate", buttons = ['Ok']) self.ncs.reset_screen_colors() # Stopping vdsm-reg may fail but its ok - its in the case when the menus are run after installation deployUtil._logExec([constants.EXT_SERVICE, 'vdsm-reg', 'stop']) if write_vdsm_config(self.rhevm_server.value(), self.rhevm_server_port.value()): deployUtil._logExec([constants.EXT_SERVICE, 'vdsm-reg', 'start']) ButtonChoiceWindow(self.ncs.screen, "oVirt Engine Configuration", "oVirt Engine Configuration Successfully Updated", buttons = ['Ok']) self.ncs.reset_screen_colors() return True else: ButtonChoiceWindow(self.ncs.screen, "oVirt Engine Configuration", "oVirt Engine Configuration Failed", buttons = ['Ok']) self.ncs.reset_screen_colors() return False
def imvp_apply(self, obj): from ocsetup.ocsetup import ocs log("enter imvp apply %s") imvp_server_address = ocs.imvp_server_addr_val_Entry.get_text() imvp_server_port = ocs.imvp_serve_port_val_Entry.get_text() compatPort, sslPort = compatiblePort(imvp_server_port) if len(imvp_server_address) > 0: deployUtil.nodeCleanup() if not isHostReachable(host=imvp_server_address, port=imvp_server_port, ssl=sslPort, timeout=TIMEOUT_FIND_HOST_SEC): if compatPort is None: # Try one more time with SSL=False if not isHostReachable(host=imvp_server_address, port=imvp_server_port, ssl=False, timeout=TIMEOUT_FIND_HOST_SEC): msgConn = "Can't connect to oVirt Engine in the specific" \ " port %s" % enginePort resp_id = ConfirmDialog( message=msgConn).run_and_close() return False else: msgConn = "Can't connect to oVirt Engine port %s," \ " trying compatible port %s" % \ (enginePort, compatPort) resp_id = ConfirmDialog(message=msgConn).run_and_close() if not isHostReachable(host=imvp_server_address, port=compatPort, ssl=sslPort, timeout=TIMEOUT_FIND_HOST_SEC): msgConn = "Can't connect to oVirt Engine using" \ " compatible port %s" % compatPort resp_id = ConfirmDialog( message=msgConn).run_and_close() return False else: # compatible port found enginePort = compatPort if True: if deployUtil.getRhevmCert(imvp_server_address, enginePort): path, dontCare = deployUtil.certPaths('') fp = deployUtil.generateFingerPrint(path) ovirt_store_config(path) else: msgConn = "Failed downloading IMVP certificate" resp_id = ConfirmDialog(message=msgConn).run_and_close() # Stopping vdsm-reg may fail but its ok - its in the case when the menus are run after installation deployUtil._logExec([constants.EXT_SERVICE, 'vdsm-reg', 'stop']) if write_vdsm_config(imvp_server_address, enginePort): deployUtil._logExec( [constants.EXT_SERVICE, 'vdsm-reg', 'start']) msgConn = "@ENGINENAME@ Configuration Successfully Updated" resp_id = ConfirmDialog(message=msgConn).run_and_close() retWriteConf = True else: msgConn = "@ENGINENAME@ Configuration Failed" resp_id = ConfirmDialog(message=msgConn).run_and_close() retWriteConf = False return retWriteConf