Description of change
The following PR ensures that we set the info.status before performing a store update if the old info is not nil. In other words, we need to reuse the data from the old info and set it on the new info which we'll be saving.
The reason for the tests changes, is now that we have the old data we don't need to save any changes if the data is the same.
This has been tested with pylibjuju and the status changes are now populated from the start, allowing you to monitor the changes of a charm.
QA steps
Unfortunately there is some work to test this out and requires pylibjuju for the quickest turn around...
Checkout 2.6 branch and bootstrap.
sh
git checkout 2.6
juju bootstrap lxd test --no-gui --build-agent
watch --color -n 1 juju status --color
Setup pylibjuju and apply the following changes to pylibjuju example/deploy_bundle.py: print-diff.txt It requires quite a large bundle to trigger this, so for me a very basic openstack did this.
sh
tox -e example -- examples/deploy_bundle.py
Notice how some status fields in the print output will be empty and has no "since" field:
json
"status": {"version": "", "current": "", "message": ""}
To verify the patch, check this branch out and bootstrap:
sh
juju bootstrap lxd tester --no-gui --build-agent
watch --color -n 1 juju status --color
Then run the pylibjuju example again, with the diff applied:
sh
tox -e example -- examples/deploy_bundle.py
The output should be:
json
"status": {"since": "2019-09-10T13:23:44.99699161Z", "version": "", "current": "waiting", "message": "waiting for machine"}
该提问来源于开源项目:juju/juju