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 change_password(self, _): try: from ocsetup import ocs from ovirtnode.password import set_password page = ocs.page_security pw1 = page.local_access_password_custom.entry.get_text() set_password(pw1, "admin") log("change password for admin:" + pw1) except Exception, e: log(e) pass
def commit(self): from ovirtnode import password admin_pw_set = password.set_password(self.admin_password, "admin") self.logger.debug("Setting admin password") if not admin_pw_set: raise RuntimeError("Failed to set admin password")
def commit(self): create_cim_user() if not cim_password: raise RuntimeError("CIM password is missing.") from ovirtnode.password import set_password if not set_password(cim_password, "cim"): raise RuntimeError("Setting CIM Password Failed")
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 set_password(self, username, password): import ovirtnode.password as opasswd opasswd.set_password(password, username)
def commit(self): from ovirtnode import password admin_pw_set = password.set_password(self.root_password, "admin") self.logger.debug("Setting root password: %s" % self.root_password) if not admin_pw_set: raise RuntimeError("Failed to set root password")
def commit(self): from ovirtnode import password admin_pw_set = password.set_password(self.root_password, "admin") if not admin_pw_set: raise RuntimeError("Failed to set root password")