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

mgr/dashboard: fix dashboard python 3 support #21007

Merged
merged 1 commit into from Mar 26, 2018

Conversation

rjfd
Copy link
Contributor

@rjfd rjfd commented Mar 22, 2018

This PR fixes the problems found while running the dashboard in a python 3 only environment.

Signed-off-by: Ricardo Dias rdias@suse.com

@rjfd
Copy link
Contributor Author

rjfd commented Mar 22, 2018

PR #21006 is also fixing issues found while testing dashboard in python 3. Therefore, dashboard should be working in python 3 after this and #21006 is merged.

return self._resp.json()
except ValueError as ex:
log.error("response: %s", self._resp.text)
log.exception("Failed to decode response: %s", str(ex))
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need to add str(ex) to log.exception. it does that automatically. I'd use

log.exception("Failed to decode response: %s", self._resp.text)

instead.

Also, you're silently returning None here, Can we re-throw the exception here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed as you suggested

@@ -76,6 +76,7 @@ def _rbd_list(self, pool_name):
features = i.features()
stat['features'] = features
stat['features_name'] = self._format_bitmask(features)
stat['parent_name'] = stat['parent_name'].decode('utf8')
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting. this seems like a problem of the rbd python binding to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point! will check rbd python binding implementation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I checked the rbd python binding implementation and the parent_name and parent_pool are already deprecated, so I changed the code to remove those two keys from the dictionary.

Signed-off-by: Ricardo Dias <rdias@suse.com>
@rjfd
Copy link
Contributor Author

rjfd commented Mar 23, 2018

Copy link
Contributor

@sebastian-philipp sebastian-philipp left a comment

Choose a reason for hiding this comment

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

hard to test, but code looks resonable

@sebastian-philipp
Copy link
Contributor

while testing this, I ran into #21021

@rjfd rjfd merged commit a392e61 into ceph:master Mar 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants