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

Add hostname attribute to machine object #474

Closed
xavpaice opened this issue Mar 12, 2021 · 5 comments · Fixed by #475
Closed

Add hostname attribute to machine object #474

xavpaice opened this issue Mar 12, 2021 · 5 comments · Fixed by #475

Comments

@xavpaice
Copy link

With juju/juju#12754 being merged, and in 2.8.10, I'd like to access this new information via libjuju. It would be great if we could have this available via machine.hostname, same as we can have machine.dns_name now.

@SimonRichardson
Copy link
Member

@achilleasa ping, how feasible is it to get that information. I'm assuming that it would require a separate call as that information isn't coming over via the AllWatcher.

@achilleasa
Copy link
Contributor

@SimonRichardson Not sure how this works in python-land. Does the AllWatcher simply marshal the entity and send it through? If that's the case, it should show up as a 'hostname' attribute on the machine model (we would just need a helper to check if it's there because this will only work on 2.8.10+; not yet ported to 2.9). Otherwise, we need to find where the dns_name attribute gets serialized and add hostname there as well.

@SimonRichardson
Copy link
Member

@achilleasa This is the underlying type that is sent via the AllWatcher. https://github.com/juju/juju/blob/develop/core/multiwatcher/types.go#L75-L102

@achilleasa
Copy link
Contributor

Hmmm... So I presume we get the Machine via another API call? https://github.com/juju/python-libjuju/blob/master/juju/machine.py#L178 (this one has dns_name as an attribute; do we populate this from FullStatus reponses?)

@SimonRichardson
Copy link
Member

It uses the following https://github.com/juju/python-libjuju/blob/master/juju/machine.py#L311 as a best guess.

jujubot added a commit that referenced this issue Mar 12, 2021
…hostname-field

#475

This allows users to access the hostname value reported by the machine
agent when it starts. This feature only works on 2.8.10+ controllers; in
all other cases (older controllers, machines with pending agents), the
property returns None.

Fixes #474 and works in conjunction with the changes from juju/juju#12760
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 a pull request may close this issue.

3 participants