Exemplo n.º 1
0
    def refresh(self, args=None):
        """ Refresh screen. """
        self._load_new_devices()
        EditTUISpoke.refresh(self, args)

        self._container = ListColumnContainer(1, columns_width=78, spacing=1)

        summary = self._summary_text()
        self.window.add_with_separator(TextWidget(summary))
        hostname = _("Host Name: %s\n") % self.data.network.hostname
        self.window.add_with_separator(TextWidget(hostname))
        current_hostname = _("Current host name: %s\n") % network.current_hostname()
        self.window.add_with_separator(TextWidget(current_hostname))

        # if we have any errors, display them
        while len(self.errors) > 0:
            self.window.add_with_separator(TextWidget(self.errors.pop()))

        self._container.add(TextWidget(_("Set host name")), callback=self._set_hostname_callback)

        for dev_name in self.supported_devices:
            text = (_("Configure device %s") % dev_name)
            self._container.add(TextWidget(text), callback=self._configure_network_interface, data=dev_name)

        self.window.add_with_separator(self._container)
Exemplo n.º 2
0
    def refresh(self, args=None):
        EditTUISpoke.refresh(self, args)

        threadMgr.wait(THREAD_PAYLOAD)

        _methods = [_("CD/DVD"), _("local ISO file"), _("Network")]

        if self.data.method.method == "harddrive" and \
           get_mount_device(DRACUT_ISODIR) == get_mount_device(DRACUT_REPODIR):
            message = _("The installation source is in use by the installer and cannot be changed.")
            self._window += [TextWidget(message), ""]
            return True

        if args == 3:
            text = [TextWidget(_(p)) for p in self._protocols]
        else:
            self._window += [TextWidget(_("Choose an installation source type."))]
            text = [TextWidget(m) for m in _methods]

        def _prep(i, w):
            """ Mangle our text to make it look pretty on screen. """
            number = TextWidget("%2d)" % (i + 1))
            return ColumnWidget([(4, [number]), (None, [w])], 1)

        # gnarl and mangle all of our widgets so things look pretty on screen
        choices = [_prep(i, w) for i, w in enumerate(text)]

        displayed = ColumnWidget([(78, choices)], 1)
        self._window.append(displayed)

        return True
Exemplo n.º 3
0
    def initialize(self):
        EditTUISpoke.initialize(self)
        self.initialize_start()

        threadMgr.add(AnacondaThread(name=THREAD_SOURCE_WATCHER,
                                     target=self._initialize))
        payloadMgr.addListener(payloadMgr.STATE_ERROR, self._payload_error)
Exemplo n.º 4
0
    def refresh(self, args=None):
        """ Refresh screen. """
        self._load_new_devices()
        EditTUISpoke.refresh(self, args)

        summary = self._summary_text()
        self._window += [TextWidget(summary), ""]
        hostname = _("Host Name: %s\n") % self.data.network.hostname
        self._window += [TextWidget(hostname), ""]
        current_hostname = _("Current host name: %s\n") % network.current_hostname()
        self._window += [TextWidget(current_hostname), ""]

        # if we have any errors, display them
        while len(self.errors) > 0:
            self._window += [TextWidget(self.errors.pop()), ""]

        def _prep(i, w):
            """ Mangle our text to make it look pretty on screen. """
            number = TextWidget("%2d)" % (i + 1))
            return ColumnWidget([(4, [number]), (None, [w])], 1)

        _opts = [_("Set host name")]
        for devname in self.supported_devices:
            _opts.append(_("Configure device %s") % devname)
        text = [TextWidget(o) for o in _opts]

        # make everything presentable on screen
        choices = [_prep(i, w) for i, w in enumerate(text)]
        displayed = ColumnWidget([(78, choices)], 1)
        self._window += [displayed, ""]

        return True
Exemplo n.º 5
0
 def __init__(self, app, data, storage, payload, instclass):
     EditTUISpoke.__init__(self, app, data, storage, payload, instclass)
     self.hostname_dialog = OneShotEditTUIDialog(app, data, storage, payload, instclass)
     self.hostname_dialog.value = self.data.network.hostname
     self.supported_devices = []
     self.errors = []
     self._apply = False
