Exemplo n.º 1
0
    def okClicked(self, *args):
        userName = self.userName.get_text()

        for account, passwd in self.parent.accounts:
            if account == userName:
                MessageWindow(None, "User Account Error",
                              "That account has already been added.")
                return

        try:
            users.sanityCheckUserAccount(userName)
        except ValueError, msg:
            MessageWindow(None, "User Account Error", msg[0])
            return
Exemplo n.º 2
0
class AddUserWindow(CommonWindow):
    def __init__(self, xml, parent):
        CommonWindow.__init__(self)

        self.xml = xml
        self.parent = parent

        self.userName = self.xml.get_widget("AdduserNameEntry")
        self.passwdEntry1 = self.xml.get_widget("AdduserPassword1Entry")
        self.passwdEntry2 = self.xml.get_widget("AdduserPassword2Entry")

        self.dialog = self.xml.get_widget("adduser")

        connectSignalHandlerByDict(
            self, AddUserWindow, self.xml, {
                ('AdduserOkButton', 'clicked'): 'okClicked',
                ('AdduserCancelButton', 'clicked'): 'cancelClicked',
            })

        self.addFrameToWindow()

    def okClicked(self, *args):
        userName = self.userName.get_text()

        for account, passwd in self.parent.accounts:
            if account == userName:
                MessageWindow(None, "User Account Error",
                              "That account has already been added.")
                return

        try:
            users.sanityCheckUserAccount(userName)
        except ValueError, msg:
            MessageWindow(None, "User Account Error", msg[0])
            return

        passwd1 = self.passwdEntry1.get_text()
        passwd2 = self.passwdEntry2.get_text()

        if passwd1 != passwd2:
            MessageWindow(None, "Password Input Error",
                          "The two passwords entered did not match.")
            return

        try:
            users.sanityCheckPassword(passwd1)
        except ValueError, msg:
            MessageWindow(None, "Password Input Error", msg[0])
            return
Exemplo n.º 3
0
    def onCityListSelect(self, widget, *args):
        model, treeIter = self.allTZsView.get_selection().get_selected()
        if not treeIter:
            MessageWindow(None, "Invalid Time Zone",
                          "You must select a time zone.")
            return
        zoneName, offset, tz = model[treeIter]
        self.selectedTZ = tz

        log.debug('TZ %s chosen from list.' % str(tz))
        self.tzEntry.set_text(tz.zoneName)
        for sprite in self.sprites:
            if not isinstance(sprite, OffsetSlice):
                continue
            if sprite.offsetName in [tz.offset, tz.showAsMapOffset]:
                sprite.selected = True
            else:
                sprite.selected = False
            for citySprite in sprite.cityGroup.cities:
                if citySprite.cityName == tz.city:
                    citySprite.selected = True
                else:
                    citySprite.selected = False

        self.advancedDialog.hide()
        self.drawingArea.queue_draw()
Exemplo n.º 4
0
    def installSystem(self):
        # resize the display label so that the parent window is not resized off
        # the screen
        # XXX This must be done here since the allocation has not been processed
        # within the __init__ method.  We can not query the allocation of a
        # widget and get a valid value at that point.
        hbox = self.xml.get_widget('InstallstatusHBox')
        label = self.xml.get_widget('InstallationLabel')

        height = self.progressLabel.get_allocation().height
        width = hbox.get_allocation().width - label.get_allocation().width
        self.progressLabel.set_size_request(width, height)

        self.progressBar.set_fraction(0)

        if not userchoices.getClaimedNICDevices():
            MessageWindow(
                self.controlState.gui.getWindow(), 'the end',
                'Because you have no usable (to ESX, so far)\n' +
                'NICs, installation can go no further than this\n' +
                'point, for now.')
            # TODO: remove when we *can* install NIC-less.
            return

        applychoices.doit(self.context)
        self.controlState.setNextButtonEnabled(True, refresh=True)
        self.controlState.setCancelButtonEnabled(False, refresh=True)
        self.controlState.gui.nextButton.grab_focus()
