canonical / canonical/script-exporter-operator
failed systemd units results in charm getting stuck in config changed hook
- Dominant language
- Python
- Stars
- 1
- Forks
- 2
- Avg merge
- 4h 2m
- Merged PRs (30d)
- 1
Description
### Bug Description
If you have the systemd unit installed and you run a bad config for the config file, the systemd unit will die. If you then try to change the config, the config-changed hook wont process because the systemd unit is failed and cant be started which is strange.
checking the config file, I see the charm has not written the new config in yet. Perhaps the charm needs to be adjusted to first write the new config and then try to start the systemd unit?
### To Reproduce
1. deploy script exporter with a working config
2. change `config_file` to something broken
3. try to change `config_file` back to something that works
### Environment
`latest/edge 3`
### Relevant log output
```shell
unit-virt-exporter-0: 21:57:39 ERROR unit.virt-exporter/0.juju-log Uncaught exception while in charm code:
Traceback (most recent call last):
File "/var/lib/juju/agents/unit-virt-exporter-0/charm/./src/charm.py", line 300, in
ops.main(ScriptExporterCharm) # type: ignore
File "/var/lib/juju/agents/unit-virt-exporter-0/charm/venv/ops/__init__.py", line 343, in __call__
return _main.main(charm_class=charm_class, use_juju_for_storage=use_juju_for_storage)
File "/var/lib/juju/agents/unit-virt-exporter-0/charm/venv/ops/_main.py", line 558, in main
manager.run()
File "/var/lib/juju/agents/unit-virt-exporter-0/charm/venv/ops/_main.py", line 543, in run
self._emit()
File "/var/lib/juju/agents/unit-virt-exporter-0/charm/venv/ops/_main.py", line 502, in _emit
self._emit_charm_event(self.dispatcher.event_name)
File "/var/lib/juju/agents/unit-virt-exporter-0/charm/venv/ops/_main.py", line 530, in _emit_charm_event
event_to_emit.emit(*args, **kwargs)
File "/var/lib/juju/agents/unit-virt-exporter-0/charm/venv/ops/framework.py", line 347, in emit
framework._emit(event)
File "/var/lib/juju/agents/unit-virt-exporter-0/charm/venv/ops/framework.py", line 906, in _emit
self._reemit(event_path)
File "/var/lib/juju/agents/unit-virt-exporter-0/charm/venv/ops/framework.py", line 996, in _reemit
custom_handler(event)
File "/var/lib/juju/agents/unit-virt-exporter-0/charm/./src/charm.py", line 97, in on_config_changed
self._create_systemd_service()
File "/var/lib/juju/agents/unit-virt-exporter-0/charm/./src/charm.py", line 187, in _create_systemd_service
service_resume("script-exporter.service")
File "/var/lib/juju/agents/unit-virt-exporter-0/charm/lib/charms/operator_libs_linux/v1/systemd.py", line 274, in service_resume
raise SystemdError(f"Attempted to resume {service_name!r}, but it is not running.")
charms.operator_libs_linux.v1.systemd.SystemdError: Attempted to resume 'script-exporter.service', but it is not running.
```
### Additional context
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.