[Freeipa-devel] [PATCH] 0008 Modify /etc/sysconfig/network on a client when IPA manages hostname

Martin Kosek mkosek at redhat.com
Fri Jul 29 14:29:31 UTC 2011


On Fri, 2011-07-29 at 17:06 +0300, Alexander Bokovoy wrote:
> On 29.07.2011 16:25, Martin Kosek wrote:
> > On Fri, 2011-07-29 at 16:05 +0300, Alexander Bokovoy wrote:
> >> On 29.07.2011 14:53, Alexander Bokovoy wrote:
> >>> On 29.07.2011 13:52, Martin Kosek wrote:
> >>>>>> Oh, this is not informative at all. I'll get this updated.
> >>>>> Updated patch attached.
> >>>> Ok, hostname is properly changed now. I still have some issues:
> >> Updated again to use more reliable regexp for parsing. Thanks to
> >> ConfParse project for inspiration
> >> (http://code.google.com/p/confparse/source/browse/trunk/confparse.py)
> >>
> > 
> > Hm, the new regex looks robust.
> > 
> > 1) But it didn't find hostname in my case:
> There was wrong comparison (I wanted to check if option is not None and
> then compare it to 'HOSTNAME' but brain short-circuited. My bad.
> 
> > # ipa-client-install --server=vm-059.idm.lab.bos.redhat.com
> > --domain=idm.lab.bos.redhat.com --hostname=foo.idm.lab.bos.redhat.com
> > ...
> > Client configuration complete.
> > 
> > No sysrestore.state was created, i.e. no hostname was backup-ed.
> > 
> > # ls /var/lib/ipa-client/sysrestore/
> > 688988a01b73872d-network    d35eec0a8128e435-krb5.conf
> > eada0d7ba116bfd7-sssd.conf
> > 9cf989cb60307725-ntp.conf   e4d8b217dfce5043-ntpd       sysrestore.index
> > 
> > IPA client then failed with an exception because we didn't have the
> > hostname:
> > 
> > # ipa-client-install --uninstall --unattended
> > Unenrolling client from IPA server
> > Removing Kerberos service principals from /etc/krb5.keytab
> > Disabling client Kerberos and LDAP configurations
> > Restoring client configuration files
> > Traceback (most recent call last):
> >   File "/usr/sbin/ipa-client-install", line 1071, in <module>
> >     sys.exit(main())
> >   File "/usr/sbin/ipa-client-install", line 737, in main
> >     return uninstall(options, env)
> >   File "/usr/sbin/ipa-client-install", line 245, in uninstall
> >     ipautil.run(['/bin/hostname', old_hostname])
> >   File "/usr/lib/python2.7/site-packages/ipapython/ipautil.py", line
> > 218, in run
> >     close_fds=True, env=env)
> >   File "/usr/lib64/python2.7/subprocess.py", line 672, in __init__
> >     errread, errwrite)
> >   File "/usr/lib64/python2.7/subprocess.py", line 1202, in
> > _execute_child
> >     raise child_exception
> > TypeError: coercing to Unicode: need string or buffer, NoneType found
> > 
> > There should be a check that if we don't have the hostname, we don't
> > restore it.
> Added both checks (it was there in uninstall but checking hostname
> instead of old_hostname).
> 

ACK. Before pushing, I just replaced constructs like "not var is None"
with "var is not None" - its more pythonic.

Pushed to master.

Martin




More information about the Freeipa-devel mailing list