Exemplo n.º 5
0
 def addDriver(self, widget, *args):
     try:
         self.scanForDriverDisk()
     except InvalidDriverCDException, e:
         util.umount(MEDIA_DEVICE_MOUNT_POINT)
         cdutil.ejectCdrom()
         MessageWindow(None, "Invalid Driver CD", str(e))
    def getNext(self):
        """Tell userchoices what choices were made on this screen.
        
           We don't know bootProto, ip or netmask yet.  They're set in the
           next screen.
        
           You can assign more than one NIC to the COS from scripted install,
           but not from the GUI installer.
        """
        # Case of no NICs found. Driver loading window should prevent this.
        if not self.nicSetup:
            msg = 'No NICs detected'
            MessageWindow(self.thisWindow, msg.title(), msg)
            raise StayOnScreen()

        chosenNics = userchoices.getCosNICs()

        if chosenNics:
            assert len(chosenNics) == 1, "Found more than one console NIC."
            userchoices.delCosNIC(chosenNics[0])

        physicalNic = self.nicSetup.getDevice()
        userchoices.addCosNIC(device=physicalNic,
                              vlanID=self.nicSetup.getVlanID(),
                              bootProto=None,
                              ip=None, netmask=None)
Exemplo n.º 7
0
    def finishStep(self):
        radioButton = self.xml.get_widget('CustomdriversYesRadioButton')
        # Warn the user before letting them go forward
        rc = MessageWindow(None, 'Load Drivers',
            'The install wizard will load any drivers required for ESX. '
            'Once this step is completed, additional custom drivers '
            'cannot be loaded.\n\nLoad the system drivers?', type='yesno')

        if not rc.affirmativeResponse:
            raise exception.StayOnScreen
    
        # Add in each of the new driver packages
        if radioButton.get_active():
            for driver in self.driverList:
                packageName = driver[DRIVERMODEL_PACKAGE]

                # unpack the driver dictionary and add the requested
                # driver to the supplementary driver list
                userchoices.addSupplementaryDriver(packageName,
                    *self.driverDict[packageName])

                pkgFileName = os.path.join(customdrivers.DRIVER_DEPOT_DIR,
                                           os.path.basename(packageName))
                pkg = packages.Package(pkgFileName, 'required')

                userchoices.addPackageObjectToInstall(pkg)

        userchoices.setDriversLoaded(True)
Exemplo n.º 8
0
    def getNext(self):

        stepDict = {
            'InstallHttpRadioButton': 'httpmedia',
            'InstallFtpRadioButton': 'ftpmedia',
            'InstallUsbRadioButton': 'usbmedia',
            'InstallNfsRadioButton': 'nfsmedia'
        }

        for step in stepDict.values():
            if step in self.controlState.gui.dispatch:
                self.controlState.removeStep(step)

        for step in stepDict.keys():
            if self.xml.get_widget(step).get_active():
                self.controlState.insertStep(stepDict[step], 'setupchoice')
                break

        # if the media requires a network connection, check that the ethernet
        # cable is plugged in
        if stepDict[step] in ['httpmedia', 'ftpmedia', 'nfsmedia']:
            chosenNics = userchoices.getCosNICs()
            assert len(chosenNics) == 1
            physicalNic = chosenNics[0]['device']
            if not physicalNic.isLinkUp:
                MessageWindow(
                    None, 'Network Adapter Error',
                    'The network adapter must be connected to '
                    'access FTP, HTTP, or NFS sources.')
                raise exception.StayOnScreen()
