summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipalib/cli.py6
-rw-r--r--ipalib/frontend.py2
-rw-r--r--tests/test_ipalib/test_frontend.py8
3 files changed, 10 insertions, 6 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index 1c7256a2a..909e2acbc 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -693,8 +693,10 @@ class CLI(object):
help=option.doc,
)
if isinstance(option.type, ipa_types.Bool):
- o.action = 'store_true'
- o.default = option.default
+ if option.default is True:
+ o.action = 'store_false'
+ else:
+ o.action = 'store_true'
o.type = None
parser.add_option(o)
return parser
diff --git a/ipalib/frontend.py b/ipalib/frontend.py
index 3ae143ef3..61cba513b 100644
--- a/ipalib/frontend.py
+++ b/ipalib/frontend.py
@@ -651,6 +651,8 @@ class Command(plugable.Plugin):
if kw.get(param.name, None) is None:
if param.required:
yield (param.name, param.get_default(**kw))
+ elif isinstance(param.type, ipa_types.Bool):
+ yield (param.name, param.default)
else:
yield (param.name, None)
diff --git a/tests/test_ipalib/test_frontend.py b/tests/test_ipalib/test_frontend.py
index 771fdb911..44d8e54cc 100644
--- a/tests/test_ipalib/test_frontend.py
+++ b/tests/test_ipalib/test_frontend.py
@@ -832,8 +832,8 @@ class test_LocalOrRemote(ClassChecker):
api.register(example)
api.finalize()
cmd = api.Command.example
- assert cmd() == ('execute', (None,), dict(server=None))
- assert cmd('var') == ('execute', (u'var',), dict(server=None))
+ assert cmd() == ('execute', (None,), dict(server=False))
+ assert cmd('var') == ('execute', (u'var',), dict(server=False))
assert cmd(server=True) == ('forward', (None,), dict(server=True))
assert cmd('var', server=True) == \
('forward', (u'var',), dict(server=True))
@@ -843,8 +843,8 @@ class test_LocalOrRemote(ClassChecker):
api.register(example)
api.finalize()
cmd = api.Command.example
- assert cmd() == ('execute', (None,), dict(server=None))
- assert cmd('var') == ('execute', (u'var',), dict(server=None))
+ assert cmd() == ('execute', (None,), dict(server=False))
+ assert cmd('var') == ('execute', (u'var',), dict(server=False))
assert cmd(server=True) == ('execute', (None,), dict(server=True))
assert cmd('var', server=True) == \
('execute', (u'var',), dict(server=True))