diff options
author | Alexander Bokovoy <abokovoy@redhat.com> | 2011-10-12 16:42:09 +0300 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2011-10-11 18:21:41 -0400 |
commit | 8badce286f9e50384b68e0f5e77e314fd48363db (patch) | |
tree | 8f065a02331b8c55db197619f18f602cbcd25946 /ipaserver/install | |
parent | 5c10f66e4abd35dc24fe65d5916e429bee221093 (diff) | |
download | freeipa-8badce286f9e50384b68e0f5e77e314fd48363db.tar.gz freeipa-8badce286f9e50384b68e0f5e77e314fd48363db.tar.xz freeipa-8badce286f9e50384b68e0f5e77e314fd48363db.zip |
Refactor backup_and_replace_hostname() into a flexible config modification tool
backup_and_replace_hostname() was doing three things:
1. Given config file in 'key=value' style, replace value for a
specified key (HOSTNAME)
2. Backup original file and install a replacement
3. Restore original security context after editing
We have several more places where parts of the functionality are needed,
thus making two tools in ipapython.ipautil:
1. config_replace_variables(filepath, replacevars=dict(),
appendvars=dict())
Replaces or appends values to specified keys, adding new key=value
pairs if key was absent
2. backup_config_and_replace_variables(fstore, filepath,
replacevars=dict(),
appendvars=dict())
Backups config file and calls config_replace_variables()
A caller must handle security context after using these two tools.
In addition, as before, there is
ipapython.services.backup_and_replace_hostname() that uses
these common tools and restores security context after editing.
The code will be used extensively for systemd integration for Fedora 16.
Fixes:
https://fedorahosted.org/freeipa/ticket/1871
Diffstat (limited to 'ipaserver/install')
0 files changed, 0 insertions, 0 deletions