Exemplo n.º 9
0
    def __init__(self, controlState, xml, parentDialog):
        controlState.displayHeaderBar = 1
        controlState.windowTitle = "Add software iSCSI storage"
        controlState.windowText = "Configure a NIC to handle iSCSI storage"
        self.thisWindow = controlState.gui.getWindow()
        self.xml = xml
        self.parent = parentDialog

        try:
            log.debug('NicSetup ctor: macAddresses = ' + \
                      str(iscsi.getNicMacAddresses()))
            self.nicSetup = nic_setup.NicSetup(
                xml,
                controlState.gui.getWindow(),
                comboBoxName="IscsinetworkComboBox",
                vlanCheckButtonName="IscsinetworkVlanCheckButton",
                vlanEntryName="IscsinetworkVlanIDEntry",
                vlanIDHBoxName="IscsinetworkVlanIDHBox",
                wantedMacAddresses=iscsi.getNicMacAddresses())
            log.debug('NicSetup ctor: succeeded')
        # Two kinds of possible errors: (1) no iSCSI NICs
        #                               (2) can't read iSCSI boot tables
        except RuntimeError, msg:
            log.debug(str(msg))
            MessageWindow(self.thisWindow, 'iSCSI', 'Can not set up iSCSI.')
            raise
Exemplo n.º 10
0
    def getNext(self):
        passwd1 = self.passwdEntry1.get_text()
        passwd2 = self.passwdEntry2.get_text()

        if passwd1 != passwd2:
            MessageWindow(self.controlState.gui.getWindow(),
                          "Administrator Password Error",
                          "The two passwords entered did not match.")
            raise exception.StayOnScreen

        try:
            users.sanityCheckPassword(passwd1)
        except ValueError, msg:
            MessageWindow(self.controlState.gui.getWindow(),
                          "Administrator Password Error", msg[0])
            raise exception.StayOnScreen
Exemplo n.º 11
0
class HTTPInstallMediaWindow:
    SCREEN_NAME = 'httpmedia'
    
    def __init__(self, controlState, xml):
        controlState.displayHeaderBar = True
        controlState.windowIcon = 'network_media.png'
        controlState.windowTitle = "World Wide Web (HTTP) Installation"
        controlState.windowText = "Enter the URL for the ESX installation media"

        self.xml = xml

        connectSignalHandlerByDict(self, HTTPInstallMediaWindow, self.xml,
          { ('HttpProxyCheckButton', 'toggled'): 'toggleProxy',
            ('HttpProxyUserCheckButton', 'toggled'): 'toggleUserProxy',
          })

    def getNext(self):
        url = self.xml.get_widget('HttpUrlEntry').get_text().strip()

        try:
            networking.utils.sanityCheckUrl(url,
                                            expectedProtocols=['http','https'])
        except ValueError, msg:
            MessageWindow(None, 'Invalid Url', msg[0])
            raise exception.StayOnScreen

        if self.xml.get_widget('HttpProxyCheckButton').get_active():
            errors, proxy, port, proxyUser, proxyPass = self.getProxyValues()
            if errors:
                title, details = errors[0]
                MessageWindow(None, title, details)
                raise exception.StayOnScreen

            # Note: if a user clicks Next, Back, Back, the proxy will still be
            #       set, but that should be OK, because they'll have to come
            #       through either the HTTP or FTP screen again
            userchoices.setMediaProxy(proxy, port, proxyUser, proxyPass)
        else:
            userchoices.unsetMediaProxy()

        if not checkMediaRootIsValid(url):
            MessageWindow(None, 'Network Error',
                'There was an error trying to connect to the network server.')
            raise exception.StayOnScreen

        userchoices.setMediaDescriptor(None)
        userchoices.setMediaLocation(url)
