Cancel config change

I made a mistake and ran juju config etcd channel=1.25/stable, which is a non-existing channel for etcd. Now I can’t get out of this situation:

Corresponding debug-log:

unit-etcd-41: 09:53:47 ERROR unit.etcd/41.juju-log Hook error:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-etcd-41/.venv/lib/python3.6/site-packages/charms/reactive/__init__.py", line 74, in main
    bus.dispatch(restricted=restricted_mode)
  File "/var/lib/juju/agents/unit-etcd-41/.venv/lib/python3.6/site-packages/charms/reactive/bus.py", line 390, in dispatch
    _invoke(other_handlers)
  File "/var/lib/juju/agents/unit-etcd-41/.venv/lib/python3.6/site-packages/charms/reactive/bus.py", line 359, in _invoke
    handler.invoke()
  File "/var/lib/juju/agents/unit-etcd-41/.venv/lib/python3.6/site-packages/charms/reactive/bus.py", line 181, in invoke
    self._action(*args)
  File "/var/lib/juju/agents/unit-etcd-41/charm/reactive/etcd.py", line 379, in snap_install
    snap.install("etcd", channel=channel, classic=False)
  File "lib/charms/layer/snap.py", line 60, in install
    refresh(snapname, **kw)
  File "lib/charms/layer/snap.py", line 113, in refresh
    _refresh_store(snapname, **kw)
  File "lib/charms/layer/snap.py", line 421, in _refresh_store
    out = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
  File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['snap', 'refresh', '--amend', '--channel=1.24/stable', 'etcd']' returned non-zero exit status 1.

unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed Traceback (most recent call last):
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed   File "/var/lib/juju/agents/unit-etcd-41/charm/hooks/config-changed", line 22, in <module>
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed     main()
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed   File "/var/lib/juju/agents/unit-etcd-41/.venv/lib/python3.6/site-packages/charms/reactive/__init__.py", line 74, in main
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed     bus.dispatch(restricted=restricted_mode)
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed   File "/var/lib/juju/agents/unit-etcd-41/.venv/lib/python3.6/site-packages/charms/reactive/bus.py", line 390, in dispatch
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed     _invoke(other_handlers)
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed   File "/var/lib/juju/agents/unit-etcd-41/.venv/lib/python3.6/site-packages/charms/reactive/bus.py", line 359, in _invoke
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed     handler.invoke()
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed   File "/var/lib/juju/agents/unit-etcd-41/.venv/lib/python3.6/site-packages/charms/reactive/bus.py", line 181, in invoke
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed     self._action(*args)
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed   File "/var/lib/juju/agents/unit-etcd-41/charm/reactive/etcd.py", line 379, in snap_install
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed     snap.install("etcd", channel=channel, classic=False)
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed   File "lib/charms/layer/snap.py", line 60, in install
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed     refresh(snapname, **kw)
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed   File "lib/charms/layer/snap.py", line 113, in refresh
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed     _refresh_store(snapname, **kw)
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed   File "lib/charms/layer/snap.py", line 421, in _refresh_store
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed     out = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed   File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed     **kwargs).stdout
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed   File "/usr/lib/python3.6/subprocess.py", line 438, in run
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed     output=stdout, stderr=stderr)
unit-etcd-41: 09:53:47 WARNING unit.etcd/41.config-changed subprocess.CalledProcessError: Command '['snap', 'refresh', '--amend', '--channel=1.24/stable', 'etcd']' returned non-zero exit status 1.
unit-etcd-41: 09:53:47 ERROR juju.worker.uniter.operation hook "config-changed" (via explicit, bespoke hook script) failed: exit status 1
unit-etcd-41: 09:53:47 INFO juju.worker.uniter awaiting error resolution for "config-changed" hook

This should be a trivial situation to get out of right? Yet I can’t seem to do it.

In this case it looks like you could, after fixing your config via juju config, just run juju resolved etcd/41 which should re-run the config-changed hook, which should try to install the correct version.

Yeah tried that, that didn’t work.

I logged into the machines, edited their charm’s logic to ignore the parameter and reinstall the current version as a NOOP so to say. IIRC, afterwards it did ran the second config change as if the actions were queued.

1 Like