Unable to retrieve application status from non-leader units

Bug #1850287 reported by Dmitrii Shcherbakov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Invalid
High
Unassigned

Bug Description

status-get has --application option which allows to retrieve application status and status of all units in that application.

There is, however, no way to retrieve the application status only (not the status of all units) from non-leader units. This seems strange considering there is a way to read leader data from non-leader units.

Usage: status-get [options] [--include-data] [--application]
# ...
Options:
--application (= false)
    print status for all units of this application if this unit is the leader

root@juju-382280-1:/var/lib/juju/agents/unit-apache-httpd-1/charm# is-leader
False

root@juju-382280-1:/var/lib/juju/agents/unit-apache-httpd-1/charm# status-get --application
ERROR finding application status: this unit is not the leader

juju run --unit apache-httpd/0 'status-get --application --include-data'
application-status:
  message: httpd app is ready
  status: active
  status-data: {}
  units:
    apache-httpd/0:
      message: httpd is ready
      status: active
      status-data: {}
    apache-httpd/1:
      message: httpd is ready
      status: active
      status-data: {}

description: updated
Tim Penhey (thumper)
Changed in juju:
status: New → Triaged
importance: Undecided → High
milestone: none → 2.7.1
Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 1850287] [NEW] Unable to retrieve application status from non-leader units
Download full text (3.9 KiB)

What is the use case for reading it? I want to watch out that it doesn't
become a mini peer relation that doesn't send notifications. Originally
there wasn't a status-get as it was meant to be a message for humans. We
added it so frameworks can see if a charm has set a status so the framework
doesn't clobber it.
What do non leader units need to read it for?

John
=:->

On Tue, Oct 29, 2019, 15:40 Dmitrii Shcherbakov <email address hidden>
wrote:

> Public bug reported:
>
> status-get has --application option which allows to retrieve application
> status and status of all units in that application.
>
> There is, however, no way to retrieve the application status only (not
> the status of all units) from non-leader units. This seems strange
> considering there is a way to read leader data from non-leader units.
>
> Usage: status-get [options] [--include-data] [--application]
> # ...
> Options:
> --application (= false)
> print status for all units of this application if this unit is the
> leader
>
> root@juju-382280-1:/var/lib/juju/agents/unit-apache-httpd-1/charm#
> is-leader
> False
>
> root@juju-382280-1:/var/lib/juju/agents/unit-apache-httpd-1/charm#
> status-get --application
> ERROR finding application status: this unit is not the leader
>
> juju run --unit apache-httpd/0 'status-get --application --include-data'
> application-status:
> message: httpd app is ready
> status: active
> status-data: {}
> units:
> apache-httpd/0:
> message: httpd is ready
> status: active
> status-data: {}
> apache-httpd/1:
> message: httpd is ready
> status: active
> status-data: {}
>
> ** Affects: juju
> Importance: Undecided
> Status: New
>
> ** Description changed:
>
> status-get has --application option which allows to retrieve application
> status and status of all units in that application.
>
> - There is, however, no way to retrieve application status from non-leader
> - units. This seems strange considering there is a way to read leader data
> - from non-leader units.
> + There is, however, no way to retrieve the application status only (not
> + the status of all units) from non-leader units. This seems strange
> + considering there is a way to read leader data from non-leader units.
>
> Usage: status-get [options] [--include-data] [--application]
> # ...
> Options:
> --application (= false)
> - print status for all units of this application if this unit is the
> leader
> + print status for all units of this application if this unit is the
> leader
>
> -
> - root@juju-382280-1:/var/lib/juju/agents/unit-apache-httpd-1/charm#
> is-leader
> + root@juju-382280-1:/var/lib/juju/agents/unit-apache-httpd-1/charm#
> is-leader
> False
>
> root@juju-382280-1:/var/lib/juju/agents/unit-apache-httpd-1/charm#
> status-get --application
> ERROR finding application status: this unit is not the leader
>
> -
> juju run --unit apache-httpd/0 'status-get --application --include-data'
> application-status:
> - message: httpd app is ready
> - status: active
> - status-data: {}
> - units:
> - apache-httpd/0:
> - message: httpd is ready
> - statu...

Read more...

Revision history for this message
Dmitrii Shcherbakov (dmitriis) wrote :

Good question.

I agree that allowing charm authors to make minion unit states to be dependent on application status without notifications is going to lead to charm bugs, e.g. something like this:

if app.status == 'active' and is_unit_active:
    unit.status = 'active'
else:
    unit.status = 'maintenance'

would be problematic and leader data (peer relation app data) would be a better fit for something like this.

Thinking about this again, I can't find a good reason for units to be able to access app status compared to leader settings so maybe we can close this as "invalid" then.

Changed in juju:
status: Triaged → Invalid
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.