Exemplo n.º 12
0
    def okClicked(self, *args):
        vmfsName = getSelectionFromView(self.view)
        if not vmfsName or vmfsName == "Datastores":
            MessageWindow(None, "Storage Selection Error",
                          "A valid existing datastore must be selected.")
        else:
            setPartEntry = False

            # TODO: at some point it might be nice to allow the user to change
            #       the name of the vmdk file
            entry = self.datastoreSet.getEntryByName(vmfsName)
            assert entry
            if entry:
                vmdkPath = os.path.normpath(
                    os.path.join(
                        entry.consolePath,
                        fsset.vmfs3FileSystem.systemUniqueName('esxconsole'),
                        devices.DEFAULT_COS_IMAGE))

                # This is extremely unlikely to ever be executed given
                # that the UUID should be unique, however we still need
                # to nuke it if it does exist.
                if os.path.exists(vmdkPath):
                    rc = MessageWindow(
                        None,
                        "Existing Service Console",
                        "There is an existing service console at the "
                        "specified location. "
                        "Overwrite it?",
                        type="yesno")
                    if rc.affirmativeResponse:
                        setPartEntry = True
                else:
                    setPartEntry = True

                if setPartEntry:
                    dsPart = \
                        self.xml.get_widget("DatastorepartitionEntry")
                    dsPart.set_text(vmfsName)
                    global _vmfsVolume
                    _vmfsVolume = vmfsName
                    self.hide()
            else:
                # should never be able to get here
                MessageWindow(
                    None, "Error", "The selected datastore does not exist. "
                    "Choose a different datastore.")
Exemplo n.º 13
0
 def newPartition(self, *args):
     log.debug("New clicked")
     if len(self.requests) >= partition.MAX_PARTITIONS:
         MessageWindow(None, "Partition Error",
             "You can not add any additional partitions to this "
             "disk.")
         return
     self.partitionWindow.newEntry()
Exemplo n.º 14
0
    def getNext(self):
        url = self.xml.get_widget('FtpUrlEntry').get_text().strip()

        try:
            networking.utils.sanityCheckUrl(url, expectedProtocols=['ftp'])
        except ValueError, msg:
            MessageWindow(None, 'Invalid URL', msg[0])
            raise exception.StayOnScreen
Exemplo n.º 15
0
    def getNext(self):
        serverName = self.xml.get_widget('NfsServerEntry').get_text().strip()
        serverDir = self.xml.get_widget('NfsDirectoryEntry').get_text().strip()

        if not serverDir:
            MessageWindow(None, 'NFS Server Directory Error',
                          'NFS server directory must not be empty')
            raise exception.StayOnScreen

        if not serverDir.startswith('/'):
            serverDir = '/' + serverDir

        try:
            networking.utils.sanityCheckIPorHostname(serverName)
        except ValueError, msg:
            MessageWindow(None, 'NFS Server Name Error', msg[0])
            raise exception.StayOnScreen
Exemplo n.º 16
0
 def showNoNicError(self, unused1, unused2):
     """
     See justification for this, under the except clause in the contructor.
     """
     # We should never get here because we detect nics immediately after
     # driver loading.
     msg = 'No NICs detected'
     MessageWindow(self.thisWindow, msg.title(), msg)
     self.thisWindow.disconnect(self.noNicHandlerID)
Exemplo n.º 17
0
    def cancelButtonPressed(self, *args):
        title = "Cancel Installation"
        text = "Are you certain you would like to cancel your installation?"

        window = MessageWindow(self.getWindow(), title, text, 'yesno')
        if window.affirmativeResponse:
            if hasattr(self.currentWindow, "getCancel"):
                self.currentWindow.getCancel()
            self.wasCancelled = True
            gtk.main_quit()
Exemplo n.º 18
0
 def editPartition(self, *args):
     log.debug("Edit clicked")
     (model, diskIter) = self.view.get_selection().get_selected()
     if not diskIter:
         MessageWindow(None, "Partition Selection Error",
             "You must select a partition request to edit.")
     else:
         self.partitionWindow.editEntry(
             model.get(diskIter, STORAGEVIEW_DISK_ENTRY)[0])
         self.partitionWindow.show()
Exemplo n.º 19
0
    def resetPartitions(self, *args):
        window = MessageWindow(None, "Reset Virtual Disk Image Partitions",
            "Resetting will cause any changes you have made "
            "to the Service Console partitions to be lost.\n\nAre you sure "
            "you would like to reset the partitions?", type='okcancel')

        if not window.affirmativeResponse:
            return

        self._resetPartitions()