Exemplo n.º 6
0
    def refresh(self, args=None):
        EditTUISpoke.refresh(self, args)

        threadMgr.wait(THREAD_PAYLOAD)
        threadMgr.wait(THREAD_PAYLOAD_MD)

        _methods = [_("CD/DVD"), _("local ISO file"), _("Network")]
        if args == 3:
            text = [TextWidget(p) for p in self._protocols]
        else:
            self._window += [TextWidget(_("Choose an installation source type."))]
            text = [TextWidget(m) for m in _methods]

        def _prep(i, w):
            """ Mangle our text to make it look pretty on screen. """
            number = TextWidget("%2d)" % (i + 1))
            return ColumnWidget([(4, [number]), (None, [w])], 1)

        # gnarl and mangle all of our widgets so things look pretty on screen
        choices = [_prep(i, w) for i, w in enumerate(text)]

        displayed = ColumnWidget([(78, choices)], 1)
        self._window.append(displayed)

        return True
Exemplo n.º 7
0
 def __init__(self, app, data, storage, payload, instclass, ndata):
     EditTUISpoke.__init__(self, app, data, storage, payload, instclass)
     self.args = ndata
     if self.args.bootProto == "dhcp":
         self.args.ip = "dhcp"
     if self.args.noipv6:
         self.args.ipv6 = "ignore"
     self.args._apply = False
Exemplo n.º 8
0
    def initialize(self):
        self.initialize_start()
        self._load_new_devices()

        EditTUISpoke.initialize(self)
        if not self.data.network.seen:
            self._update_network_data()
        self.initialize_done()
Exemplo n.º 9
0
 def __init__(self, app, data, storage, payload, instclass, ndata):
     EditTUISpoke.__init__(self, app, data, storage, payload, instclass)
     self.args = ndata
     if self.args.bootProto == "dhcp":
         self.args.ip = "dhcp"
     if self.args.noipv6:
         self.args.ipv6 = "ignore"
     self.args._apply = False
     self.dialog.wrong_input_message = _("Bad format of the IP address")
Exemplo n.º 10
0
 def __init__(self, data, storage, payload, instclass):
     EditTUISpoke.__init__(self, data, storage, payload, instclass)
     self.title = N_("Network configuration")
     self._container = None
     self.hostname_dialog = OneShotEditTUIDialog(data, storage, payload, instclass)
     self.hostname_dialog.value = self.data.network.hostname
     self.supported_devices = []
     self.errors = []
     self._apply = False
Exemplo n.º 11
0
    def refresh(self, args=None):
        self.args._admin = "wheel" in self.args.groups
        self.args._groups = ", ".join(self.args.groups)

        # if we have any errors, display them
        while self.errors:
            print(self.errors.pop())

        EditTUISpoke.refresh(self, args)
Exemplo n.º 12
0
 def __init__(self, data, storage, payload, instclass, ndata):
     EditTUISpoke.__init__(self, data, storage, payload, instclass)
     self.title = N_("Device configuration")
     self.args = ndata
     if self.args.bootProto == "dhcp":
         self.args.ip = "dhcp"
     if self.args.noipv6:
         self.args.ipv6 = "ignore"
     self.args._apply = False
Exemplo n.º 13
0
    def __init__(self, app, data, storage, payload, instclass, selection, error):
        EditTUISpoke.__init__(self, app, data, storage, payload, instclass)
        SourceSwitchHandler.__init__(self)
        self.selection = selection
        self._error = error

        nfs = self.data.method
        self.args = DataHolder(server="", opts=nfs.opts or "")
        if nfs.method == "nfs" and nfs.server and nfs.dir:
            self.args.server = "%s:%s" % (nfs.server, nfs.dir)
Exemplo n.º 14
0
    def initialize(self):
        for name in nm.nm_devices():
            if nm.nm_device_type_is_ethernet(name):
                # ignore slaves
                if nm.nm_device_setting_value(name, "connection", "slave-type"):
                    continue
                self.supported_devices.append(name)

        EditTUISpoke.initialize(self)
        if not self.data.network.seen:
            self._update_network_data()
Exemplo n.º 15
0
    def __init__(self, app, data, storage, payload, instclass):
        EditTUISpoke.__init__(self, app, data, storage, payload, instclass)

        self.args = self.data.addons.com_redhat_kdump

        # Read the config file into data.content so that it will be written
        # to the system even though it is not editable
        try:
            with open(CONFIG_FILE, "r") as fobj:
                self.data.addons.com_redhat_kdump.content = fobj.read()
        except IOError:
            pass
