From: Marc Fiuczynski Date: Tue, 4 Nov 2008 21:01:28 +0000 (+0000) Subject: Use more python native coding convention X-Git-Tag: BootManager-4.3-2~17 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=5e103d85ddb66785d9a05a11c27604d8e3492655;hp=438c5fd27ee5e9b88ba256c2fdfa9ea2562aa5cd;p=bootmanager.git Use more python native coding convention --- diff --git a/source/steps/WriteNetworkConfig.py b/source/steps/WriteNetworkConfig.py index 2f8c0f6..46ce122 100644 --- a/source/steps/WriteNetworkConfig.py +++ b/source/steps/WriteNetworkConfig.py @@ -88,12 +88,8 @@ def Run( vars, log ): except KeyError, e: raise BootManagerException, "Missing value %s in interface settings." % str(e) - try: - dns2= '' - dns2= interface_settings['dns2'] - except KeyError, e: - pass - + # dns2 is not required to be set + dns2 = interface_settings.get('dns2','') # Node Manager needs at least PLC_API_HOST and PLC_BOOT_HOST log.write("Writing /etc/planetlab/plc_config\n") @@ -179,10 +175,7 @@ def Run( vars, log ): elif interface['method'] == "dhcp": inter['BOOTPROTO'] = "dhcp" - if interface['hostname']: - inter['DHCP_HOSTNAME'] = interface['hostname'] - else: - inter['DHCP_HOSTNAME'] = hostname + inter['DHCP_HOSTNAME'] = interface.get('hostname',hostname) if not interface['is_primary']: inter['DHCLIENTARGS'] = "-R subnet-mask"