Exemplo n.º 20
0
 def getVlanID(self):
     """ Return the ID or, if the VLAN checkbox isn't checked, None """
     vlanID = None
     if self.vlanCheckButton.get_active():
         vlanID = self.vlanEntry.get_text().strip()
         try:
             networking.utils.sanityCheckVlanID(vlanID)
         except ValueError, message:
             MessageWindow(self.thisWindow, 'Vlan ID', str(message),
                           'warning')
             raise exception.StayOnScreen
Exemplo n.º 21
0
    def getNext(self):
        if not self.serialRadio.get_active():
            userchoices.clearLicense()
            return

        serialNumber = '-'.join([entry.get_text() for entry in self.entries])
        try:
            esxlicense.checkSerialNumber(serialNumber)
        except esxlicense.LicenseException, e:
            MessageWindow(None, 'Invalid Serial Number', str(e))
            raise exception.StayOnScreen
Exemplo n.º 22
0
    def removeUser(self, widget, *args):
        store, selected = self.view.get_selection().get_selected_rows()

        if not selected:
            MessageWindow(None, 'User Account Error',
                          'You must select an account to remove.')
            return

        window = MessageWindow(
            None,
            "Delete User Account",
            "Are you sure you want to remove this user account?",
            type='yesno')

        if window.affirmativeResponse:
            for entry in selected:
                # remove the entry at the storeIndex
                storeIndex = entry[0]
                self.accounts.pop(storeIndex)
                self.updateAccounts()
Exemplo n.º 23
0
class NFSInstallMediaWindow:
    SCREEN_NAME = 'nfsmedia'
    
    def __init__(self, controlState, xml):
        controlState.displayHeaderBar = True
        controlState.windowIcon = 'network_media.png'
        controlState.windowTitle = "Network Filesystem (NFS) Installation"
        controlState.windowText = \
            "Enter the Network File System (NFS) server and path of the " + \
            "ESX installation media"

        self.xml = xml

        self._setupUrl()

    def _setupUrl(self):
        if not userchoices.getMediaLocation():
            return

        url = userchoices.getMediaLocation()['mediaLocation']
        protocol, user, passwd, host, port, path =\
                                    networking.utils.parseFileResourceURL(url)

        self.xml.get_widget('NfsServerEntry').set_text(host)
        self.xml.get_widget('NfsDirectoryEntry').set_text(path)

    def getNext(self):
        serverName = self.xml.get_widget('NfsServerEntry').get_text().strip()
        serverDir = self.xml.get_widget('NfsDirectoryEntry').get_text().strip()

        if not serverDir:
            MessageWindow(None, 'NFS Server Directory Error',
                          'NFS server directory must not be empty')
            raise exception.StayOnScreen

        if not serverDir.startswith('/'):
            serverDir = '/' + serverDir

        try:
            networking.utils.sanityCheckIPorHostname(serverName)
        except ValueError, msg:
            MessageWindow(None, 'NFS Server Name Error', msg[0])
            raise exception.StayOnScreen

        url = 'nfs://%s%s' % (serverName, serverDir)

        if not checkMediaRootIsValid(url):
            MessageWindow(None, 'Network Error',
                'There was an error trying to connect to the network server.')
            raise exception.StayOnScreen

        userchoices.setMediaDescriptor(None)
        userchoices.setMediaLocation(url)
