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

Issue LIBCLOUD-471: Add Get Console Output #209

Closed
wants to merge 3 commits into from
Closed

Issue LIBCLOUD-471: Add Get Console Output #209

wants to merge 3 commits into from

Conversation

cderamus
Copy link
Contributor

No description provided.


response = self.connection.request(self.path, params=params).object

return {'instance_id': findattr(element=response,
Copy link
Member

Choose a reason for hiding this comment

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

Hm, you already need to have the instance id to retrieve the output (node.id) so I'm not sure how value does it add to return a dict here.

Unless timestamp is really crucial, I would prefer the method to directly return the console output (str).

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 would have a hard time arguing that it's crucial :). I actually just thought it would be a nicety to have available if someone wanted it. If you want me to make that change I certainly can do that.

Copy link
Member

Choose a reason for hiding this comment

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

After thinking about it some more, I actually think it would be useful to have access to timestamp here, so you should leave it as it is.

One use case I had in mind is determining if node is "stuck". If you have access to timestamp it makes it easier to do that. You can just periodically call this function and check if timestamp attribute has changed.

To make it more clear and useful, you should do two things:

  • Update the docstring and document which keys the return dict will always contain
  • Parse the timestamp and return a datetime object (libcloud.utils.iso8601.parse_date should do the trick)

@cderamus
Copy link
Contributor Author

Good to go!

@Kami
Copy link
Member

Kami commented Dec 26, 2013

I've made two changes and merged patch into trunk:

  1. Removed obsolete comment from the docstring and clarified which keys the returned dictionary contains. The docstring you have provided didn't help much because you would still need to check the code to see which keys the dictionary contains.
  2. Fixed test failure on Python 3.3. base64.b64decode returns bytes in Python 3 and you need to call .decode on it to get a string back.

@cderamus
Copy link
Contributor Author

Great, thanks!

@cderamus cderamus closed this Dec 26, 2013
@cderamus cderamus deleted the LIBCLOUD-471_Add_Get_Console_Output branch December 26, 2013 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants