summaryrefslogtreecommitdiffstats
path: root/network.py
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2008-09-23 16:43:14 -1000
committerDavid Cantrell <dcantrell@redhat.com>2008-09-24 16:09:22 -1000
commitaf8c639754dcc81f34652b29bcf5e3a90b1d6863 (patch)
treebc6cb8824cbd0abff37118f0d4d79ec1254f586a /network.py
parente150ff01131c49c9b1876d21aaf508c0876f2722 (diff)
downloadanaconda-af8c639754dcc81f34652b29bcf5e3a90b1d6863.tar.gz
anaconda-af8c639754dcc81f34652b29bcf5e3a90b1d6863.tar.xz
anaconda-af8c639754dcc81f34652b29bcf5e3a90b1d6863.zip
Do not write /lib/udev.d rules if instPath is ''
If instPath is empty, it means bringUp() has been called to kick out new network configuration files for use during installation. Do not try to write out udev.d files during installation.
Diffstat (limited to 'network.py')
-rw-r--r--network.py45
1 files changed, 23 insertions, 22 deletions
diff --git a/network.py b/network.py
index 10cb62dc2..4fc716596 100644
--- a/network.py
+++ b/network.py
@@ -598,38 +598,39 @@ class Network:
f.close()
# /lib/udev/rules.d/70-persistent-net.rules
- if not os.path.isdir("%s/lib/udev/rules.d" %(instPath,)):
- iutil.mkdirChain("%s/lib/udev/rules.d" %(instPath,))
+ if not instPath == '':
+ if not os.path.isdir("%s/lib/udev/rules.d" %(instPath,)):
+ iutil.mkdirChain("%s/lib/udev/rules.d" %(instPath,))
- f = open(instPath + "/lib/udev/rules.d/70-persistent-net.rules", "w")
- f.write("""
+ f = open(instPath + "/lib/udev/rules.d/70-persistent-net.rules", "w")
+ f.write("""
# This file was automatically generated by the /lib/udev/write_net_rules
# program run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single line.
""")
- for dev in self.netdevices.values():
- addr = dev.get("HWADDR")
- if not addr:
- continue
- devname = dev.get("DEVICE")
- basename = devname
- while basename is not "" and basename[-1] in string.digits:
- basename = basename[:-1]
+ for dev in self.netdevices.values():
+ addr = dev.get("HWADDR")
+ if not addr:
+ continue
+ devname = dev.get("DEVICE")
+ basename = devname
+ while basename is not "" and basename[-1] in string.digits:
+ basename = basename[:-1]
- # rules are case senstive for address. Lame.
- addr = addr.lower()
+ # rules are case senstive for address. Lame.
+ addr = addr.lower()
- s = ""
- if len(dev.get("DESC")) > 0:
- s = "# %s (rule written by anaconda)\n" % (dev.get("DESC"),)
- else:
- s = "# %s (rule written by anaconda)\n" % (devname,)
- s = s + 'SUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS=="?*", ATTR{address}=="%s", ATTR{type}=="1", KERNEL=="%s*", NAME="%s"\n' % (addr, basename, devname)
- f.write(s)
+ s = ""
+ if len(dev.get("DESC")) > 0:
+ s = "# %s (rule written by anaconda)\n" % (dev.get("DESC"),)
+ else:
+ s = "# %s (rule written by anaconda)\n" % (devname,)
+ s = s + 'SUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS=="?*", ATTR{address}=="%s", ATTR{type}=="1", KERNEL=="%s*", NAME="%s"\n' % (addr, basename, devname)
+ f.write(s)
- f.close()
+ f.close()
# write out current configuration state and wait for NetworkManager
# to bring the device up