On 05/26/2010 04:16 PM, Chris Lumens wrote:
Why do you want to move it into the network object? Looking at
network.py, I still see plenty of similar methods not in the object:
getDefaultHostname, hasActiveNetDev, getActiveNetDevs, etc.
That's true, my motivation was to do it "right". We are calling the function
here:
# TODORV: put into Network objects
if network.hasWirelessDev():
# NOTE: For wireless, we need supplicant to go to ready
state,
# that means to get the wireless device managed by NM
self.anaconda.network.writeIfcfgFiles()
w = self.anaconda.intf.waitWindow(_("Wireless setup"),
_("Scanning access points for
wireless devices"))
# get available wireless APs
dev_all_ssids = self.anaconda.network.getSSIDs()
w.pop()
# prefer APs we already have set e.g. via kickstart or
stage 1
self.anaconda.network.selectPreferredSSIDs(dev_all_ssids)
# select wireless APs
dev_ssids = selectSSIDsDialog(dev_all_ssids) or
dev_all_ssids
self.anaconda.network.updateIfcfgsSSID(dev_ssids)
that is before handling devices from the Network object
(anaconda.network), not any
network devices we are able to find. Devices in Netowrk object are the
only we
are able to handle in stage2 (e.g. with dialog for selecting AP/SSID - which
would follow the function call) - devices having ifcfg file. ifcfg file
is our
major interface to NM (especially for setting confugration).
Now how can possibly set of devices discovered with
isys.getDeviceProperties():
-def hasWirelessDev():
- devprops = isys.getDeviceProperties()<----
- for dev, props in devprops.items():
- device_type = int(props.Get(isys.NM_DEVICE_IFACE, "DeviceType"))
- if device_type == 2:
- return True
- return False
differ (as a superset) from those kept in Network object:
+ def hasWirelessDev(self):
+ for dev in self.netdevices:<------
+ if isys.isWirelessDevice(dev)
+ return True
+ return False
Here is an example:
User deletes device (connection) in nm-c-e which deletes its ifcfg file.
After that, when the Network object is updated we ignore the device as
we are
not able to handle it without the file. It can reappear in Network object
only after adding it in nm-c-e. So basically I wanted to be consistent
and ignore the removed device also when calling hasWirelessDev().
I don't insist much on moving the function into Network object, maybe it is
aspiring to be too right and we can do it later if a problem/bug is
really hit
together with auditing other similar functions. The example above might be
too corner/shoot yourself in the leg case.
Thanks for the reviews,
Radek
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list