Compare commits

..

No commits in common. "6ac1216ed8be5dcb06e9f0d9e28423d285bb183e" and "ade97bc90f88ae84cb1e46f5638e0525647194e8" have entirely different histories.

2 changed files with 4 additions and 20 deletions

View file

@ -649,12 +649,6 @@ class Config: # pylint: disable=too-many-instance-attributes
log.debug('get(%s, %s): %s (%s)', section, option, value, type(value))
return value
def get_option(self, option, default=None):
""" Get an argument parser option value """
if self.options and hasattr(self.options, option):
return getattr(self.options, option)
return default
def set(self, section, option, value):
""" Set option value """
assert self.config_parser, 'Unconfigured options parser'

View file

@ -369,16 +369,6 @@ class LdapClient:
return default
@property
def _just_try(self):
""" Check if just-try mode is enabled """
return self._get_option(
'just_try', default=(
self._config.get_option('just_try') if self._config
else False
)
)
def configure(self, comment=None, **kwargs):
""" Configure options on registered mylib.Config object """
assert self._config, "mylib.Config object not registered. Must be passed to __init__ as config keyword argument."
@ -707,7 +697,7 @@ class LdapClient:
for attr, values in attrs.items()
)
try:
if self._just_try:
if self._get_option('just_try', default=False):
log.debug('Just-try mode : do not really add object in LDAP')
return True
assert self._conn or self.initialize()
@ -776,7 +766,7 @@ class LdapClient:
log.debug('%s: No change detected on RDN attibute %s', ldap_obj['dn'], rdn_attr)
try:
if self._just_try:
if self._get_option('just_try', default=False):
log.debug('Just-try mode : do not really update object in LDAP')
return True
assert self._conn or self.initialize()
@ -802,7 +792,7 @@ class LdapClient:
:param new_dn_or_rdn: The new LDAP object's DN (or RDN)
"""
try:
if self._just_try:
if self._get_option('just_try', default=False):
log.debug('Just-try mode : do not really move object in LDAP')
return True
assert self._conn or self.initialize()
@ -821,7 +811,7 @@ class LdapClient:
:param ldap_obj: The original LDAP object to delete/drop
"""
try:
if self._just_try:
if self._get_option('just_try', default=False):
log.debug('Just-try mode : do not really drop object in LDAP')
return True
assert self._conn or self.initialize()