Exemplo n.º 16
0
    def __init__(self, app, data, storage, payload, instclass):
        FirstbootSpokeMixIn.__init__(self)
        EditTUISpoke.__init__(self, app, data, storage, payload, instclass)

        if self.data.user.userList:
            self.args = self.data.user.userList[0]
            self.args._create = True
        else:
            self.args = self.data.UserData()
            self.args._create = False

        self.args._use_password = self.args.isCrypted or self.args.password
Exemplo n.º 17
0
    def __init__(self, app, data, storage, payload, instclass):
        FirstbootSpokeMixIn.__init__(self)
        EditTUISpoke.__init__(self, app, data, storage, payload, instclass)

        if self.data.user.userList:
            self.args = self.data.user.userList[0]
            self.args._create = True
        else:
            self.args = self.data.UserData()
            self.args._create = False

        self.args._use_password = self.args.isCrypted or self.args.password

        # Keep the password separate from the kickstart data until apply()
        # so that all of the properties are set at once
        self.args._password = ""
Exemplo n.º 18
0
 def input(self, args, key):
     self.dialog.wrong_input_message = _("Bad format of the IP address")
     try:
         field = self.visible_fields[int(key)-1]
     except (ValueError, IndexError):
         pass
     else:
         if field.attribute == "netmask":
             self.dialog.wrong_input_message = _("Bad format of the netmask")
     return EditTUISpoke.input(self, args, key)
Exemplo n.º 19
0
    def __init__(self, app, data, storage, payload, instclass):
        EditTUISpoke.__init__(self, app, data, storage, payload, instclass, "user")
        self.dialog.wrong_input_message = _("You have provided an invalid user name.\n"
                                            "Tip: Keep your user name shorter than 32 "
                                            "characters and do not use spaces.\n")

        if self.data.user.userList:
            self.args = self.data.user.userList[0]
            self.args._create = True
        else:
            self.args = self.data.UserData()
            self.args._create = False

        self.args._use_password = self.args.isCrypted or self.args.password

        # Keep the password separate from the kickstart data until apply()
        # so that all of the properties are set at once
        self.args._password = ""

        self.errors = []
Exemplo n.º 20
0
    def refresh(self, args=None):
        """ Refresh screen. """
        self._load_new_devices()
        EditTUISpoke.refresh(self, args)

        # on refresh check if we haven't got hostname from NM on activated
        # connection (dhcp or DNS)
        if self.hostname_dialog.value == network.DEFAULT_HOSTNAME:
            hostname = network.getHostname()
            network.update_hostname_data(self.data, hostname)
            self.hostname_dialog.value = self.data.network.hostname

        summary = self._summary_text()
        self._window += [TextWidget(summary), ""]
        hostname = _("Host Name: %s\n") % self.data.network.hostname
        self._window += [TextWidget(hostname), ""]

        # if we have any errors, display them
        while len(self.errors) > 0:
            self._window += [TextWidget(self.errors.pop()), ""]

        def _prep(i, w):
            """ Mangle our text to make it look pretty on screen. """
            number = TextWidget("%2d)" % (i + 1))
            return ColumnWidget([(4, [number]), (None, [w])], 1)

        _opts = [_("Set host name")]
        for devname in self.supported_devices:
            _opts.append(_("Configure device %s") % devname)
        text = [TextWidget(o) for o in _opts]

        # make everything presentable on screen
        choices = [_prep(i, w) for i, w in enumerate(text)]
        displayed = ColumnWidget([(78, choices)], 1)
        self._window.append(displayed)

        return True
Exemplo n.º 21
0
    def input(self, args, key):
        self.dialog.wrong_input_message = None
        try:
            field = self.visible_fields[int(key)-1]
        except (ValueError, IndexError):
            pass
        else:
            if field.attribute == "gecos":
                self.dialog.wrong_input_message = _("Full name can't contain the ':' character")
            elif field.attribute == "name":
                # more granular message is returned by check_username
                pass
            elif field.attribute == "_groups":
                self.dialog.wrong_input_message = _("Either a group name in the group list is invalid or groups are not separated by a comma")


        return EditTUISpoke.input(self, args, key)
