Re: [Freeipa-devel] [PATCH 0048] fix ipa help command output errors

2015-06-02 Thread Jan Cholasta

Dne 25.5.2015 v 14:27 Martin Basti napsal(a):

On 22/05/15 17:40, Gabe Alford wrote:

On Fri, May 22, 2015 at 9:01 AM, Martin Basti mba...@redhat.com
mailto: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



Thank you!
ACK and ACK.


Pushed to master: b98077ea6844eddd8810e4ae6ddd5bf40c61b58e

--
Jan Cholasta

--
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


Re: [Freeipa-devel] [PATCH 0048] fix ipa help command output errors

2015-05-25 Thread Martin Basti

On 22/05/15 17:40, Gabe Alford wrote:
On Fri, May 22, 2015 at 9:01 AM, Martin Basti mba...@redhat.com 
mailto: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




Thank you!
ACK and ACK.

--
Martin Basti

-- 
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

[Freeipa-devel] [PATCH 0048] fix ipa help command output errors

2015-05-22 Thread Gabe Alford
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
From 3d4e7b60287f30e70455facb0035fa30df913c34 Mon Sep 17 00:00:00 2001
From: Gabe redhatri...@gmail.com
Date: Fri, 22 May 2015 07:52:58 -0600
Subject: [PATCH] Fix ipa help command output errors

- Allow ipa help command to run when ipa-client-install is not configured
- Do not print traceback when pipe is broken

https://fedorahosted.org/freeipa/ticket/3584
https://fedorahosted.org/freeipa/ticket/2284
---
 ipalib/cli.py | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/ipalib/cli.py b/ipalib/cli.py
index fc6e2303919d4db724d97f839d9a1b71752dfc10..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):
@@ -1333,7 +1336,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

-- 
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

Re: [Freeipa-devel] [PATCH 0048] fix ipa help command output errors

2015-05-22 Thread Martin Basti

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)

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

Martin^2

--
Martin Basti

-- 
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

Re: [Freeipa-devel] [PATCH 0048] fix ipa help command output errors

2015-05-22 Thread Gabe Alford
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

Re: [Freeipa-devel] [PATCH 0048] fix ipa help command output errors

2015-05-22 Thread Martin Basti

On 22/05/15 17:40, Gabe Alford wrote:
On Fri, May 22, 2015 at 9:01 AM, Martin Basti mba...@redhat.com 
mailto: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
Oh sorry, I misread the exception there, I did read unicode error, I 
dont know why.

You are right.



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


Done

Martin^2

-- 
Martin Basti






--
Martin Basti

-- 
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