juju wait-for model $model returns before everything is active

Bug #2019516 reported by Samuel Allan
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Triaged
Medium
Simon Richardson

Bug Description

`juju wait-for model $model` returns with alive/available before any units or applications reach active status.

```
$ juju status
Model Controller Cloud/Region Version SLA Timestamp
one test aws/ap-southeast-2 3.1.2 unsupported 01:46:58Z

SAAS Status Store URL
aar active ...
...

App Version Status Scale Charm Channel Rev Exposed Message
one maintenance 3 ...
two unknown 0 ...
three unknown 0 ...
four blocked 1 ...
...

Unit Workload Agent Machine Public address Ports Message
foo/0 maintenance executing 0
foo/1 maintenance executing 1
foo/2* maintenance executing 2
foobar/0* blocked executing 3
foobarbaz/0* maintenance executing 4
foobaz/0 maintenance executing 8
foobaz/1 maintenance executing 9
foobaz/2* maintenance executing 10
bar/0 waiting executing 11
bar/1 waiting executing 12
bar/2* waiting executing 13
...
# no units have reached active state yet

Machine State Address Inst id Base AZ Message
# all machines started, running

$ juju wait-for model one
Model "anbox-subcluster-1" is running
properties:
  life: alive
  status: available

```

Expected: default behaviour should block until all units are active/idle.

Tags: canonical-is
Revision history for this message
Tom Haddon (mthaddon) wrote :

I've been trying to confirm this bug, and have found the documentation on `wait-for` very sparse.

I tried a few different approaches as show in https://pastebin.ubuntu.com/p/RWfHXVVGjt/. The main thing that wasn't clear to me is what options are available for querying unit status.

tags: added: canonical-is
Changed in juju:
assignee: nobody → Simon Richardson (simonrichardson)
status: New → Triaged
Revision history for this message
Simon Richardson (simonrichardson) wrote (last edit ):

So a bit of background on `wait-for`. Originally, it was written by me as a way to have a consistent `wait-for` command in our integration tests (over 3 years ago) as a juju plugin. `wait-for` was then moved from a plugin to a standard command when I was on my sabbatical.

---

Documentation will be added in the next few pulses, so hopefully that will improve the sparseness problem.

---

For why it doesn't wait for all units and applications to become active/idle is because the default query for model states `(life=="alive" && status=="available")`. I'm not saying that the default is correct, or that we shouldn't update it, but it just states that the life is alive and the status is available and juju tells us that's the case.

What might be better would be to have something like:

    juju-wait-for model default --query='(life=="alive" && status=="available") && forEach(units, unit => unit.status == "active")'

PR: https://github.com/juju/juju/pull/12196

Changed in juju:
importance: Undecided → Medium
milestone: none → 2.9.44
Revision history for this message
Samuel Allan (samuelallan) wrote :

Thanks for the background, that makes more sense! Please also don't forget to document the how the query works (available fields, possible values, the syntax supported). I was quite confused about the semantics of 'life == "alive"', because I don't remember seeing anything in juju status that refers to a 'life' state.

Changed in juju:
milestone: 2.9.44 → 3.1.6
Revision history for this message
Simon Richardson (simonrichardson) wrote :

Draft PR to import error messages. https://github.com/juju/juju/pull/15868

Following on from this PR will be some documentation support.

Changed in juju:
milestone: 3.1.6 → 3.1.7
Changed in juju:
milestone: 3.1.7 → 3.1.8
Harry Pidcock (hpidcock)
Changed in juju:
milestone: 3.1.8 → 3.3.3
Ian Booth (wallyworld)
Changed in juju:
milestone: 3.3.3 → 3.3.4
Changed in juju:
milestone: 3.3.4 → 3.3.5
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.