Exemplo n.º 22
0
    def initialize(self):
        EditTUISpoke.initialize(self)

        threadMgr.add(AnacondaThread(name=THREAD_SOURCE_WATCHER,
                                     target=self._initialize))
Exemplo n.º 23
0
 def __init__(self, app, data, storage, payload, instclass):
     EditTUISpoke.__init__(self, app, data, storage, payload, instclass)
     self._ready = False
     self.errors = []
     self._cdrom = None
Exemplo n.º 24
0
 def refresh(self, args=None):
     """ Refresh window. """
     return EditTUISpoke.refresh(self, args)
Exemplo n.º 25
0
 def __init__(self, app, data, storage, payload, instclass, selection, errors):
     EditTUISpoke.__init__(self, app, data, storage, payload, instclass)
     self.selection = selection
     self.args = self.data.method
     self.errors = errors
Exemplo n.º 26
0
 def refresh(self, args = None):
     self.args._admin = "wheel" in self.args.groups
     self.args._groups = ", ".join(self.args.groups)
     return EditTUISpoke.refresh(self, args)
Exemplo n.º 27
0
 def __init__(self, app, data, storage, payload, instclass):
     EditTUISpoke.__init__(self, app, data, storage, payload, instclass)
     SourceSwitchHandler.__init__(self)
     self._ready = False
     self._error = False
     self._cdrom = None
Exemplo n.º 28
0
 def refresh(self, args=None):
     """ Refresh window. """
     EditTUISpoke.refresh(self, args)
     message = _("Configuring device %s.") % self.args.device
     self._window += [TextWidget(message), ""]
     return True
Exemplo n.º 29
0
 def __init__(self, app, data, storage, payload, instclass):
     EditTUISpoke.__init__(self, app, data, storage, payload, instclass)
     self.args = self.data.addons.com_redhat_kdump
Exemplo n.º 30
0
 def __init__(self, app, data, storage, payload, instclass, selection):
     EditTUISpoke.__init__(self, app, data, storage, payload, instclass)
     SourceSwitchHandler.__init__(self)
     self.selection = selection
     self.args = self.data.method
Exemplo n.º 31
0
 def refresh(self, args=None):
     """ Refresh window. """
     EditTUISpoke.refresh(self, args)
Exemplo n.º 32
0
 def refresh(self, args=None):
     self.args._admin = "wheel" in self.args.groups
     self.args._groups = ", ".join(self.args.groups)
     return EditTUISpoke.refresh(self, args)
Exemplo n.º 33
0
 def __init__(self, data, storage, payload, instclass, protocol):
     EditTUISpoke.__init__(self, data, storage, payload, instclass)
     SourceSwitchHandler.__init__(self)
     self.title = N_("Specify Repo Options")
     self.protocol = protocol
     self.args = self.data.method
Exemplo n.º 34
0
 def refresh(self, args=None):
     """ Refresh window. """
     EditTUISpoke.refresh(self, args)
     message = _("Configuring device %s.") % self.args.device
     self.window.add_with_separator(TextWidget(message))
Exemplo n.º 35
0
 def __init__(self, app, data, storage, payload, instclass):
     EditTUISpoke.__init__(self, app, data, storage, payload, instclass)
     self.args = self.data.addons.com_redhat_kdump
Exemplo n.º 36
0
 def __init__(self, app, data, storage, payload, instclass):
     EditTUISpoke.__init__(self, app, data, storage, payload, instclass)
     SourceSwitchHandler.__init__(self)
     self._ready = False
     self._error = False
     self._cdrom = None
Exemplo n.º 37
0
    def initialize(self):
        self._load_new_devices()

        EditTUISpoke.initialize(self)
        if not self.data.network.seen:
            self._update_network_data()
Exemplo n.º 38
0
 def __init__(self, app, data, storage, payload, instclass, selection):
     EditTUISpoke.__init__(self, app, data, storage, payload, instclass)
     SourceSwitchHandler.__init__(self)
     self.selection = selection
     self.args = self.data.method
Exemplo n.º 39
0
 def refresh(self, args=None):
     """ Refresh window. """
     EditTUISpoke.refresh(self, args)
     message = _("Configuring device %s.") % self.args.device
     self._window += [TextWidget(message), ""]
     return True