Changing RO Pebble Service command to enter the startup directory first 94/13794/5
authorgatici <gulsum.atici@canonical.com>
Mon, 31 Jul 2023 13:18:42 +0000 (16:18 +0300)
committerbeierlm <mark.beierl@canonical.com>
Wed, 9 Aug 2023 13:15:54 +0000 (15:15 +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: I44bbe0beeafce3932218a0df1d38191a14cb4a8a
Signed-off-by: gatici <gulsum.atici@canonical.com>
installers/charm/osm-ro/src/charm.py

index 84c0ee3..89da4f1 100755 (executable)
@@ -302,10 +302,11 @@ class OsmRoCharm(CharmBase):
                 "ro": {
                     "override": "replace",
                     "summary": "ro service",
-                    "command": "python3 -u -m osm_ng_ro.ro_main",
+                    "command": "/bin/sh -c 'cd /app/osm_ro && python3 -u -m osm_ng_ro.ro_main'",  # cd /app/osm_nbi is needed until we upgrade Juju to 3.x.
                     "startup": "enabled",
                     "user": USER,
                     "group": GROUP,
+                    "working-dir": "/app/osm_ro",  # This parameter has no effect in Juju 2.9.x.
                     "environment": {
                         # General configuration
                         "OSMRO_LOG_LEVEL": self.config["log-level"].upper(),