Changing MON Pebble Service command to enter the startup directory first 98/13798/5
authorDario Faccin <dario.faccin@canonical.com>
Tue, 1 Aug 2023 15:39:36 +0000 (17:39 +0200)
committerbeierlm <mark.beierl@canonical.com>
Wed, 9 Aug 2023 13:20:43 +0000 (15:20 +0200)
In rockcraft.yaml WORKDIR is not supported, so it needs to be specified in Pebble service definition by using working-dir parameter.
However, working-dir is not supported in Juju 2.9.x. So, we are entering to the startup directory first as a workaround.

Change-Id: I5949b16ce7e28dfb3f235eabd64062a5a185aa9c
Signed-off-by: Dario Faccin <dario.faccin@canonical.com>
installers/charm/osm-mon/src/charm.py

index bb98ccf..2111429 100755 (executable)
@@ -373,10 +373,11 @@ class OsmMonCharm(CharmBase):
                 self.service_name: {
                     "override": "replace",
                     "summary": "mon service",
-                    "command": "/bin/bash scripts/start.sh",
+                    "command": "/bin/bash -c 'cd /app/osm_mon/ && /bin/bash start.sh'",
                     "startup": "enabled",
                     "user": "appuser",
                     "group": "appuser",
+                    "working-dir": "/app/osm_mon",  # This parameter has no effect in Juju 2.9.x
                     "environment": environment,
                 }
             },