canonical / sysbench-operator

Charm to manage sysbench and connect with Data Platform databases
Apache License 2.0
1 stars 0 forks source link

`Juju config sysbench` causes exception on K8s: FileNotFoundError: [Errno 2] No such file or directory: 'systemctl' #36

Open taurus-forever opened 2 months ago

taurus-forever commented 2 months ago

Steps to reproduce

  1. juju deploy postgtesql-k8s, sysbench # noticed on ARM, but should be the same on AMD.
  2. juju relate postgtesql-k8s sysbench
  3. juju run sysbench/leader prepare # executed OK
  4. juju config sysbench threads=1 scale=1 duration=300 # Error

Expected behavior

No errors on juju config :-D

Actual behavior

taurus@pi5juju:~$ juju status
Model  Controller  Cloud/Region        Version  SLA          Timestamp
arm    m2k8s       microk8s/localhost  3.4.2    unsupported  02:07:35+02:00

App             Version  Status   Scale  Charm           Channel        Rev  Address         Exposed  Message
postgresql-k8s  14.11    active       1  postgresql-k8s  14/edge        248  10.152.183.57   no       Primary
sysbench                 waiting      1  sysbench        latest/stable   25  10.152.183.154  no       installing agent

Unit               Workload  Agent  Address     Ports  Message
postgresql-k8s/0*  active    idle   10.1.46.35         Primary
sysbench/0*        error     idle   10.1.46.42         hook failed: "config-changed"

Error:

unit-sysbench-0: 02:06:12 DEBUG unit.sysbench/0.juju-log ops 2.12.0 up and running.
unit-sysbench-0: 02:06:12 DEBUG unit.sysbench/0.juju-log Emitting Juju event config_changed.
unit-sysbench-0: 02:06:13 DEBUG unit.sysbench/0.juju-log Executing command: ['systemctl', 'daemon-reload']
unit-sysbench-0: 02:06:13 ERROR unit.sysbench/0.juju-log Uncaught exception while in charm code:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-sysbench-0/charm/./src/charm.py", line 325, in <module>
    main(SysbenchOperator)
  File "/var/lib/juju/agents/unit-sysbench-0/charm/venv/ops/main.py", line 544, in main
    manager.run()
  File "/var/lib/juju/agents/unit-sysbench-0/charm/venv/ops/main.py", line 520, in run
    self._emit()
  File "/var/lib/juju/agents/unit-sysbench-0/charm/venv/ops/main.py", line 509, in _emit
    _emit_charm_event(self.charm, self.dispatcher.event_name)
  File "/var/lib/juju/agents/unit-sysbench-0/charm/venv/ops/main.py", line 143, in _emit_charm_event
    event_to_emit.emit(*args, **kwargs)
  File "/var/lib/juju/agents/unit-sysbench-0/charm/venv/ops/framework.py", line 352, in emit
    framework._emit(event)
  File "/var/lib/juju/agents/unit-sysbench-0/charm/venv/ops/framework.py", line 851, in _emit
    self._reemit(event_path)
  File "/var/lib/juju/agents/unit-sysbench-0/charm/venv/ops/framework.py", line 941, in _reemit
    custom_handler(event)
  File "/var/lib/juju/agents/unit-sysbench-0/charm/./src/charm.py", line 135, in _on_config_changed
    svc.render_service_file(
  File "/var/lib/juju/agents/unit-sysbench-0/charm/src/sysbench.py", line 83, in render_service_file
    return daemon_reload()
  File "/var/lib/juju/agents/unit-sysbench-0/charm/lib/charms/operator_libs_linux/v1/systemd.py", line 288, in daemon_reload
    return _systemctl("daemon-reload", check=True) == 0
  File "/var/lib/juju/agents/unit-sysbench-0/charm/lib/charms/operator_libs_linux/v1/systemd.py", line 90, in _systemctl
    proc = subprocess.run(
  File "/usr/lib/python3.10/subprocess.py", line 503, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.10/subprocess.py", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.10/subprocess.py", line 1863, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'systemctl'
unit-sysbench-0: 02:06:13 ERROR juju.worker.uniter.operation hook "config-changed" (via hook dispatching script: dispatch) failed: exit status 1

Versions

Operating system: Ubuntu 23.10 Juju CLI: 3.4.2-genericlinux-arm64 Juju agent: see above Charm revision: see above LXD: not applicable MicroK8s: MicroK8s v1.30.0 revision 6788 (strict)

Log output

Juju debug log: see above

Additional context

Works well on LXD as we have systemd there.... but not on K8s/Pebble. ;-)

github-actions[bot] commented 2 months ago

https://warthogs.atlassian.net/browse/DPE-4286