Exemplo n.º 24
0
class DriverLoadWindow:
    SCREEN_NAME = 'driverload'

    def __init__(self, controlState, xml):
        self.xml = xml
        self.progressBar = xml.get_widget("DriverloadProgressBar")
        self.progressLabel = xml.get_widget("DriverloadProgressLabel")
        self.statusLabel = xml.get_widget("DriverloadStatusLabel")

        controlState.displayHeaderBar = True
        controlState.windowIcon = 'driverloading.png'
        controlState.windowTitle = "Loading Drivers"
        controlState.windowText = "The installation wizard will resume " + \
            "after all necessary drivers are loaded"

        controlState.setNextButtonEnabled(False)
        controlState.setBackButtonEnabled(False)

        self.controlState = controlState
        self.context = applychoices.Context(
            applychoices.ProgressCallback(self))

        gobject.idle_add(self.loadDrivers)

    def getNext(self):
        # remove the driverload step since we can no longer come back
        # to this screen.  we also need to reset our pointer in the step list
        self.controlState.removeStep('driverload')
        self.controlState.setCurrentStep('customdrivers')

    def loadDrivers(self):
        # resize the display label so that the parent window is not resized off
        # the screen
        # XXX This must be done here since the allocation has not been processed
        # within the __init__ method.  We can not query the allocation of a
        # widget and get a valid value at that point.
        hbox = self.xml.get_widget('DriverloadstatusHBox')
        label = self.xml.get_widget('DriverloadLabel')

        height = self.progressLabel.get_allocation().height
        width = hbox.get_allocation().width - label.get_allocation().width
        self.progressLabel.set_size_request(width, height)

        self.progressBar.set_fraction(0)

        try:
            applychoices.doit(self.context, stepListType='loadDrivers')
            self.controlState.setNextButtonEnabled(True, refresh=True)
        except customdrivers.ScriptLoadError, msg:
            MessageWindow(None, "Script Loading Failures", str(msg[0]))
            self.controlState.setNextButtonEnabled(True, refresh=True)
        except customdrivers.CriticalScriptLoadError, msg:
            MessageWindow(None, "Critical Script Loading Failure", str(msg[0]))
Exemplo n.º 25
0
    def getPassword(self):
        password1Wid = self.xml.get_widget("BootloaderPassword1Entry")
        password2Wid = self.xml.get_widget("BootloaderPassword2Entry")
        password1 = password1Wid.get_text()
        password2 = password2Wid.get_text()

        if password1 != password2:
            MessageWindow(self.controlState.gui.getWindow(),
                          "Password Input Error",
                          "The two passwords entered did not match.")
            raise exception.StayOnScreen

        if password1 == '':
            return ''

        try:
            bootloader.validateGrubPassword(password1)
        except ValueError, msg:
            MessageWindow(self.controlState.gui.getWindow(),
                          "Password Input Error", msg[0])
            raise exception.StayOnScreen
Exemplo n.º 26
0
    def deletePartition(self, *args):
        log.debug("Delete clicked")
        (model, diskIter) = self.view.get_selection().get_selected()
        if not diskIter:
            MessageWindow(None, "Partition Selection Error",
                "You must select a partition request to delete.")
        else:
            window = MessageWindow(None, "Delete Partition Request",
                "Are you sure you want to remove this partition?",
                type='yesno')

            if window.affirmativeResponse:
                request = model.get(diskIter, STORAGEVIEW_DISK_ENTRY)[0]
                self.requests.remove(request)
                model.remove(diskIter)

                self.setConsoleVMSize()
                storage_widgets.populatePartitioningModel(self.view,
                    self.scrolled, self.requests)

                self.setButtons()
Exemplo n.º 27
0
    def getNext(self, *args):
        """Tell userchoices what choices were made on this screen.
        
           You can assign more than one NIC to the COS from scripted install,
           but not from the GUI installer.
        """
        assert len(userchoices.getVmkNICs()) <= 1, \
               "Found more than one Vmk nic in userchoices."

        if userchoices.getVmkNICs():
            userchoices.delVmkNIC(userchoices.getVmkNICs()[0])

        if self.nicSetup.getDevice() in userchoices.getCosNICDevices():
            window = \
                MessageWindow(self.thisWindow, "iSCSI network adapter",
                "You have already assigned this network interface to the\n"
                "management console.  Are you sure you would like to do that?",
                "okcancel")
            if not window.affirmativeResponse:
                return

            cosNIC = userchoices.getCosNICs()[0]
            cosNet = userchoices.getCosNetwork()
            userchoices.setVmkNetwork(cosNet["gateway"])
            userchoices.addVmkNIC(device=cosNIC["device"],
                                  vlanID=cosNIC["vlanID"],
                                  bootProto=cosNIC["bootProto"],
                                  ip=cosNIC["ip"],
                                  netmask=cosNIC["netmask"])
        else:
            try:
                if self.networkAddressWidgets.getUsingDHCP():
                    bootProto = userchoices.NIC_BOOT_DHCP
                    ipSettings = self.networkAddressWidgets.testIPSettings([])
                else:
                    bootProto = userchoices.NIC_BOOT_STATIC
                    tests = ["ip", "netmask", "gateway"]
                    ipSettings = self.networkAddressWidgets.testIPSettings(
                        tests)

                userchoices.setVmkNetwork(ipSettings["gateway"])
                userchoices.addVmkNIC(device=self.nicSetup.getDevice(),
                                      vlanID=self.nicSetup.getVlanID(),
                                      bootProto=bootProto,
                                      ip=ipSettings["ip"],
                                      netmask=ipSettings["netmask"])
            except exception.StayOnScreen:
                self.parent.response(DialogResponses.STAYONSCREEN)
                return

        self.parent.response(DialogResponses.NEXT)
