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

ceph-disk: include output of failed command in exception #20497

Merged
merged 1 commit into from Feb 24, 2018

Conversation

tchaikov
Copy link
Contributor

Signed-off-by: Kefu Chai kchai@redhat.com

Signed-off-by: Kefu Chai <kchai@redhat.com>
@tchaikov
Copy link
Contributor Author

@@ -1251,7 +1251,7 @@ def get_conf_with_default(cluster, variable):
except subprocess.CalledProcessError as e:
raise Error(
'getting variable from configuration failed',
e,
e, e.output,
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks OK, but what if the CalledProcessError is not coming from the modified one from _check_output and it is really coming from subprocess ? You wouldn't get the output that gets slapped there. Maybe a getattr(e, 'output', '') ?

Copy link
Contributor Author

@tchaikov tchaikov Feb 22, 2018

Choose a reason for hiding this comment

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

@alfredodeza, CalledProcessError is raised by subprocess.check_call(), subprocess.check_output() and subprocess.CompletedProcess.check_returncode(). it won't be raised by subprocess.Popen 's constructor or subprocess.Popen.communicate(). i double checked the document and the source of py2.7 and py3.6.

Copy link
Contributor

Choose a reason for hiding this comment

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

Man is this difficult to follow. You are right, the command() is calling Popen.

@wjwithagen
Copy link
Contributor

The most common thing is indeed to see what the forked command reports...
The second most common problem I had during testing: command not found. Either because of a different location, of just because FreeBSD did not have that command.
So as long as that second case is also reported, I'm all in favour.

@tchaikov tchaikov merged commit 7a94412 into ceph:master Feb 24, 2018
@tchaikov tchaikov deleted the wip-ceph-disk-cmd-failure branch February 24, 2018 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants