FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 10-01-2010, 04:35 PM
"Brian C. Lane"
 
Default Honor selected hostname on Live CD (#638634)

On Fri, Oct 01, 2010 at 06:01:57PM +0200, Radek Vykydal wrote:
> NetworkManager on liveCD doesn't use ifcfg files, so we don't
> see any devices to be configured in anaconda (which is OK),
> but we still offer hostname choice, so honor it.
> ---
> pyanaconda/network.py | 30 ++++++++++++++++++++----------
> 1 files changed, 20 insertions(+), 10 deletions(-)
>
> diff --git a/pyanaconda/network.py b/pyanaconda/network.py
> index ae06f1e..d12d8ac 100644
> --- a/pyanaconda/network.py
> +++ b/pyanaconda/network.py
> @@ -446,6 +446,22 @@ class Network:
> else:
> self.netdevices[device].set(('GATEWAY', gw))
>
> + @property
> + def gateway(self):
> + """GATEWAY - last device in list wins"""
> + gw = ""
> + for dev in self.netdevices.values():
> + gw = dev.get('GATEWAY')
> + return gw

Is this a list? why not use self.netdevices.values()[-1]? After checking
to make sure len is > 0 of course.

--
Brian C. Lane / Anaconda Team
Port Orchard, WA (PST8PDT)
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 10-01-2010, 04:52 PM
Radek Vykydal
 
Default Honor selected hostname on Live CD (#638634)

On 10/01/2010 06:35 PM, Brian C. Lane wrote:



+ @property
+ def gateway(self):
+ """GATEWAY - last device in list wins"""
+ gw = ""
+ for dev in self.netdevices.values():
+ gw = dev.get('GATEWAY')
+ return gw


Is this a list? why not use self.netdevices.values()[-1]? After checking
to make sure len is> 0 of course.




Aah thanks, stupid me, it should be:

for dev in self.netdevices.values():
if dev.get('GATEWAY'):
gw = dev.get('GATEWAY')

Radek

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 10-01-2010, 05:16 PM
"Brian C. Lane"
 
Default Honor selected hostname on Live CD (#638634)

On Fri, Oct 01, 2010 at 06:52:20PM +0200, Radek Vykydal wrote:
> On 10/01/2010 06:35 PM, Brian C. Lane wrote:
> >
> >>+ @property
> >>+ def gateway(self):
> >>+ """GATEWAY - last device in list wins"""
> >>+ gw = ""
> >>+ for dev in self.netdevices.values():
> >>+ gw = dev.get('GATEWAY')
> >>+ return gw
> >Is this a list? why not use self.netdevices.values()[-1]? After checking
> >to make sure len is> 0 of course.
> >
>
> Aah thanks, stupid me, it should be:
>
> for dev in self.netdevices.values():
> if dev.get('GATEWAY'):
> gw = dev.get('GATEWAY')
>

Oh, I see, last entry that has a GATEWAY, and not all entries have it.

It could be simplified with:

gw = dev.get('GATEWAY', gw)



--
Brian C. Lane / Anaconda Team
Port Orchard, WA (PST8PDT)
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 10-04-2010, 11:18 AM
Radek Vykydal
 
Default Honor selected hostname on Live CD (#638634)

On 10/01/2010 07:16 PM, Brian C. Lane wrote:

On Fri, Oct 01, 2010 at 06:52:20PM +0200, Radek Vykydal wrote:


On 10/01/2010 06:35 PM, Brian C. Lane wrote:



+ @property
+ def gateway(self):
+ """GATEWAY - last device in list wins"""
+ gw = ""
+ for dev in self.netdevices.values():
+ gw = dev.get('GATEWAY')
+ return gw


Is this a list? why not use self.netdevices.values()[-1]? After checking
to make sure len is> 0 of course.



Aah thanks, stupid me, it should be:

for dev in self.netdevices.values():
if dev.get('GATEWAY'):
gw = dev.get('GATEWAY')



Oh, I see, last entry that has a GATEWAY, and not all entries have it.




Exactly.


It could be simplified with:

gw = dev.get('GATEWAY', gw)




Nice, unfortunately dev is NetworkDevice(IfcfgFile(SimpleConfigFile))
object whose get method would have to be modified,
so I'd stay with the boring if.

Radek
>From 808cc4139c86a64d934baaeb099b6537a0abf751 Mon Sep 17 00:00:00 2001
From: Radek Vykydal <rvykydal@redhat.com>
Date: Fri, 1 Oct 2010 17:55:12 +0200
Subject: [PATCH master] Honor selected hostname on Live CD (#638634)

NetworkManager on liveCD doesn't use ifcfg files, so we don't
see any devices to be configured in anaconda (which is OK),
but we still offer hostname choice, so honor it.
---
pyanaconda/network.py | 32 ++++++++++++++++++++++----------
1 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index ae06f1e..50d4e0d 100644
--- a/pyanaconda/network.py
+++ b/pyanaconda/network.py
@@ -446,6 +446,24 @@ class Network:
else:
self.netdevices[device].set(('GATEWAY', gw))

+ @property
+ def gateway(self):
+ """GATEWAY - last device in list wins"""
+ gw = ""
+ for dev in self.netdevices.values():
+ if dev.get('GATEWAY'):
+ gw = dev.get('GATEWAY')
+ return gw
+
+ @property
+ def ipv6_defaultgw(self):
+ """IPV6_DEFAULTGW - last device in list wins"""
+ gw = ""
+ for dev in self.netdevices.values():
+ if dev.get('IPV6_DEFAULTGW'):
+ gw = dev.get('IPV6_DEFAULTGW')
+ return gw
+
def lookupHostname(self):
# can't look things up if they don't exist!
if not self.hostname or self.hostname == "localhost.localdomain":
@@ -630,9 +648,6 @@ class Network:

def copyConfigToPath(self, instPath='):

- if len(self.netdevices) == 0:
- return
-
# /etc/sysconfig/network-scripts/ifcfg-DEVICE
# /etc/sysconfig/network-scripts/keys-DEVICE
# /etc/dhcp/dhclient-DEVICE.conf
@@ -674,9 +689,6 @@ class Network:

devices = self.netdevices.values()

- if len(devices) == 0:
- return
-
# /etc/sysconfig/network-scripts/ifcfg-*
# /etc/sysconfig/network-scripts/keys-*
for dev in devices:
@@ -707,11 +719,11 @@ class Network:
else:
f.write("localhost.localdomain
")

- if dev.get('GATEWAY'):
- f.write("GATEWAY=%s
" % (dev.get('GATEWAY'),))
+ if self.gateway:
+ f.write("GATEWAY=%s
" % self.gateway)

- if dev.get('IPV6_DEFAULTGW'):
- f.write("IPV6_DEFAULTGW=%s
" % (dev.get('IPV6_DEFAULTGW'),))
+ if self.ipv6_defaultgw:
+ f.write("IPV6_DEFAULTGW=%s
" % self.ipv6_defaultgw)

f.close()
shutil.move(newnetwork, networkConfFile)
--
1.7.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 10-04-2010, 05:58 PM
Chris Lumens
 
Default Honor selected hostname on Live CD (#638634)

> for dev in self.netdevices.values():
> if dev.get('GATEWAY'):
> gw = dev.get('GATEWAY')

for dev in reversed(self.netdevices.values()):
if dev.get("GATEWAY"):
return dev.get("GATEWAY")

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 07:08 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org