diff options
| author | Martin Basti <mbasti@redhat.com> | 2016-10-19 17:01:17 +0200 |
|---|---|---|
| committer | Jan Cholasta <jcholast@redhat.com> | 2016-11-11 12:13:56 +0100 |
| commit | 31a9ef4f8b8e2d6bb11f68ce34a7575ced9816aa (patch) | |
| tree | 8651cdb76ab85ec94621567907f4115febc90c41 /ipaclient/install | |
| parent | 1c9267803c6f41cc7d7485024f8864fbd62c9128 (diff) | |
| download | freeipa-31a9ef4f8b8e2d6bb11f68ce34a7575ced9816aa.tar.gz freeipa-31a9ef4f8b8e2d6bb11f68ce34a7575ced9816aa.tar.xz freeipa-31a9ef4f8b8e2d6bb11f68ce34a7575ced9816aa.zip | |
IPAChangeConf: use constant for empty line
Instead of copy&paste is better to use constant. It makes code shorter
and improves readability, saves resources.
https://fedorahosted.org/freeipa/ticket/6392
Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
Diffstat (limited to 'ipaclient/install')
| -rw-r--r-- | ipaclient/install/client.py | 105 |
1 files changed, 21 insertions, 84 deletions
diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py index 36280df8c..793bf6ec7 100644 --- a/ipaclient/install/client.py +++ b/ipaclient/install/client.py @@ -305,10 +305,7 @@ def configure_nsswitch_database(fstore, database, services, preserve=True, 'action': 'set', 'value': new_value }, - { - 'name': 'empty', - 'type': 'empty' - } + IPAChangeConf.EMPTY_LINE, ] conf.changeConf(paths.NSSWITCH_CONF, opts) @@ -327,10 +324,7 @@ def configure_ipa_conf( 'type': 'comment', 'value': 'File modified by ipa-client-install' }, - { - 'name': 'empty', - 'type': 'empty' - } + IPAChangeConf.EMPTY_LINE, ] # [global] @@ -379,10 +373,7 @@ def configure_ipa_conf( 'type': 'section', 'value': defopts }, - { - 'name': 'empty', - 'type': 'empty' - } + IPAChangeConf.EMPTY_LINE, ]) target_fname = paths.IPA_DEFAULT_CONF @@ -416,10 +407,7 @@ def configure_ldap_conf( 'type': 'comment', 'value': 'File modified by ipa-client-install' }, - { - 'name': 'empty', - 'type': 'empty' - }, + IPAChangeConf.EMPTY_LINE, { 'name': 'ldap_version', 'type': 'option', @@ -430,10 +418,7 @@ def configure_ldap_conf( 'type': 'option', 'value': cli_basedn }, - { - 'name': 'empty', - 'type': 'empty' - }, + IPAChangeConf.EMPTY_LINE, { 'name': 'nss_base_passwd', 'type': 'option', @@ -463,10 +448,7 @@ def configure_ldap_conf( 'type': 'option', 'value': 'root,dirsrv' }, - { - 'name': 'empty', - 'type': 'empty' - }, + IPAChangeConf.EMPTY_LINE, { 'name': 'nss_reconnect_maxsleeptime', 'type': 'option', @@ -487,10 +469,7 @@ def configure_ldap_conf( 'type': 'option', 'value': '15' }, - { - 'name': 'empty', - 'type': 'empty' - } + IPAChangeConf.EMPTY_LINE, ] if not dnsok or options.force or options.on_master: if options.on_master: @@ -513,10 +492,7 @@ def configure_ldap_conf( 'value': cli_domain }) - opts.append({ - 'name': 'empty', - 'type': 'empty' - }) + opts.append(IPAChangeConf.EMPTY_LINE) # Depending on the release and distribution this may exist in any # number of different file names, update what we find @@ -546,10 +522,7 @@ def configure_nslcd_conf( 'type': 'comment', 'value': 'File modified by ipa-client-install' }, - { - 'name': 'empty', - 'type': 'empty' - }, + IPAChangeConf.EMPTY_LINE, { 'name': 'ldap_version', 'type': 'option', @@ -560,10 +533,7 @@ def configure_nslcd_conf( 'type': 'option', 'value': cli_basedn }, - { - 'name': 'empty', - 'type': 'empty' - }, + IPAChangeConf.EMPTY_LINE, { 'name': 'base passwd', 'type': 'option', @@ -581,10 +551,7 @@ def configure_nslcd_conf( 'type': 'option', 'value': '15' }, - { - 'name': 'empty', - 'type': 'empty' - } + IPAChangeConf.EMPTY_LINE, ] if not dnsok or options.force or options.on_master: @@ -608,10 +575,7 @@ def configure_nslcd_conf( 'value': 'DNS' }) - opts.append({ - 'name': 'empty', - 'type': 'empty' - }) + opts.append(IPAChangeConf.EMPTY_LINE) for filename in files: try: @@ -653,10 +617,7 @@ def configure_openldap_conf(fstore, cli_basedn, cli_server): 'type': 'comment', 'value': ' File modified by ipa-client-install' }, - { - 'name': 'empty', - 'type': 'empty' - }, + IPAChangeConf.EMPTY_LINE, { 'name': 'comment', 'type': 'comment', @@ -698,14 +659,8 @@ def configure_openldap_conf(fstore, cli_basedn, cli_server): 'type': 'comment', 'value': ' corresponding lines generated by IPA.' }, - { - 'name': 'empty', - 'type': 'empty' - }, - { - 'name': 'empty', - 'type': 'empty' - }, + IPAChangeConf.EMPTY_LINE, + IPAChangeConf.EMPTY_LINE, { 'action': 'addifnotset', 'name': 'URI', @@ -767,10 +722,7 @@ def hardcode_ldap_server(cli_server): 'action': 'set', 'value': 'ldap://{}'.format(ipautil.format_netloc(cli_server[0])) }, - { - 'name': 'empty', - 'type': 'empty' - } + IPAChangeConf.EMPTY_LINE, ] # Errors raised by this should be caught by the caller @@ -796,10 +748,7 @@ def configure_krb5_conf( 'type': 'comment', 'value': 'File modified by ipa-client-install' }, - { - 'name': 'empty', - 'type': 'empty' - }, + IPAChangeConf.EMPTY_LINE, { 'name': 'includedir', 'type': 'option', @@ -817,10 +766,7 @@ def configure_krb5_conf( 'value': paths.SSSD_PUBCONF_KRB5_INCLUDE_D_DIR, 'delim': ' ' }, - { - 'name': 'empty', - 'type': 'empty' - } + IPAChangeConf.EMPTY_LINE, ]) # [libdefaults] @@ -895,10 +841,7 @@ def configure_krb5_conf( 'type': 'section', 'value': libopts }, - { - 'name': 'empty', - 'type': 'empty' - } + IPAChangeConf.EMPTY_LINE, ]) # the following are necessary only if DNS discovery does not work @@ -953,10 +896,7 @@ def configure_krb5_conf( 'type': 'section', 'value': ropts }, - { - 'name': 'empty', - 'type': 'empty' - } + IPAChangeConf.EMPTY_LINE, ]) # [domain_realm] @@ -999,10 +939,7 @@ def configure_krb5_conf( 'type': 'section', 'value': dropts }, - { - 'name': 'empty', - 'type': 'empty' - } + IPAChangeConf.EMPTY_LINE, ]) root_logger.debug("Writing Kerberos configuration to %s:", filename) |
