mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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>
This commit is contained in:
parent
1c9267803c
commit
31a9ef4f8b
@ -305,10 +305,7 @@ def configure_nsswitch_database(fstore, database, services, preserve=True,
|
|||||||
'action': 'set',
|
'action': 'set',
|
||||||
'value': new_value
|
'value': new_value
|
||||||
},
|
},
|
||||||
{
|
IPAChangeConf.EMPTY_LINE,
|
||||||
'name': 'empty',
|
|
||||||
'type': 'empty'
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
|
|
||||||
conf.changeConf(paths.NSSWITCH_CONF, opts)
|
conf.changeConf(paths.NSSWITCH_CONF, opts)
|
||||||
@ -327,10 +324,7 @@ def configure_ipa_conf(
|
|||||||
'type': 'comment',
|
'type': 'comment',
|
||||||
'value': 'File modified by ipa-client-install'
|
'value': 'File modified by ipa-client-install'
|
||||||
},
|
},
|
||||||
{
|
IPAChangeConf.EMPTY_LINE,
|
||||||
'name': 'empty',
|
|
||||||
'type': 'empty'
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# [global]
|
# [global]
|
||||||
@ -379,10 +373,7 @@ def configure_ipa_conf(
|
|||||||
'type': 'section',
|
'type': 'section',
|
||||||
'value': defopts
|
'value': defopts
|
||||||
},
|
},
|
||||||
{
|
IPAChangeConf.EMPTY_LINE,
|
||||||
'name': 'empty',
|
|
||||||
'type': 'empty'
|
|
||||||
}
|
|
||||||
])
|
])
|
||||||
|
|
||||||
target_fname = paths.IPA_DEFAULT_CONF
|
target_fname = paths.IPA_DEFAULT_CONF
|
||||||
@ -416,10 +407,7 @@ def configure_ldap_conf(
|
|||||||
'type': 'comment',
|
'type': 'comment',
|
||||||
'value': 'File modified by ipa-client-install'
|
'value': 'File modified by ipa-client-install'
|
||||||
},
|
},
|
||||||
{
|
IPAChangeConf.EMPTY_LINE,
|
||||||
'name': 'empty',
|
|
||||||
'type': 'empty'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'name': 'ldap_version',
|
'name': 'ldap_version',
|
||||||
'type': 'option',
|
'type': 'option',
|
||||||
@ -430,10 +418,7 @@ def configure_ldap_conf(
|
|||||||
'type': 'option',
|
'type': 'option',
|
||||||
'value': cli_basedn
|
'value': cli_basedn
|
||||||
},
|
},
|
||||||
{
|
IPAChangeConf.EMPTY_LINE,
|
||||||
'name': 'empty',
|
|
||||||
'type': 'empty'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'name': 'nss_base_passwd',
|
'name': 'nss_base_passwd',
|
||||||
'type': 'option',
|
'type': 'option',
|
||||||
@ -463,10 +448,7 @@ def configure_ldap_conf(
|
|||||||
'type': 'option',
|
'type': 'option',
|
||||||
'value': 'root,dirsrv'
|
'value': 'root,dirsrv'
|
||||||
},
|
},
|
||||||
{
|
IPAChangeConf.EMPTY_LINE,
|
||||||
'name': 'empty',
|
|
||||||
'type': 'empty'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'name': 'nss_reconnect_maxsleeptime',
|
'name': 'nss_reconnect_maxsleeptime',
|
||||||
'type': 'option',
|
'type': 'option',
|
||||||
@ -487,10 +469,7 @@ def configure_ldap_conf(
|
|||||||
'type': 'option',
|
'type': 'option',
|
||||||
'value': '15'
|
'value': '15'
|
||||||
},
|
},
|
||||||
{
|
IPAChangeConf.EMPTY_LINE,
|
||||||
'name': 'empty',
|
|
||||||
'type': 'empty'
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
if not dnsok or options.force or options.on_master:
|
if not dnsok or options.force or options.on_master:
|
||||||
if options.on_master:
|
if options.on_master:
|
||||||
@ -513,10 +492,7 @@ def configure_ldap_conf(
|
|||||||
'value': cli_domain
|
'value': cli_domain
|
||||||
})
|
})
|
||||||
|
|
||||||
opts.append({
|
opts.append(IPAChangeConf.EMPTY_LINE)
|
||||||
'name': 'empty',
|
|
||||||
'type': 'empty'
|
|
||||||
})
|
|
||||||
|
|
||||||
# Depending on the release and distribution this may exist in any
|
# Depending on the release and distribution this may exist in any
|
||||||
# number of different file names, update what we find
|
# number of different file names, update what we find
|
||||||
@ -546,10 +522,7 @@ def configure_nslcd_conf(
|
|||||||
'type': 'comment',
|
'type': 'comment',
|
||||||
'value': 'File modified by ipa-client-install'
|
'value': 'File modified by ipa-client-install'
|
||||||
},
|
},
|
||||||
{
|
IPAChangeConf.EMPTY_LINE,
|
||||||
'name': 'empty',
|
|
||||||
'type': 'empty'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'name': 'ldap_version',
|
'name': 'ldap_version',
|
||||||
'type': 'option',
|
'type': 'option',
|
||||||
@ -560,10 +533,7 @@ def configure_nslcd_conf(
|
|||||||
'type': 'option',
|
'type': 'option',
|
||||||
'value': cli_basedn
|
'value': cli_basedn
|
||||||
},
|
},
|
||||||
{
|
IPAChangeConf.EMPTY_LINE,
|
||||||
'name': 'empty',
|
|
||||||
'type': 'empty'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'name': 'base passwd',
|
'name': 'base passwd',
|
||||||
'type': 'option',
|
'type': 'option',
|
||||||
@ -581,10 +551,7 @@ def configure_nslcd_conf(
|
|||||||
'type': 'option',
|
'type': 'option',
|
||||||
'value': '15'
|
'value': '15'
|
||||||
},
|
},
|
||||||
{
|
IPAChangeConf.EMPTY_LINE,
|
||||||
'name': 'empty',
|
|
||||||
'type': 'empty'
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
|
|
||||||
if not dnsok or options.force or options.on_master:
|
if not dnsok or options.force or options.on_master:
|
||||||
@ -608,10 +575,7 @@ def configure_nslcd_conf(
|
|||||||
'value': 'DNS'
|
'value': 'DNS'
|
||||||
})
|
})
|
||||||
|
|
||||||
opts.append({
|
opts.append(IPAChangeConf.EMPTY_LINE)
|
||||||
'name': 'empty',
|
|
||||||
'type': 'empty'
|
|
||||||
})
|
|
||||||
|
|
||||||
for filename in files:
|
for filename in files:
|
||||||
try:
|
try:
|
||||||
@ -653,10 +617,7 @@ def configure_openldap_conf(fstore, cli_basedn, cli_server):
|
|||||||
'type': 'comment',
|
'type': 'comment',
|
||||||
'value': ' File modified by ipa-client-install'
|
'value': ' File modified by ipa-client-install'
|
||||||
},
|
},
|
||||||
{
|
IPAChangeConf.EMPTY_LINE,
|
||||||
'name': 'empty',
|
|
||||||
'type': 'empty'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'name': 'comment',
|
'name': 'comment',
|
||||||
'type': 'comment',
|
'type': 'comment',
|
||||||
@ -698,14 +659,8 @@ def configure_openldap_conf(fstore, cli_basedn, cli_server):
|
|||||||
'type': 'comment',
|
'type': 'comment',
|
||||||
'value': ' corresponding lines generated by IPA.'
|
'value': ' corresponding lines generated by IPA.'
|
||||||
},
|
},
|
||||||
{
|
IPAChangeConf.EMPTY_LINE,
|
||||||
'name': 'empty',
|
IPAChangeConf.EMPTY_LINE,
|
||||||
'type': 'empty'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': 'empty',
|
|
||||||
'type': 'empty'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'action': 'addifnotset',
|
'action': 'addifnotset',
|
||||||
'name': 'URI',
|
'name': 'URI',
|
||||||
@ -767,10 +722,7 @@ def hardcode_ldap_server(cli_server):
|
|||||||
'action': 'set',
|
'action': 'set',
|
||||||
'value': 'ldap://{}'.format(ipautil.format_netloc(cli_server[0]))
|
'value': 'ldap://{}'.format(ipautil.format_netloc(cli_server[0]))
|
||||||
},
|
},
|
||||||
{
|
IPAChangeConf.EMPTY_LINE,
|
||||||
'name': 'empty',
|
|
||||||
'type': 'empty'
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# Errors raised by this should be caught by the caller
|
# Errors raised by this should be caught by the caller
|
||||||
@ -796,10 +748,7 @@ def configure_krb5_conf(
|
|||||||
'type': 'comment',
|
'type': 'comment',
|
||||||
'value': 'File modified by ipa-client-install'
|
'value': 'File modified by ipa-client-install'
|
||||||
},
|
},
|
||||||
{
|
IPAChangeConf.EMPTY_LINE,
|
||||||
'name': 'empty',
|
|
||||||
'type': 'empty'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'name': 'includedir',
|
'name': 'includedir',
|
||||||
'type': 'option',
|
'type': 'option',
|
||||||
@ -817,10 +766,7 @@ def configure_krb5_conf(
|
|||||||
'value': paths.SSSD_PUBCONF_KRB5_INCLUDE_D_DIR,
|
'value': paths.SSSD_PUBCONF_KRB5_INCLUDE_D_DIR,
|
||||||
'delim': ' '
|
'delim': ' '
|
||||||
},
|
},
|
||||||
{
|
IPAChangeConf.EMPTY_LINE,
|
||||||
'name': 'empty',
|
|
||||||
'type': 'empty'
|
|
||||||
}
|
|
||||||
])
|
])
|
||||||
|
|
||||||
# [libdefaults]
|
# [libdefaults]
|
||||||
@ -895,10 +841,7 @@ def configure_krb5_conf(
|
|||||||
'type': 'section',
|
'type': 'section',
|
||||||
'value': libopts
|
'value': libopts
|
||||||
},
|
},
|
||||||
{
|
IPAChangeConf.EMPTY_LINE,
|
||||||
'name': 'empty',
|
|
||||||
'type': 'empty'
|
|
||||||
}
|
|
||||||
])
|
])
|
||||||
|
|
||||||
# the following are necessary only if DNS discovery does not work
|
# the following are necessary only if DNS discovery does not work
|
||||||
@ -953,10 +896,7 @@ def configure_krb5_conf(
|
|||||||
'type': 'section',
|
'type': 'section',
|
||||||
'value': ropts
|
'value': ropts
|
||||||
},
|
},
|
||||||
{
|
IPAChangeConf.EMPTY_LINE,
|
||||||
'name': 'empty',
|
|
||||||
'type': 'empty'
|
|
||||||
}
|
|
||||||
])
|
])
|
||||||
|
|
||||||
# [domain_realm]
|
# [domain_realm]
|
||||||
@ -999,10 +939,7 @@ def configure_krb5_conf(
|
|||||||
'type': 'section',
|
'type': 'section',
|
||||||
'value': dropts
|
'value': dropts
|
||||||
},
|
},
|
||||||
{
|
IPAChangeConf.EMPTY_LINE,
|
||||||
'name': 'empty',
|
|
||||||
'type': 'empty'
|
|
||||||
}
|
|
||||||
])
|
])
|
||||||
|
|
||||||
root_logger.debug("Writing Kerberos configuration to %s:", filename)
|
root_logger.debug("Writing Kerberos configuration to %s:", filename)
|
||||||
|
@ -50,6 +50,11 @@ def openLocked(filename, perms):
|
|||||||
#TODO: add a comment all but provided options as a section option
|
#TODO: add a comment all but provided options as a section option
|
||||||
class IPAChangeConf(object):
|
class IPAChangeConf(object):
|
||||||
|
|
||||||
|
EMPTY_LINE = {
|
||||||
|
'name': 'empty',
|
||||||
|
'type': 'empty'
|
||||||
|
}
|
||||||
|
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
self.progname = name
|
self.progname = name
|
||||||
self.indent = ("", "", "")
|
self.indent = ("", "", "")
|
||||||
|
Loading…
Reference in New Issue
Block a user