[charm] nrpe relation fails when conn-check gets the relation before the primary service.

Bug #1528595 reported by Guillermo Gonzalez
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Fix Released
Wes Mason

Bug Description

IMO, looks like a timing issue.

The error is:

2015-12-22 14:28:50 INFO nrpe-external-master-relation-changed TASK: [nrpe-external-master | Call charmhelpers nrpe support] *****************
2015-12-22 14:28:50 INFO nrpe-external-master-relation-changed fatal: [localhost] => One or more undefined variables: list object has no element 0

and the steps to resolved this are:

juju remove-relation <service> conn-check
juju resolved conn-check
# wait for the hooks to finish
juju add-relation <service> conn-check

Related branches

Wes Mason (wesmason)
Changed in conn-check:
importance: Undecided → Medium
assignee: nobody → Wes Mason (wesmason)
Revision history for this message
Wes Mason (wesmason) wrote :

Had this bug occur in a recent env during a separate task, so took the oppertunity to debug, finally tracked it down to the config_path env, which is evaluated lazily as part of the checks.0.command in the nrpe call, it needs to be fixed to not rely explicitly on the relation data:

config_path: "{{ relations['conn-check'.0|default({})['config_path'] | default('/srv/conn-check/config.yaml') }}"

Revision history for this message
Wes Mason (wesmason) wrote :

It might be enough to include relations['conn-check'] in the when clause for the nrpe role so it doesn't fire until both nrpe-external-master and conn-check are available.

Wes Mason (wesmason)
Changed in conn-check:
status: New → In Progress
Wes Mason (wesmason)
Changed in conn-check:
status: In Progress → Fix Committed
Wes Mason (wesmason)
Changed in conn-check:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers