functions/methods to calculate Landscape links for units, services, environment

Bug #1126249 reported by Gary Poster
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
juju-gui
Fix Released
High
Benjamin Saller

Bug Description

We should have methods or functions that produce the links we need. These will be used in many places, so having a single place to do the calculation will be valuable. Details follow.

* We need a Landscape link to view/manage the machines that represent
the current environment.

* We need a Landscape link to view/manage the set of machines that
represent a given service.

* We need a Landscape link to view/manage a single machine that is
running a given service unit.

* We need information about whether a unit is on a machine that needs
security updates from Landscape, and links to apply the update on the
unit, service, or environment level.

* We need information about whether a unit is on a machine that needs a
reboot from Landscape, and links to perform the reboot on the unit,
service, or environment level.

The links and information that I described above are available by
assembling annotations at different levels. Landscape connects with
Juju to create the annotations, and we simply consume them.

Here are the pertinent annotations, as drawn from some emails with
Thomas. They are at the environment, service, and unit level.

The environment itself has these annotations. Each annotation below
also gives an example value.

   landscape-url: https://host/account/standalone
   landscape-security-alert-url: +alert:computer-reboot/info#power
   landscape-reboot-alert-url: +alert:security-upgrades/packages/list?filter=security
   landscape-computers: /computers/criteria/environment:env0

Each service has this annotation.

   landscape-computers: /computers/criteria/service:service0+environment:env0

Each unit has this annotation.

   landscape-computer: /computers/criteria/unit:service0/0+environment:env0
   landscape-security-upgrades: True (or not present)
   landscape-needs-rebooot: True (or not present)

The upgrade and reboot flags are per unit, but we need to aggregate them
to the service and unit levels. In order to support doing this quickly,
to state the probably obvious, I suspect we will want to do some
counting at the service level, and possibly at the unit level. That is,
when the status of a unit changes, we will update a count attribute on
the associated service. The graphic renderings for services and the
environment will only need to check the aggregated counts, rather than
iterating over potentially thousands of units.

The URL segments are meant to be assembled. If you want to look at all
of the computers in the environment, for instance, you combine
landscape-url and landscape-computers, so that the given examples would
yield
"https://host/account/standalone/computers/criteria/environment:env0".
Here's a link to the page to reboot a given unit, using the example values:

https://host/account/standalone/computers/criteria/unit:service0/0+environment:env0+alert:computer-reboot/info#power

For the service, it would be this:

https://host/account/standalone/computers/criteria/service:service0+environment:env0+alert:computer-reboot/info#power

For the environment, then it would be this:

https://host/account/standalone/computers/criteria/environment:env0+alert:computer-reboot/info#power

Related branches

Revision history for this message
Gary Poster (gary) wrote :

There's a small change to the scheme described above, per therve. The goal was simply to shrink the size of the annotations on the services and units. The resulting URLs are essentially the same as described above. Here are the new annotations:

Environment:

  landscape-url: https://host/account/standalone
  landscape-reboot-alert-url: +alert:computer-reboot/info#power
  landscape-security-alert-url: +alert:security-upgrades/packages/list?filter=security
  landscape-computers: /computers/criteria/environment:env_uuid

Service:

  landscape-computers: +service:service0

Unit:

  landscape-computer: +unit:service0%02F0
  landscape-security-upgrades: True (or not present)
  landscape-needs-rebooot: True (or not present)

To create a service or unit URL now, you must always include the Environment's landscape-computers annotation before the service's or unit's. A service URL from the annotations above would be https://host/account/standalone/computers/criteria/environment:env_uuid+service:service0 and a unit URL would be https://host/account/standalone/computers/criteria/environment:env_uuid+unit:service0%02F0

therve notes that the environment criteria has also changed to use the UUID instead of Landscape's internal name, but that should not affect us.

Changed in juju-gui:
assignee: nobody → Benjamin Saller (bcsaller)
milestone: none → 0.2.0+build.366
status: Triaged → In Progress
Gary Poster (gary)
Changed in juju-gui:
status: In Progress → Fix Released
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.