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

Have the apiserver watcher code translate unset application status. #11846

Merged
merged 1 commit into from Jul 21, 2020

Conversation

howbazaar
Copy link
Contributor

@howbazaar howbazaar commented Jul 21, 2020

If an application status hasn't been explicitly set by a unit its status
is derived from the units themselves. This derivation code was moved into
the model cache, but the all watcher translation later itself was overlooked.

This branch uses the cached controller information to determine the application
status if it is Unset, like the status code does.

There were no tests around the all watcher code on the apiserver side,
so added some to test the conversion behaviour.

QA steps

juju bootstrap lxd test
juju deploy ~jameinel/ubuntu-lite ubuntu
juju db # using juju-db plugin to get mongo prompt
db.statuses.find().pretty()
# check for _id: <uuid>:a#ubuntu
#        "status" : "unset",
# run pylibjuju example to look at the watcher
tox -e example -- examples/allwatcher.py 
# will see a line like:
['application', 'change', {'model-uuid': '11252a44-d946-4305-8292-a650cfa4b138', 'name': 'ubuntu', 'exposed': False, 'charm-url': 'cs:~jameinel/ubuntu-lite-7', 'owner-tag': '', 'life': 'alive', 'min-units': 0, 'constraints': {}, 'subordinate': False, 'status': {'current': 'waiting', 'message': 'waiting for machine', 'since': '2020-07-21T05:42:48.050629314Z', 'version': ''}, 'workload-version': ''}]
# confirm that status isn't 'unset'

If an application status hasn't been explicitly set by a unit its status
is derived from the units themselves. This derivation code was moved into
the model cache, but the all watcher translation later itself was overlooked.

This branch uses the cached controller information to determine the application
status if it is Unset, like the status code does.

There were no tests around the all watcher code on the apiserver side,
so added some to test the conversion behaviour.
Copy link
Member

@SimonRichardson SimonRichardson left a comment

Choose a reason for hiding this comment

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

Looks good to me, and Q&A worked as well. I am wondering what we should do with pylibjuju code that I added?

@howbazaar
Copy link
Contributor Author

$$merge$$

@jujubot jujubot merged commit 2bf2712 into juju:2.8 Jul 21, 2020
jujubot added a commit that referenced this pull request Jul 22, 2020
#11852

Zero-conflict merge from 2.8 to bring forward:
- #11851 from manadart/2.8-remove-lld-refcount
- #11846 from howbazaar/2.8-watch-models-application-status
- #11840 from ycliuhw/fix/lp-1875481
- #11845 from ycliuhw/fix/lp-1883006
- #11844 from SimonRichardson/fix-smoke-tests
- #11837 from tlm/pod-spec-json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants