def validatePage(self): type_index, is_ok = self.field('type').toInt() ha_type = unicode(self.ha_type.itemData(type_index).toString()) if QHAObject.getInstance().cfg.ha_type == SECONDARY and ha_type == ENOHA: #SECONDARY -> ENOHA is forbidden #when PRIMARY, this wizard is not even displayed QMessageBox.warning(self, tr('Invalid configuration'), tr( "In order to fully deconfigure high availability, you " "need to restore this appliance to factory defaults." ) ) return False if ha_type != ENOHA: net_cfg = QNetObject.getInstance().netcfg iface = self.interface.getInterface() iface_id = net_cfg.getHardLabel(iface) iface_name = iface.system_name else: iface_id = None iface_name = None config = HAConf(ha_type=ha_type, interface_id=iface_id, interface_name=iface_name) msg = config.isValidWithMsg() if msg is None: self.config = config else: QMessageBox.warning(self, tr('Invalid configuration'), msg[0] % msg[1:]) if msg is not None: return False if ha_type != PENDING_PRIMARY: return True user_valid = QMessageBox.question( self, tr("Configuring primary appliance. Are you sure?"), "<div>%s<br/>%s<br/>%s<br/>%s</div>" % ( tr( "After this configuration step, <b>you will not be able to " "change the hostname anymore.</b>" ), tr( "Abort now, or reject the saved configuration if you " "need to change the hostname." ), tr("The hostname is currently <i><b>'%(HOSTNAME)s'</b></i>" ) % {'HOSTNAME': QHostnameObject.getInstance().cfg.hostname}, tr("Do you want to continue?"), ), QMessageBox.Yes | QMessageBox.Abort ) return user_valid == QMessageBox.Yes
def __init__(self, config, specific_config, mainwindow, parent=None): DirectoryWidget.__init__(self, config, specific_config, mainwindow, parent=None) self.qhostname_object = QHostnameObject.getInstance() self.buildInterface(config) self.updateView() self._poll()