Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for handling CalledProcessError in authconfig #179

Closed
wants to merge 1 commit into from

Conversation

Akasurde
Copy link
Member

@Akasurde Akasurde commented Oct 24, 2016

NIS configuration error should be hidden from user
while running ipa-client-install

Fixes https://fedorahosted.org/freeipa/ticket/5244

Signed-off-by: Abhijeet Kasurde akasurde@redhat.com

try:
ipautil.run([paths.AUTHCONFIG, "--savebackup", path])
except ipautil.CalledProcessError:
print("Failed to execute authconfig command")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can anyone suggestion, what should be more appropriate in place of print ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could try to raise ScriptError(msg) and check if it is properly handled and displayed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to see the error message returned from the process instead of a generic one.

It seem that ipautil.run can return this error message when capture_errors=True. See https://github.com/freeipa/freeipa/blob/master/ipapython/ipautil.py#L322 for the relevant code.

Copy link
Contributor

@tkrizek tkrizek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments inline.

try:
ipautil.run([paths.AUTHCONFIG, "--savebackup", path])
except ipautil.CalledProcessError:
print("Failed to execute authconfig command")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could try to raise ScriptError(msg) and check if it is properly handled and displayed.

try:
ipautil.run([paths.AUTHCONFIG, "--savebackup", path])
except ipautil.CalledProcessError:
print("Failed to execute authconfig command")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to see the error message returned from the process instead of a generic one.

It seem that ipautil.run can return this error message when capture_errors=True. See https://github.com/freeipa/freeipa/blob/master/ipapython/ipautil.py#L322 for the relevant code.

@tkrizek
Copy link
Contributor

tkrizek commented Jan 9, 2017

I investigated some other options for the displayed error message, but I haven't found anything more appropriate. Comment#4 in the ticket says the message should mention an SSSD restart issue. Perhaps someone else has a suggestion for a more descriptive message then Failed to execute authconfig command?

If this message is fine, the code has an ack.

@@ -2,7 +2,7 @@
# Alexander Bokovoy <abokovoy@redhat.com>
# Tomas Babej <tbabej@redhat.com>
#
# Copyright (C) 2007-2014 Red Hat
# Copyright (C) 2007-2016 Red Hat, Inc.
Copy link
Contributor

@stlaz stlaz Jan 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're changing licence, please change it to the new format (see, e.g., ipaclient/install/client.py) + add it to a new commit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@@ -3,6 +3,7 @@
# Tomas Babej <tbabej@redhat.com>
#
# Copyright (C) 2007-2014 Red Hat
# Copyright (C) 2016 FreeIPA Contributors
Copy link
Contributor

@tkrizek tkrizek Jan 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is how the license should look. I'd replace the entire wall of text with just the three lines with FreeIPA Contributors, but @stlaz would probably know for sure.

Anyway, this change should not be a part of the commit that addresses 5244. Either do not touch the license information, or update to it to the current format in a separate commit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomaskrizek Ok I will remove that copyright changes.

NIS configuration error should be hidden from user
while running ipa-client-install

Fixes https://fedorahosted.org/freeipa/ticket/5244

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
@Akasurde
Copy link
Member Author

@tomaskrizek Done.

@tkrizek
Copy link
Contributor

tkrizek commented Jan 17, 2017

Since there's been no suggestions for a more descriptive error message -> ack.

@tkrizek tkrizek added the ack Pull Request approved, can be merged label Jan 17, 2017
@martbab
Copy link
Contributor

martbab commented Jan 18, 2017

@martbab martbab added the pushed Pull Request has already been pushed label Jan 18, 2017
@martbab martbab closed this Jan 18, 2017
@Akasurde Akasurde deleted the tkt-5244 branch January 18, 2017 09:00
@Akasurde
Copy link
Member Author

@tomaskrizek @martbab Thanks for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, can be merged pushed Pull Request has already been pushed
Projects
None yet
4 participants