diff options
author | James Meyer <james.meyer@operamail.com> | 2011-08-19 18:23:42 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2011-08-19 18:23:42 (GMT) |
commit | 855cc7eb5a1ec13cc4ac28a910c79633703aa18f (patch) | |
tree | 8e740605bbbdd5cb0d959072201e3d2b66a821a4 /abs/core/LinHES-config/mv_network.py | |
parent | b1b4f59f40b122ee1a9cfa0c3a0f7a6a3b488f5f (diff) | |
download | linhes_pkgbuild-855cc7eb5a1ec13cc4ac28a910c79633703aa18f.zip linhes_pkgbuild-855cc7eb5a1ec13cc4ac28a910c79633703aa18f.tar.gz linhes_pkgbuild-855cc7eb5a1ec13cc4ac28a910c79633703aa18f.tar.bz2 |
linhes-config: clean up etc/fstab (pts shm)
added service to list of things to unsquash .upgrades from CD will now work
Converted most calls to the systemconfig dict to use .get. This will stop KEYERRORS form occuring.
Diffstat (limited to 'abs/core/LinHES-config/mv_network.py')
-rwxr-xr-x | abs/core/LinHES-config/mv_network.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/abs/core/LinHES-config/mv_network.py b/abs/core/LinHES-config/mv_network.py index f256785..f25d4bc 100755 --- a/abs/core/LinHES-config/mv_network.py +++ b/abs/core/LinHES-config/mv_network.py @@ -8,7 +8,7 @@ global etcnetdir etcnetdir = "/etc/net/ifaces" def setup_MYTH_DHCP(systemconfig): - default_interface = systemconfig["default_interface"] + default_interface = systemconfig.get("default_interface") try: defaultdhcp = systemconfig["HostUSEDHCP"+default_interface] except: @@ -69,7 +69,7 @@ def get_default_route(iface): return rcroute def setup_MYTH_IP(systemconfig): - default_interface = systemconfig["default_interface"] + default_interface = systemconfig.get("default_interface") #check for dhcp in use if setup_MYTH_DHCP(systemconfig) == "0": logging.debug(" dhcp is in use, finding dhcp ip") @@ -85,7 +85,7 @@ def setup_MYTH_IP(systemconfig): def setup_MYTH_GW(systemconfig): - default_interface = systemconfig["default_interface"] + default_interface = systemconfig.get("default_interface") #check for dhcp in use if setup_MYTH_DHCP(systemconfig) == "0": logging.debug(" dhcp is in use, finding dhcp ip") @@ -154,7 +154,7 @@ def setup_nameserver(dns): def setup_hostname(systemconfig): logging.debug(" _Start of setup_hostname") try: - hostname = systemconfig["hostname"] + hostname = systemconfig.get("hostname") except: logging.critical(" *Hostname could not be set") logging.info(" Using default value of me") @@ -164,14 +164,14 @@ def setup_hostname(systemconfig): mv_common.runcmd(cmd) cmd = "cat /etc/hosts | grep -v 127.0.0.1 | grep -v %s > /tmp/hosts" %hostname mv_common.runcmd(cmd) - if systemconfig["mythdhcp"] == "1" : + if systemconfig.get("mythdhcp") == "1" : logging.debug(" not using dhcp") cmd = ''' echo 127.0.0.1 localhost > /etc/hosts ''' mv_common.runcmd(cmd) - cmd = ''' echo %s %s >> /etc/hosts ''' %(systemconfig["mythip"], systemconfig["hostname"]) + cmd = ''' echo %s %s >> /etc/hosts ''' %(systemconfig.get("mythip"), systemconfig["hostname"]) mv_common.runcmd(cmd) else: - cmd = ''' echo 127.0.0.1 %s localhost > /etc/hosts ''' %systemconfig["hostname"] + cmd = ''' echo 127.0.0.1 %s localhost > /etc/hosts ''' %systemconfig.get("hostname") mv_common.runcmd(cmd) cmd = '''cat /tmp/hosts >> /etc/hosts ''' mv_common.runcmd(cmd) @@ -250,8 +250,8 @@ def setup_interface(netdev,systemconfig): netinfo = {} #populate the netinfo dict for netitem in nettrans: - if systemconfig[netitem+netdev]: - netinfo[nettrans[netitem]] = systemconfig[netitem+netdev] + if systemconfig.get(netitem+netdev): + netinfo[nettrans[netitem]] = systemconfig.get(netitem+netdev) else: netinfo[nettrans[netitem]] = False logging.debug(" %s:%s",netitem,netinfo[nettrans[netitem]]) @@ -267,7 +267,7 @@ def setup_interface(netdev,systemconfig): os.makedirs(etcnetdir+"/"+netdev) except: pass - mv_common.cp_and_log(systemconfig["TEMPLATES"]+"/etcnet/eth/options", optionfile) + mv_common.cp_and_log(systemconfig.get("TEMPLATES")+"/etcnet/eth/options", optionfile) if netinfo["isactive"] == "1" : change_iface_state(netdev,"enabled") @@ -380,7 +380,7 @@ def find_active(systemconfig,this_is_install): interfacelist=('eth0', 'eth1', 'wlan0', 'wlan1', 'ath0') logging.debug(" _Start of find_active") - if systemconfig["mythdhcp"] == "1": + if systemconfig.get("mythdhcp") == "1": mv_common.remove_file("/etc/resolv.conf") cmd = ''' echo search lan > /etc/resolv.conf ''' mv_common.runcmd(cmd) @@ -397,7 +397,7 @@ def find_active(systemconfig,this_is_install): logging.debug(" %s is not defined",currentnet) change_iface_state(netdev, "disabled") continue - if systemconfig[currentnet] == "1" : + if systemconfig.get(currentnet) == "1" : #check if device is present if devcheck(netdev) : setup_interface(netdev,systemconfig) @@ -458,8 +458,8 @@ def hostname_change_check(systemconfig): logging.debug(" _Start of hostname_change_check") oldhostname = socket.gethostname() #oldhostname = "crap" - newhostname = systemconfig["hostname"] - mv_root = systemconfig["MVROOT"] + newhostname = systemconfig.get("hostname") + mv_root = systemconfig.get("MVROOT") logging.debug(" Old hostname: %s", oldhostname) logging.debug(" New hostname: %s", newhostname) if oldhostname != newhostname : @@ -469,7 +469,7 @@ def hostname_change_check(systemconfig): logging.info(" Changing hostname to %s", newhostname) cmd = "hostname %s" %newhostname mv_common.runcmd(cmd) - if systemconfig["SystemType"] != "Frontend_only" : + if systemconfig.get("SystemType") != "Frontend_only" : logging.info(" Restarting backend") mv_common.stop_service("mythbackend") mv_common.start_service("mythbackend") |