--- data/ui/netconfig.glade | 538 ------------------------------------- pyanaconda/isys/__init__.py | 35 --- pyanaconda/iw/netconfig_dialog.py | 329 ---------------------- pyanaconda/network.py | 1 - 4 files changed, 0 insertions(+), 903 deletions(-) delete mode 100644 data/ui/netconfig.glade delete mode 100644 pyanaconda/iw/netconfig_dialog.py diff --git a/data/ui/netconfig.glade b/data/ui/netconfig.glade deleted file mode 100644 index 92bc27a..0000000 --- a/data/ui/netconfig.glade +++ /dev/null @@ -1,538 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkDialog" id="NetworkConfigWindow"> - <property name="visible">True</property> - <property name="title" translatable="yes">Enable network interface</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_CENTER_ALWAYS</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="focus_on_map">True</property> - <property name="urgency_hint">False</property> - <property name="has_separator">True</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="dialog-vbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="dialog-action_area1"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - - <child> - <widget class="GtkButton" id="cancelButton"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="response_id">-6</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="okButton"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-ok</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="response_id">-5</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox1"> - <property name="border_width">18</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="label" translatable="yes">This requires that you have an active network connection during the installation process. Please configure a network interface.</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">True</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="interfaceBox"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="interfaceLabel"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>_Interface:</b></property> - <property name="use_underline">True</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkComboBox" id="interfaceCombo"> - <property name="visible">True</property> - <property name="add_tearoffs">False</property> - <property name="focus_on_click">True</property> - <signal name="changed" handler="on_interfaceCombo_changed"/> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="dhcpCheckbutton"> - <property name="visible">True</property> - <property name="label" translatable="yes">Use _dynamic IP configuration (DHCP)</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_dhcpCheckbutton_toggled"/> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="ipv4Checkbutton"> - <property name="visible">True</property> - <property name="label" translatable="yes">Enable IPv_4 support</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_ipv4Checkbutton_toggled"/> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="ipv6Checkbutton"> - <property name="label" translatable="yes">Enable IPv_6 support</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_ipv6Checkbutton_toggled"/> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="ipv4Box"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="ipv4Label"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>IPv4 Address:</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="ipv4Address"> - <property name="visible">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char">â</property> - <property name="activates_default">False</property> - <property name="width_chars">16</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label10"> - <property name="visible">True</property> - <property name="label" translatable="yes">/</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="ipv4Netmask"> - <property name="visible">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char">â</property> - <property name="activates_default">False</property> - <property name="width_chars">16</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="ipv6Box"> - <property name="sensitive">False</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="ipv6Label"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>IPv6 Address:</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="ipv6Address"> - <property name="visible">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char">â</property> - <property name="activates_default">False</property> - <property name="width_chars">41</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label11"> - <property name="visible">True</property> - <property name="label" translatable="yes">/</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="ipv6Netmask"> - <property name="visible">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char">â</property> - <property name="activates_default">False</property> - <property name="width_chars">4</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="gatewayBox"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="gatewayLabel"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Gateway:</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="gatewayEntry"> - <property name="visible">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char">â</property> - <property name="activates_default">False</property> - <property name="width_chars">41</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="nameserverBox"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="nameserverLabel"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Nameserver:</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="nameserverEntry"> - <property name="visible">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char">â</property> - <property name="activates_default">False</property> - <property name="width_chars">41</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <placeholder/> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/pyanaconda/isys/__init__.py b/pyanaconda/isys/__init__.py index aebcad1..d80e6c5 100755 --- a/pyanaconda/isys/__init__.py +++ b/pyanaconda/isys/__init__.py @@ -330,41 +330,6 @@ def getDeviceProperties(dev=None): else: return None -# Return true if method is currently 'dhcp' for the specified device. -def isDeviceDHCP(dev=None): - if dev is None: - return False - - bus = dbus.SystemBus() - nm = bus.get_object(NM_SERVICE, NM_MANAGER_PATH) - nm_props_iface = dbus.Interface(nm, DBUS_PROPS_IFACE) - active_connections = nm_props_iface.Get(NM_MANAGER_IFACE, "ActiveConnections") - - for path in active_connections: - active = bus.get_object(NM_SERVICE, path) - active_props_iface = dbus.Interface(active, DBUS_PROPS_IFACE) - - active_service_name = active_props_iface.Get(NM_ACTIVE_CONNECTION_IFACE, "ServiceName") - active_path = active_props_iface.Get(NM_ACTIVE_CONNECTION_IFACE, "Connection") - active_devices = active_props_iface.Get(NM_ACTIVE_CONNECTION_IFACE, "Devices") - - device = bus.get_object(NM_SERVICE, active_devices[0]) - device_props_iface = dbus.Interface(device, DBUS_PROPS_IFACE) - iface = device_props_iface.Get(NM_DEVICE_IFACE, "Interface") - - if iface != dev: - continue - - connection = bus.get_object(active_service_name, active_path) - connection_iface = dbus.Interface(connection, NM_CONNECTION_IFACE) - settings = connection_iface.GetSettings() - - ip4_setting = settings.get('ipv4') - if not ip4_setting or not ip4_setting['method'] or ip4_setting['method'] == 'auto': - return True - - return False - # Get the MAC address for a network device. def getMacAddress(dev): if dev == '' or dev is None: diff --git a/pyanaconda/iw/netconfig_dialog.py b/pyanaconda/iw/netconfig_dialog.py deleted file mode 100644 index 7fd5e8f..0000000 --- a/pyanaconda/iw/netconfig_dialog.py +++ /dev/null @@ -1,329 +0,0 @@ -# -# netconfig_dialog.py: Configure a network interface now. -# -# Copyright (C) 2006 Red Hat, Inc. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -# Author(s): Jeremy Katz <katzj@xxxxxxxxxx> -# - -import gtk -import gobject -from pyanaconda import gui - -from pyanaconda.constants import * -import gettext -_ = lambda x: gettext.ldgettext("anaconda", x) - -from pyanaconda import network -from pyanaconda import isys - -class NetworkConfigurator: - def __init__(self, network): - (xml, w) = gui.getGladeWidget("netconfig.glade", "NetworkConfigWindow") - - self.window = w - self.network = network - self.xml = xml - self.rc = gtk.RESPONSE_CANCEL - - self._setSizeGroup() - self._connectSignals() - self._populateNetdevs() - - self.xml.get_widget("ipv4Checkbutton").set_active(True) - self.xml.get_widget("ipv6Checkbutton").set_active(False) - - def _connectSignals(self): - sigs = { "on_ipv4Checkbutton_toggled": self._ipv4Toggled, - "on_ipv6Checkbutton_toggled": self._ipv6Toggled, - "on_dhcpCheckbutton_toggled": self._dhcpToggled, - "on_interfaceCombo_changed": self._netdevChanged, - "on_cancelButton_clicked": self._cancel, - "on_okButton_clicked": self._ok } - self.xml.signal_autoconnect(sigs) - - def _setSizeGroup(self): # too bad we can't do this in the glade file - sg = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) - for w in ("nameserverLabel", "gatewayLabel", "ipv6Label", - "ipv4Label", "interfaceLabel"): - sg.add_widget(self.xml.get_widget(w)) - - def _netdevChanged(self, combo): - active = combo.get_active_iter() - val = combo.get_model().get_value(active, 1) - netdev = self.network.available()[val] - - bootproto = netdev.get("BOOTPROTO") - if not bootproto or bootproto == "dhcp" or bootproto == "ibft": - self.xml.get_widget("dhcpCheckbutton").set_active(True) - else: - self.xml.get_widget("dhcpCheckbutton").set_active(False) - - # FIXME: need to set ipv6 here too once we have that - try: - if netdev.get('IPADDR'): - self.xml.get_widget("ipv4Address").set_text(netdev.get('IPADDR')) - except: - pass - - try: - if netdev.get('NETMASK'): - self.xml.get_widget("ipv4Netmask").set_text(netdev.get('NETMASK')) - except: - pass - - try: - if self.network.gateway: - self.xml.get_widget("gatewayEntry").set_text(self.network.gateway) - except: - pass - - try: - if self.network.primaryNS: - self.xml.get_widget("nameserverEntry").set_text(self.network.primaryNS) - except: - pass - - def _ipv4Toggled(self, cb): - if self.xml.get_widget("dhcpCheckbutton").get_active(): - return - if cb.get_active(): - self.xml.get_widget("ipv4Box").set_sensitive(True) - else: - self.xml.get_widget("ipv4Box").set_sensitive(False) - - def _ipv6Toggled(self, cb): - if self.xml.get_widget("dhcpCheckbutton").get_active(): - return - if cb.get_active(): - self.xml.get_widget("ipv6Box").set_sensitive(True) - else: - self.xml.get_widget("ipv6Box").set_sensitive(False) - - def _dhcpToggled(self, cb): - boxes = ("ipv4Box", "ipv6Box", "nameserverBox", "gatewayBox") - if not cb.get_active(): - map(lambda x: self.xml.get_widget(x).set_sensitive(True), boxes) - self.xml.get_widget("ipv4Box").set_sensitive(self.xml.get_widget("ipv4Checkbutton").get_active()) - self.xml.get_widget("ipv6Box").set_sensitive(self.xml.get_widget("ipv6Checkbutton").get_active()) - else: - map(lambda x: self.xml.get_widget(x).set_sensitive(False), boxes) - - def _populateNetdevs(self): - combo = self.xml.get_widget("interfaceCombo") - - cell = gtk.CellRendererText() - combo.pack_start(cell, True) - combo.set_attributes(cell, text = 0) - cell.set_property("wrap-width", 525) - combo.set_size_request(480, -1) - - store = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING) - combo.set_model(store) - - netdevs = self.network.available() - devs = netdevs.keys() - devs.sort() - ksdevice = self.network.getKSDevice() - if ksdevice: - ksdevice = ksdevice.get('DEVICE') - selected_interface = None - - for dev in devs: - i = store.append(None) - hwaddr = netdevs[dev].get("HWADDR") - - if hwaddr: - desc = "%s - %s" %(dev, hwaddr,) - else: - desc = "%s" %(dev,) - - if selected_interface is None: - selected_interface = i - - if ksdevice and ksdevice == dev: - selected_interface = i - - store[i] = (desc, dev) - - if selected_interface: - combo.set_active_iter(selected_interface) - else: - combo.set_active(0) - - def run(self): - gui.addFrame(self.window) - busycursor = gui.getBusyCursorStatus() - gui.setCursorToNormal() - - self.window.show() - while True: - rc = self.window.run() - if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]: - self._cancel() - break - if self._ok(): - break - - # restore busy cursor - if busycursor: - gui.setCursorToBusy() - return self.rc - - def destroy(self): - self.window.destroy() - - def _handleIPError(self, field, errmsg): - d = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, - gtk.BUTTONS_OK, - _("An error occurred converting the value " - "entered for \"%(field)s\":\n%(errmsg)s") - % {'field': field, 'errmsg': errmsg}) - d.set_title(_("Error With Data")) - d.set_position(gtk.WIN_POS_CENTER) - gui.addFrame(d) - d.run() - d.destroy() - - def _handleIPMissing(self, field): - d = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, - _("A value is required for the field %s.") % (field,)) - d.set_title(_("Error With Data")) - d.set_position(gtk.WIN_POS_CENTER) - gui.addFrame(d) - d.run() - d.destroy() - - def _handleNetworkError(self, field): - d = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, - gtk.BUTTONS_OK, - _("An error occurred trying to bring up the " - "%s network interface.") % (field,)) - d.set_title(_("Error Configuring Network")) - d.set_position(gtk.WIN_POS_CENTER) - gui.addFrame(d) - d.run() - d.destroy() - - def _cancel(self, *args): - self.rc = gtk.RESPONSE_CANCEL - - def _ok(self, *args): - self.rc = gtk.RESPONSE_OK - haveNet = False - combo = self.xml.get_widget("interfaceCombo") - active = combo.get_active_iter() - val = combo.get_model().get_value(active, 1) - for v, dev in self.network.available().items(): - if v == val: - dev.set(('ONBOOT', 'yes')) - netdev = dev - else: - dev.set(('ONBOOT', 'no')) - - # FIXME: need to do input validation - if self.xml.get_widget("dhcpCheckbutton").get_active(): - netdev.set(('BOOTPROTO', 'dhcp')) - self.window.hide() - w = gui.WaitWindow(_("Dynamic IP Address"), - _("Sending request for IP address information " - "for %s") % (netdev.get('DEVICE'),)) - haveNet = self.network.bringUp(devices=[netdev]) - w.pop() - else: - netdev.set(('BOOTPROTO', 'static')) - ipv4addr = self.xml.get_widget("ipv4Address").get_text() - ipv4nm = self.xml.get_widget("ipv4Netmask").get_text() - gateway = self.xml.get_widget("gatewayEntry").get_text() - ns = self.xml.get_widget("nameserverEntry").get_text() - - try: - network.sanityCheckIPString(ipv4addr) - netdev.set(('IPADDR', ipv4addr)) - except network.IPMissing, msg: - self._handleIPMissing(_("IP Address")) - return False - except network.IPError, msg: - self._handleIPError(_("IP Address"), msg) - return False - - if ipv4nm.find('.') == -1: - # user provided a CIDR prefix - try: - if int(ipv4nm) > 32 or int(ipv4nm) < 0: - msg = _("IPv4 CIDR prefix must be between 0 and 32.") - self._handleIPError(_("IPv4 Network Mask"), msg) - return False - else: - ipv4nm = isys.prefix2netmask(int(ipv4nm)) - netdev.set(('NETMASK', ipv4nm)) - except: - self._handleIPMissing(_("IPv4 Network Mask")) - return False - else: - # user provided a dotted-quad netmask - try: - network.sanityCheckIPString(ipv4nm) - netdev.set(('NETMASK', ipv4nm)) - except network.IPMissing, msg: - self._handleIPMissing(_("IPv4 Network Mask")) - return False - except network.IPError, msg: - self._handleIPError(_("IPv4 Network Mask"), msg) - return False - - try: - if gateway: - network.sanityCheckIPString(gateway) - netdev.set(('GATEWAY', gateway)) - except network.IPMissing, msg: - pass - except network.IPError, msg: - self._handleIPError(_("Gateway"), msg) - return False - - try: - if ns: - network.sanityCheckIPString(ns) - netdev.set(('DNS1', ns)) - except network.IPMissing, msg: - pass - except network.IPError, msg: - self._handleIPError(_("Nameserver"), msg) - return False - - try: - haveNet = self.network.bringUp(devices=[netdev]) - except Exception, e: - import logging - log = logging.getLogger("anaconda") - log.error("Error configuring network device: %s" %(e,)) - self._handleIPError(_("Error configuring network device:"), e) - return False - - if not haveNet: - self._handleNetworkError(netdev.get('DEVICE')) - return False - - return True - -def main(): - net = network.Network() - d = NetworkConfigurator(net) - ret = d.run() - -if __name__ == "__main__": - main() diff --git a/pyanaconda/network.py b/pyanaconda/network.py index 7a11c4f..2a9870b 100644 --- a/pyanaconda/network.py +++ b/pyanaconda/network.py @@ -694,7 +694,6 @@ class Network: # /etc/sysconfig/network-scripts/ifcfg-* # /etc/sysconfig/network-scripts/keys-* for dev in devices: - device = dev.get('DEVICE') bootproto = dev.get('BOOTPROTO').lower() # write out the hostname as DHCP_HOSTNAME if given (#81613) -- 1.7.2 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list