Comment 4 for bug 1942787

Revision history for this message
Gábor Mészáros (gabor.meszaros) wrote (last edit ):

This time I spent a bit on the workaround automation.

haunit=hacluster-gnocchi/2

# Extract the principal unit on which the hacluster is deployed on
unit=$(juju run -u $haunit 'relation-list -r $(relation-ids ha | cut -d: -f2)')
# Dump current relation data in case something
juju run -u $haunit 'relation-get -r $(relation-ids ha) json_resource_params '$unit
# Rewrite the resource_params field with bringing timeout to front
juju run -u $haunit 'rel_id=$(relation-ids ha); relation-get -r $rel_id json_resource_params '$unit' | sed "s/depth=..0.. timeout=..20s.. interval=..10s../timeout=\\\"20s\\\" interval=\\\"10s\\\" depth=\\\"0\\\"/g" > /tmp/json_resource_params_fix'
juju run -u $unit 'rel_id=$(relation-ids ha); relation-set -r $rel_id json_resource_params="$(cat /tmp/json_resource_params_fix)"'
# Re-dump relation data to confirm it got rewritten as desired
juju run -u $haunit 'relation-get -r $(relation-ids ha) json_resource_params '$unit
# Resolve and retry if unit is in error state
juju resolved $haunit

The commands above are not working. Couldn't figure out how to in place update the backslashes.
Ended up dumping the relation data to /tmp/json_resource_params_fix and edited manually.
Then loaded back with the relation-set command above.