def _editRepo(self, *args): repo = None # If we were passed an extra argument, it's the repo store and we # are editing an existing repo as opposed to adding a new one. if len(args) > 1: (model, iter) = args[1].get_selection().get_selected() if iter: repo = model.get_value(iter, 2) else: return else: return if repo.needsNetwork() and not network.hasActiveNetDev(): if not self.anaconda.intf.enableNetwork(): return gtk.RESPONSE_CANCEL urlgrabber.grabber.reset_curl_obj() dialog = RepoEditor(self.anaconda, repo) dialog.createDialog() dialog.run() model.set_value(iter, 0, dialog.repo.isEnabled()) model.set_value(iter, 1, dialog.repo.name) model.set_value(iter, 2, dialog.repo)
def addIscsiDrive(anaconda, bind=False): """ Displays a series of dialogs that walk the user through discovering and logging into iscsi nodes. Returns gtk.RESPONSE_OK if at least one iscsi node has been logged into. """ # make sure the network is up if not network.hasActiveNetDev(): if not anaconda.intf.enableNetwork(): log.info("addIscsiDrive(): early exit, network disabled.") return gtk.RESPONSE_CANCEL # This will modify behaviour of iscsi.discovery() function if pyanaconda.storage.iscsi.iscsi().mode == "none" and not bind: pyanaconda.storage.iscsi.iscsi().delete_interfaces() elif (pyanaconda.storage.iscsi.iscsi().mode == "none" and bind) \ or pyanaconda.storage.iscsi.iscsi().mode == "bind": active = set(network.getActiveNetDevs()) created = set(pyanaconda.storage.iscsi.iscsi().ifaces.values()) pyanaconda.storage.iscsi.iscsi().create_interfaces(active - created) wizard = iSCSIGuiWizard() login_ok_nodes = pih.drive_iscsi_addition(anaconda, wizard) if len(login_ok_nodes): return gtk.RESPONSE_OK log.info("addIscsiDrive(): no new nodes added") return gtk.RESPONSE_CANCEL
def _editRepo(self, *args): repo = None # If we were passed an extra argument, it's the repo store and we # are editing an existing repo as opposed to adding a new one. if len(args) > 1: (model, iter) = args[1].get_selection().get_selected() if iter: repo = model.get_value(iter, 2) else: return else: return if repo.needsNetwork() and not network.hasActiveNetDev(): if not self.anaconda.intf.enableNetwork(): return gtk.RESPONSE_CANCEL dialog = RepoEditor(self.anaconda, repo) dialog.createDialog() dialog.run() model.set_value(iter, 0, dialog.repo.isEnabled()) model.set_value(iter, 1, dialog.repo.name) model.set_value(iter, 2, dialog.repo)
def setupRepo(anaconda, repo): if repo.needsNetwork() and not network.hasActiveNetDev(): if not anaconda.intf.enableNetwork(): return False urlgrabber.grabber.reset_curl_obj() try: anaconda.backend.doRepoSetup(anaconda, thisrepo=repo.id, fatalerrors=False) anaconda.backend.doSackSetup(anaconda, thisrepo=repo.id, fatalerrors=False) log.info("added (UI) repository %s with source URL %s, id:%s" % (repo.name, repo.mirrorlist or repo.baseurl, repo.id)) except (IOError, yum.Errors.RepoError) as e: anaconda.intf.messageWindow( _("Error"), _("Unable to read package metadata from repository. " "This may be due to a missing repodata directory. " "Please ensure that your repository has been " "correctly generated.\n\n%s" % str(e)), type="ok", custom_icon="error") return False return True
def addIscsiDriveDialog(self, screen): if not network.hasActiveNetDev(): ButtonChoiceWindow( screen, _("Error"), "Must have a network configuration set up " "for iSCSI config. Please boot with " "'linux asknetwork'") log.info("addIscsiDriveDialog(): early exit, network disabled.") return INSTALL_BACK wizard = iSCSITextWizard(screen) login_ok_nodes = pih.drive_iscsi_addition(self.anaconda, wizard) if len(login_ok_nodes): return INSTALL_OK log.info("addIscsiDriveDialog(): no new nodes added") return INSTALL_BACK
def addIscsiDriveDialog(self, screen): if not network.hasActiveNetDev(): ButtonChoiceWindow(screen, _("Error"), "Must have a network configuration set up " "for iSCSI config. Please boot with " "'linux asknetwork'") log.info("addIscsiDriveDialog(): early exit, network disabled.") return INSTALL_BACK wizard = iSCSITextWizard(screen) login_ok_nodes = pih.drive_iscsi_addition(self.anaconda, wizard) if len(login_ok_nodes): return INSTALL_OK log.info("addIscsiDriveDialog(): no new nodes added") return INSTALL_BACK
def addIscsiDriveDialog(self, screen): if not network.hasActiveNetDev(): ButtonChoiceWindow( screen, _("Error"), "Must have a network configuration set up " "for iSCSI config. Please boot with " "'linux asknetwork'") return INSTALL_BACK iname = iscsi.iscsi().initiator (button, entries) = EntryWindow( screen, _("Configure iSCSI Parameters"), _("To use iSCSI disks, you must provide the address of your iSCSI target and the iSCSI initiator name you've configured for your host." ), prompts=[ _("Target IP Address"), (_("iSCSI Initiator Name"), iname), _("CHAP username"), _("CHAP password"), _("Reverse CHAP username"), _("Reverse CHAP password") ]) if button == TEXT_CANCEL_CHECK: return INSTALL_BACK (user, pw, user_in, pw_in) = entries[2:] target = entries[0].strip() try: count = len(target.split(":")) idx = target.rfind("]:") # Check for IPV6 [IPV6-ip]:port if idx != -1: ip = target[1:idx] port = target[idx + 2:] # Check for IPV4 aaa.bbb.ccc.ddd:port elif count == 2: idx = target.rfind(":") ip = target[:idx] port = target[idx + 1:] else: ip = target port = "3260" network.sanityCheckIPString(ip) except network.IPMissing, msg: raise ValueError, msg
def setupRepo(anaconda, repo): if repo.needsNetwork() and not network.hasActiveNetDev(): if not anaconda.intf.enableNetwork(): return False try: anaconda.backend.doRepoSetup(anaconda, thisrepo=repo.id, fatalerrors=False) anaconda.backend.doSackSetup(anaconda, thisrepo=repo.id, fatalerrors=False) log.info("added (UI) repository %s with source URL %s, id:%s" % (repo.name, repo.mirrorlist or repo.baseurl, repo.id)) except (IOError, yum.Errors.RepoError) as e: anaconda.intf.messageWindow(_("Error"), _("Unable to read package metadata from repository. " "This may be due to a missing repodata directory. " "Please ensure that your repository has been " "correctly generated.\n\n%s" % str(e)), type="ok", custom_icon="error") return False return True
def _applyNfs(self, repo): server = self.nfsServerEntry.get_text() server.strip() path = self.nfsPathEntry.get_text() path.strip() options = self.nfsOptionsEntry.get_text() options.strip() repo.name = self.nameEntry.get_text() if not server or not path: self.intf.messageWindow(_("Error"), _("Please enter an NFS server and path.")) return False if not network.hasActiveNetDev(): if not self.anaconda.intf.enableNetwork(): self.intf.messageWindow( _("No Network Available"), _("Some of your software repositories require " "networking, but there was an error enabling the " "network on your system.")) return False urlgrabber.grabber.reset_curl_obj() import tempfile dest = tempfile.mkdtemp("", repo.name.replace(" ", ""), "/mnt") try: isys.mount("%s:%s" % (server, path), dest, "nfs", options=options) except Exception as e: self.intf.messageWindow( _("Error Setting Up Repository"), _("The following error occurred while setting up the " "repository:\n\n%s") % e) return False repo.baseurl = "file://%s" % dest repo.anacondaBaseURLs = ["nfs:%s:%s:%s" % (options, server, path)] return True
def addIscsiDrive(anaconda): """ Displays a series of dialogs that walk the user through discovering and logging into iscsi nodes. Returns gtk.RESPONSE_OK if at least one iscsi node has been logged into. """ # make sure the network is up if not network.hasActiveNetDev(): if not anaconda.intf.enableNetwork(): log.info("addIscsiDrive(): early exit, network disabled.") return gtk.RESPONSE_CANCEL wizard = iSCSIGuiWizard() login_ok_nodes = pih.drive_iscsi_addition(anaconda, wizard) if len(login_ok_nodes): return gtk.RESPONSE_OK log.info("addIscsiDrive(): no new nodes added") return gtk.RESPONSE_CANCEL
def _repoToggled(self, button, row, store): i = store.get_iter(int(row)) wasChecked = store.get_value(i, 0) repo = store.get_value(i, 2) if not wasChecked: if repo.needsNetwork() and not network.hasActiveNetDev(): if not self.anaconda.intf.enableNetwork(): return repo.enable() if not setupRepo(self.anaconda, repo): repo.disable() repo.close() return else: repo.disable() repo.close() store.set_value(i, 0, not wasChecked)
def _applyNfs(self, repo): server = self.nfsServerEntry.get_text() server.strip() path = self.nfsPathEntry.get_text() path.strip() options = self.nfsOptionsEntry.get_text() options.strip() repo.name = self.nameEntry.get_text() if not server or not path: self.intf.messageWindow(_("Error"), _("Please enter an NFS server and path.")) return False if not network.hasActiveNetDev(): if not self.anaconda.intf.enableNetwork(): self.intf.messageWindow(_("No Network Available"), _("Some of your software repositories require " "networking, but there was an error enabling the " "network on your system.")) return False import tempfile dest = tempfile.mkdtemp("", repo.name.replace(" ", ""), "/mnt") try: isys.mount("%s:%s" % (server, path), dest, "nfs", options=options) except Exception as e: self.intf.messageWindow(_("Error Setting Up Repository"), _("The following error occurred while setting up the " "repository:\n\n%s") % e) return False repo.baseurl = "file://%s" % dest repo.anacondaBaseURLs = ["nfs:%s:%s:%s" % (options,server,path)] return True
def addIscsiDriveDialog(self, screen, bind=False): if not network.hasActiveNetDev(): ButtonChoiceWindow(screen, _("Error"), "Must have a network configuration set up " "for iSCSI config. Please boot with " "'linux asknetwork'") log.info("addIscsiDriveDialog(): early exit, network disabled.") return INSTALL_BACK # This will modify behaviour of iscsi.discovery() function if iscsi.iscsi().mode == "none" and not bind: iscsi.iscsi().delete_interfaces() elif (iscsi.iscsi().mode == "none" and bind) \ or iscsi.iscsi().mode == "bind": active = set(network.getActiveNetDevs()) created = set(iscsi.iscsi().ifaces.values()) iscsi.iscsi().create_interfaces(active - created) wizard = iSCSITextWizard(screen) login_ok_nodes = pih.drive_iscsi_addition(self.anaconda, wizard) if len(login_ok_nodes): return INSTALL_OK log.info("addIscsiDriveDialog(): no new nodes added") return INSTALL_BACK
def addIscsiDrive(anaconda): if not network.hasActiveNetDev(): if not anaconda.intf.enableNetwork(): return gtk.RESPONSE_CANCEL urlgrabber.grabber.reset_curl_obj() (dxml, dialog) = gui.getGladeWidget("iscsi-config.glade", "iscsiDialog") gui.addFrame(dialog) dialog.show_all() sg = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) for w in [ "iscsiAddrEntry", "iscsiInitiatorEntry", "userEntry", "passEntry", "userinEntry", "passinEntry" ]: sg.add_widget(dxml.get_widget(w)) # get the initiator name if it exists and don't allow changing # once set initiator_entry = dxml.get_widget("iscsiInitiatorEntry") initiator_entry.set_text(anaconda.storage.iscsi.initiator) if anaconda.storage.iscsi.initiatorSet: initiator_entry.set_sensitive(False) while True: rc = dialog.run() if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]: break initiator = initiator_entry.get_text().strip() if len(initiator) == 0: anaconda.intf.messageWindow( _("Invalid Initiator Name"), _("You must provide an initiator name.")) continue anaconda.storage.iscsi.initiator = initiator target = dxml.get_widget("iscsiAddrEntry").get_text().strip() user = dxml.get_widget("userEntry").get_text().strip() pw = dxml.get_widget("passEntry").get_text().strip() user_in = dxml.get_widget("userinEntry").get_text().strip() pw_in = dxml.get_widget("passinEntry").get_text().strip() try: count = len(target.split(":")) idx = target.rfind("]:") # Check for IPV6 [IPV6-ip]:port if idx != -1: ip = target[1:idx] port = target[idx + 2:] # Check for IPV4 aaa.bbb.ccc.ddd:port elif count == 2: idx = target.rfind(":") ip = target[:idx] port = target[idx + 1:] else: ip = target port = "3260" network.sanityCheckIPString(ip) except (network.IPMissing, network.IPError) as msg: anaconda.intf.messageWindow(_("Error with Data"), msg) continue try: anaconda.storage.iscsi.addTarget(ip, port, user, pw, user_in, pw_in, anaconda.intf) except ValueError as e: anaconda.intf.messageWindow(_("Error"), str(e)) continue except IOError as e: anaconda.intf.messageWindow(_("Error"), str(e)) rc = gtk.RESPONSE_CANCEL break dialog.destroy() return rc
def _setupNetwork(self, *args): self.intf.enableNetwork(just_setup=True) if network.hasActiveNetDev(): urlgrabber.grabber.reset_curl_obj()