'juju status MACHINE" fails if any unit is not assigned to a machine
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Canonical Juju |
Fix Released
|
High
|
Anastasia | ||
2.3 |
Fix Released
|
High
|
Anastasia |
Bug Description
If you manage to mess up deploying a unit (say targeting a machine that doesn't exist yet), you can break 'juju status FILTER'.
Steps to reproduce:
juju bootstrap
juju deploy cs:~jameinel/
juju add-unit ul --to 2 # no such machine
At this point, 'juju status' will show you something like:
ul/11 waiting allocating waiting for machine
However, trying to get information about an unrelated machine:
juju status 0
ERROR could not filter units: could not filter units: unit "ul/11" has no assigned machine: unit "ul/11" is not assigned to a machine (not assigned)
Oddly enough, if a machine isn't in the list:
$ juju status waiting
Model Controller Cloud/Region Version SLA
model-1 lxd lxd 2.2-beta3.1 unsupported
App Version Status Scale Charm Store Rev OS Notes
ul waiting 0/1 ubuntu-lite jujucharms 6 ubuntu
Unit Workload Agent Machine Public address Ports Message
ul/11 waiting allocating waiting for machine
Machine State DNS Inst id Series AZ Message
I think its perfectly valid for a unit that is not assigned to a machine to just be omitted if you are filtering wrt a machine (it isn't on *that* machine, is it). It certainly shouldn't prevent seeing other information about the machine you are looking at.
Changed in juju: | |
status: | Triaged → In Progress |
assignee: | nobody → Anastasia (anastasia-macmood) |
milestone: | none → 2.4-beta3 |
Changed in juju: | |
status: | In Progress → Fix Committed |
Changed in juju: | |
status: | Fix Committed → Fix Released |
I am not sure how often this scenario occurs in reality :) I had to manipulate state directly to un-assign unit from a machine to properly test the fix.
However, the reason why there was a failure is because one of the checks we run when filtering is whether any of the open ports on a machine for a unit match. Of course, when the unit is not assigned to a machine the check failed saying that we could not figure out unit's machine. I have changed the logic to treat the case of an unassigned unit as a non-match instead of erring out.
This is the fix against 2.3: https:/ /github. com/juju/ juju/pull/ 8744