from pathlib2 import Path
# Third party modules
-from fb_tools.common import pp
+from fb_tools.common import pp, to_bool
from fb_tools.cfg_app import FbConfigApplication
from fb_tools.errors import FbAppError
# rom ..config.ldap import DEFAULT_PORT_LDAP, DEFAULT_PORT_LDAPS
from ..config.ldap import DEFAULT_TIMEOUT, MAX_TIMEOUT
-__version__ = '0.2.1'
+__version__ = '0.2.2'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
self._password_file = None
self.ldap_instances = []
+ self._yes = False
super(BaseLdapApplication, self).__init__(
appname=appname, verbose=verbose, version=version, base_dir=base_dir,
self._password_file = path
+ # -----------------------------------------------------------
+ @property
+ def yes(self):
+ """Assume 'yes' as an answer to all questions."""
+ return self._yes
+
+ @yes.setter
+ def yes(self, value):
+ self._yes = to_bool(value)
+
# -------------------------------------------------------------------------
def as_dict(self, short=True):
"""
res['show_cmdline_ldap_timeout'] = self.show_cmdline_ldap_timeout
res['use_default_ldap_connection'] = self.use_default_ldap_connection
res['use_multiple_ldap_connections'] = self.use_multiple_ldap_connections
+ res['yes'] = self.yes
return res
group_title = _('Options fo LDAP connections')
ldap_group = self.arg_parser.add_argument_group(group_title)
+ ldap_group.add_argument(
+ '-y', '--yes', '--assume-yes', action="store_true", dest="yes", help=argparse.SUPPRESS)
+
if self.use_default_ldap_connection:
ldap_host = LdapConfiguration.default_ldap_server
self._init_default_connection()
+ self.yes = self.args.yes
+
if self.use_default_ldap_connection:
self.ldap_instances = ['default']
return