Skip to content

Commit

Permalink
Merge pull request #4 from gboutry/fix/pebble-service-name
Browse files Browse the repository at this point in the history
Rename rabbitmq-server service to rabbitmq
  • Loading branch information
javacruft authored May 26, 2023
2 parents 372fb6d + 3aaee20 commit d816d3e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
logger = logging.getLogger(__name__)

RABBITMQ_CONTAINER = "rabbitmq"
RABBITMQ_SERVER_SERVICE = "rabbitmq-server"
RABBITMQ_SERVICE = "rabbitmq"
RABBITMQ_USER = "rabbitmq"
RABBITMQ_GROUP = "rabbitmq"
RABBITMQ_COOKIE_PATH = "/var/lib/rabbitmq/.erlang.cookie"
Expand Down Expand Up @@ -149,7 +149,7 @@ def _rabbitmq_running(self) -> bool:
try:
return (
self.unit.get_container(RABBITMQ_CONTAINER)
.get_service(RABBITMQ_SERVER_SERVICE)
.get_service(RABBITMQ_SERVICE)
.is_running()
)
except ModelError:
Expand Down Expand Up @@ -197,7 +197,7 @@ def _on_config_changed(self, event: EventBase) -> None:
container.add_layer("rabbitmq", self._rabbitmq_layer(), combine=True)

# Autostart any services that were defined with startup: enabled
if not container.get_service(RABBITMQ_SERVER_SERVICE).is_running():
if not container.get_service(RABBITMQ_SERVICE).is_running():
logging.info("Autostarting rabbitmq")
container.autostart()
else:
Expand All @@ -222,7 +222,7 @@ def _rabbitmq_layer(self) -> dict:
"summary": "RabbitMQ layer",
"description": "pebble config layer for RabbitMQ",
"services": {
RABBITMQ_SERVER_SERVICE: {
RABBITMQ_SERVICE: {
"override": "replace",
"summary": "RabbitMQ Server",
"command": "rabbitmq-server",
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def test_rabbitmq_pebble_ready(self):
# Expected plan after Pebble ready with default config
expected_plan = {
"services": {
"rabbitmq-server": {
"rabbitmq": {
"override": "replace",
"summary": "RabbitMQ Server",
"command": "rabbitmq-server",
Expand Down Expand Up @@ -115,7 +115,7 @@ def test_rabbitmq_pebble_ready(self):
# Check the service was started
service = self.harness.model.unit.get_container(
"rabbitmq"
).get_service("rabbitmq-server")
).get_service("rabbitmq")
self.assertTrue(service.is_running())

def test_update_status(self):
Expand Down

0 comments on commit d816d3e

Please sign in to comment.