summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2013-01-09 18:09:10 +0100
committerRob Crittenden <rcritten@redhat.com>2013-02-19 11:08:11 -0500
commitcfbdeebe66c1759ba49da84a0a5d2acfc184e4f3 (patch)
tree44eb4d446ba67376be87ffab8b0dbac076efea79
parent1c68c3edff0507ee78cd1f633e45ae8c3fb9638d (diff)
downloadfreeipa-cfbdeebe66c1759ba49da84a0a5d2acfc184e4f3.tar.gz
freeipa-cfbdeebe66c1759ba49da84a0a5d2acfc184e4f3.tar.xz
freeipa-cfbdeebe66c1759ba49da84a0a5d2acfc184e4f3.zip
Run interactive_prompt callbacks after CSV values are split.
https://fedorahosted.org/freeipa/ticket/3334
-rw-r--r--ipalib/cli.py16
-rw-r--r--tests/test_cmdline/test_cli.py28
2 files changed, 36 insertions, 8 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index ca186c73..3d59e4a0 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -1045,6 +1045,14 @@ class cli(backend.Executioner):
if self.env.interactive:
self.prompt_interactively(cmd, kw)
kw = cmd.split_csv(**kw)
+ if self.env.interactive:
+ try:
+ callbacks = cmd.get_callbacks('interactive_prompt')
+ except AttributeError:
+ pass
+ else:
+ for callback in callbacks:
+ callback(cmd, kw)
kw['version'] = API_VERSION
self.load_files(cmd, kw)
return kw
@@ -1207,14 +1215,6 @@ class cli(backend.Executioner):
param.label, param.confirm
)
- try:
- callbacks = cmd.get_callbacks('interactive_prompt')
- except AttributeError:
- pass
- else:
- for callback in callbacks:
- callback(cmd, kw)
-
def load_files(self, cmd, kw):
"""
Load files from File parameters.
diff --git a/tests/test_cmdline/test_cli.py b/tests/test_cmdline/test_cli.py
index 06c6124b..4d730d58 100644
--- a/tests/test_cmdline/test_cli.py
+++ b/tests/test_cmdline/test_cli.py
@@ -237,3 +237,31 @@ class TestCLIParsing(object):
all=False,
force=False,
version=API_VERSION)
+
+ def test_dnsrecord_del_comma(self):
+ try:
+ self.run_command(
+ 'dnszone_add', idnsname=u'test-example.com',
+ idnssoamname=u'ns.test-example.com', force=True)
+ except errors.NotFound:
+ raise nose.SkipTest('DNS is not configured')
+ try:
+ self.run_command(
+ 'dnsrecord_add',
+ dnszoneidnsname=u'test-example.com',
+ idnsname=u'test',
+ txtrecord=u'"A pretty little problem," said Holmes.')
+ with self.fake_stdin('no\nyes\n'):
+ self.check_command(
+ 'dnsrecord_del test-example.com test',
+ 'dnsrecord_del',
+ dnszoneidnsname=u'test-example.com',
+ idnsname=u'test',
+ del_all=False,
+ txtrecord=[u'"A pretty little problem," said Holmes.'],
+ structured=False,
+ raw=False,
+ all=False,
+ version=API_VERSION)
+ finally:
+ self.run_command('dnszone_del', idnsname=u'test-example.com')