-
Notifications
You must be signed in to change notification settings - Fork 26
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
Added connection information to exceptions #1287
Conversation
51b0f2d
to
47f3b45
Compare
92c3a83
to
4933fb3
Compare
pywbem/exceptions.py
Outdated
the error happened. `None` if the error did not happen in context | ||
of any connection, or if the connection context was not known. | ||
|
||
:ivar args: A tuple (status, reason, cimerror, cimdetails) set from the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that the args doc moved moved up to HTTPError at the same time you inserted the super... However, I do not see where above this in the hierarchy the args actually gets set. I may be just missing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The args doc on HTTPError was missing, and adding it is a docs fix that is independent of all the other changes.
The args instance variable is set in the Python Exception class, and the previous implementation duplicated that into HTTPError (and into CIMError, fwiw). Now that our Error class has an init method, we can use the more logical approach of delegating that into the Python Exception class. Maybe that would have worked even without an init method in the Error class in between, but I never tried. In any case, the unit tests verify that the args instance variable is set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only made one comment when I sorted through it all and that was more a question than comment. I like the approach. It looks like most of this was really cleaning up messy code from before.
I approve this.
df6b617
to
6d00656
Compare
Hit one issue in doing "make clobber install check test" in the tests.
NOTE: I repeated the test on the latest master and hit same issue. ================================ However, for some reason it takes a very long time to go through the subscriptions and indications so that there is something I don't understand. When I say long time, I mean minutes instead of seconds. Further, the whole slowdown when we start the subscription processing. Note that this may not be part of this change since I retested with master and one time it operated at normal speed but on a later try it also slowed way down when the subscription tests started. I think I am going to have to dig issue probably tomorrow afternoon. I am going to continue testing. |
Simple tests with wbemcli worked fine. |
Details: * Fixed the incorrect use of cimerror in HTTPError as a CIMError exception. It is the CIMError HTTP header field, instead. * Made the testing for exception text generic, so that changes in the exception string representation do not affect the test result. This is testing the recorder module, after all. Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
Details: * Fixed an error in the httperror_args fixture where cimdetails was incorrectly specified as a string, when it needs to be a dict. * Added a test case with empty string to the simple_args fixture. * Simplified the access to the status_tuple fixture parameter. * Improved the description of all fixtures. Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
TODO: * Specify the connection in all pywbem exceptions that are raised. Details: * Added a keyword argument 'conn' to all pywbem exceptions, to pass the WBEMConnection object of the connection. Added two new properties to all pywbem exceptions: - A `conn` property of the connection object. - A `conn_str` property for the connection info string, for use in exception messages. * Extended the unit test cases in test_exceptions.py with a fixture for the 'conn' init argument, and with a new _assert_connection() method that verifies the connection information. Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
…istener Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
6d00656
to
52d186d
Compare
Karl, on your issue: The "check" and "test" targets depend on the "develop" target. If "develop" is not run, you can get these kinds of issues. Please try with "develop" before "check" and "test" and let me know whether the problem persists. |
Discussion points:
|
We agreed to add connection info to tupleparse. Karl will rerun tests again with clean virt env and be sure to make develop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marked approved. For some reason the problem I have in issue #1334 was not showing up in earlier tests but it bit me the last couple of days. Ran with that patch OK.
I am merging this and will add support for connection info in tupleparse in another PR. |
This PR addresses most of issue #1155. |
Just for the record: There were several misconceptions in what I stated further up in this PR:
The solution for adding connection info to the tupleparse (and tupletree) modules is to put the module-global functions into a new class that stores the connection ID as an instance attribute. The solution for tupletree is to add the connection ID as an additional optional argument to the three relevant functions of that module. |
Ready for review and merge.
What is needed for this PR, is a test on a life server.
The first three commits implement having the connection information in the pywbem exceptions, plus some preparatory changes. Each of these three commits is separate logical step and is best reviewed separately. They were part of the first review.
Compared to the first review, I had to change the connection information that is added to the pywbem exceptions, from adding the entire WBEMConnection object, to adding just the connection ID string. Reason was that in cim_http.py, the connection ID was available but not the connection object, and I did not want to change that there. This change in the exception classes (to take the connection ID string instead of the WBEMConnection object) is done in the fourth commit in this PR.
The fifth commit changes the places that raise pywbem exceptions to pass the connection ID to the exceptions, including some changes that were needed in support of that such as changing a static method to become an instance method.
The following pywbem exceptions that are raised do not get the connection ID passed as part of this PR: