[Freeipa-devel] [PATCH] 0025/0026 ipa-client-install --hostname not setting HOSTNAME if it is missing from the configuration file

Rob Crittenden rcritten at redhat.com
Wed Oct 12 13:32:00 UTC 2011


Alexander Bokovoy wrote:
> Hi,
>
> attached is a small refactoring that is pursuing two goals:
>   - fix https://fedorahosted.org/freeipa/ticket/1871
>    and
>   - prepare grounds for systemd integration
>
> As ticket 1871 is about cases when HOSTNAME is missing from
> /etc/sysconfig/network, this patch adds support to append
> HOSTNAME=<hostname>  when it is missing. However, it does a bit more --
> it introduces generic replacement/appending tool for key=value style
> configuration files.
>
> For all key=value pairs in replacevars, existing value of key will get
> replaced by a new one.
>
> For all key=value pairs in appendvars, existing value of key will me
> amended to also include new value.
>
> The latter is the case of configuring krb5kdc.
>
> Also, all keys totally missing from the config will be added. Values
> from replacevars and appendvars are merged before doing it so there is
> only single key=value pair afterwards. Obviously, it is the caller
> responsibility to not allow replacevars/appendvars have conflicting
> values.
>
> Patch 0025 introduces the common code and transforms
> ipapython.services.backup_and_replace_hostname()
>
> Patch 0026 uses this new code to change
> ipaserver/install/krb5instance.py to use new code.

Why should the caller be responsible for calling restore_context()?

I think:

if old_values['HOSTNAME']: ...

should be

if 'HOSTNAME' in old_values: ...

rob




More information about the Freeipa-devel mailing list