[PATCH 1/2] Set hostname when leaving network spokes

Vratislav Podzimek vpodzime at redhat.com
Wed Sep 11 07:29:18 UTC 2013


On Tue, 2013-09-10 at 11:39 -0700, Brian C. Lane wrote:
> On Tue, Sep 10, 2013 at 11:56:55AM +0200, Vratislav Podzimek wrote:
> > Related: rhbz#972362
> > 
> > Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> > ---
> >  pyanaconda/ui/gui/spokes/network.py | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
> > index 43d12e1..2e80a3c 100644
> > --- a/pyanaconda/ui/gui/spokes/network.py
> > +++ b/pyanaconda/ui/gui/spokes/network.py
> > @@ -1275,6 +1275,10 @@ class NetworkSpoke(FirstbootSpokeMixIn, NormalSpoke):
> >          log.debug("network: apply ksdata %s", self.data.network)
> >          self.network_control_box.kill_nmce(msg="leaving network spoke")
> >  
> > +    def execute(self):
> > +        # update system's hostname
> > +        network.set_hostname(self.data.network.hostname)
> > +
> >      @property
> >      def completed(self):
> >          # TODO: check also if source requires updates when implemented
> > @@ -1436,6 +1440,10 @@ class NetworkStandaloneSpoke(StandaloneSpoke):
> >  
> >          self.network_control_box.kill_nmce(msg="leaving standalone network spoke")
> >  
> > +    def execute(self):
> > +        # update system's hostname
> > +        network.set_hostname(self.data.network.hostname)
> > +
> >      @property
> >      def completed(self):
> >          return (not can_touch_runtime_system("require network connection")
> > -- 
> > 1.7.11.7
> 
> I noticed that set_hostname is only blocking hostname setting on image
> installs. It also needs to make sure it doesn't set it for dirinstall
> since that could also be on a host not related to the target.
Yeah, I've noticed that too. Now we can simply use
can_touch_runtime_system with touch_live set to True. That will also
cover testing environment and whatever comes in the future. Maybe I
could look at flags.*install usage in general and replace it with
can_touch_runtime_system where possible.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list