Exemplo n.º 28
0
    def getNext(self):
        (model, iter) = self.view.get_selection().get_selected()
        if not iter:
            MessageWindow(None, "Invalid Keyboard",
                          "You must select a keyboard to install ESX.")
            raise exception.StayOnScreen

        kbd = model.get(iter, 1)[0]
        try:
            kbd.runtimeAction()
            log.debug("Keyboard selected = %s" % (kbd.getName()))

            userchoices.setKeyboard(kbd.getKeytable(), kbd.getName(),
                                    kbd.getModel(), kbd.getLayout(),
                                    kbd.getVariant(), kbd.getOptions())

        except RuntimeError, ex:
            MessageWindow(self.ics.getWindow(),
                          "Keymap Error",
                          "Couldn't load keymap \"%s\"."
                          "\n\nUsing the keymap already loaded." %
                          (kbd.getName(), ),
                          type="warning")
Exemplo n.º 29
0
    def getNext(self):
        selectedMedia = self._getSelectedMedia()
        if not selectedMedia or not selectedMedia.hasPackages:
            MessageWindow(None,
                          "Media Selection Error",
                          "Select a valid installation medium.")
            raise exception.StayOnScreen
        
        if selectedMedia.diskName:
            userchoices.addDriveUse(selectedMedia.diskName, 'media')
        userchoices.setMediaDescriptor(selectedMedia)
        userchoices.clearMediaLocation()

        try:
            # Mount the media in case it is needed later on.
            selectedMedia.mount()
        except Exception, e:
            log.exception("unable to mount media")
            MessageWindow(None,
                          "Media Error",
                          "Unable to mount media.  Rescan and select "
                          "the media again.")
            raise exception.StayOnScreen
Exemplo n.º 30
0
    def importClicked(self, widget, *args):
        store, selected = self.view.get_selection().get_selected_rows()

        if not selected:
            MessageWindow(None, 'Driver Selection Error',
                          'You must select a driver to import.')
            return

        for entry in selected:
            packageName = store[entry[0]][DRIVERMODEL_PACKAGE]

            if _checkForCollision(packageName, self.parent.driverList,
                                  self.parent.driverDict):
                MessageWindow(None, 'Driver Import Error',
                         "Couldn't add the %s package due to a conflict." %
                          packageName)
                continue

            fileName = os.path.join(MEDIA_DEVICE_MOUNT_POINT, packageName)
            assert os.path.exists(fileName)

            targetFileName = \
                os.path.join(customdrivers.DRIVER_DEPOT_DIR,
                             os.path.basename(packageName))


            self.parent.driverList.append(tuple(store[entry[0]]))
            self.parent.updateDriverList()

            shutil.copy(fileName, targetFileName)

            self.xml.get_widget('CustomdriversRemoveButton').set_sensitive(True)

        # leave the CDROM unmounted so the user can eject it manually
        util.umount(MEDIA_DEVICE_MOUNT_POINT)
        self.hide()