On Fri, May 22, 2015 at 9:01 AM, Martin Basti <mba...@redhat.com> wrote:

>  On 22/05/15 16:08, Gabe Alford wrote:
>
>  Hello,
>
>  This should fix https://fedorahosted.org/freeipa/ticket/3584, and as
> requested in the ticket, this should also fix
> https://fedorahosted.org/freeipa/ticket/2284
>
>  Thanks,
>
>  Gabe
>
>
>  Thank you!
>
> IMO your first part of fix only mask issue, not solving it.
>
> This could be way, but I did not test it.
>
>             out_encoding = getattr(outfile, 'encoding', None)
>             if out_encoding is None:
>                 out_encoding = 'utf-8'
>             print >> outfile,  unicode(string).encode(out_encoding)
>

I'm confused and maybe missing something here. If I run `ipa help dns |
bad_command`, shouldn't the command fail with only the following?

-bash: bad: command not found



>
> Can you split this patch into 2 separate patches for each ticket please?
>

Done


> Martin^2
>
> --
> Martin Basti
>
>
From bea5786dbf6363c6bae541c347b3dd98d7dc23bd Mon Sep 17 00:00:00 2001
From: Gabe <redhatri...@gmail.com>
Date: Fri, 22 May 2015 09:19:03 -0600
Subject: [PATCH] Allow ipa help command to run when ipa-client-install is not
 configured

https://fedorahosted.org/freeipa/ticket/3584
---
 ipalib/cli.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipalib/cli.py b/ipalib/cli.py
index fc6e2303919d4db724d97f839d9a1b71752dfc10..398b5486339ad6930b7b11a53a2b7e6d90903371 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -1333,7 +1333,7 @@ def run(api):
             api.register(klass)
         api.load_plugins()
         api.finalize()
-        if not 'config_loaded' in api.env:
+        if not 'config_loaded' in api.env and not 'help' in argv:
             raise NotConfiguredError()
         sys.exit(api.Backend.cli.run(argv))
     except KeyboardInterrupt:
-- 
1.8.3.1

From 7b12c4a2818e776f48045eca51027fd5f6df6286 Mon Sep 17 00:00:00 2001
From: Gabe <redhatri...@gmail.com>
Date: Fri, 22 May 2015 09:25:08 -0600
Subject: [PATCH] Do not print traceback when pipe is broken

https://fedorahosted.org/freeipa/ticket/2284
---
 ipalib/cli.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ipalib/cli.py b/ipalib/cli.py
index 398b5486339ad6930b7b11a53a2b7e6d90903371..52529ea02c35a8119a5fb2397d7302d170e81526 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -799,7 +799,10 @@ class help(frontend.Local):
 
     def _writer(self, outfile):
         def writer(string=''):
-            print >> outfile, unicode(string)
+            try:
+                print >> outfile, unicode(string)
+            except IOError:
+                pass
         return writer
 
     def print_topics(self, outfile):
-- 
1.8.3.1

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to