Skip to content

Commit

Permalink
fix: storage mount defer event & set port (#87)
Browse files Browse the repository at this point in the history
* fix: storage mount defer event

* fix: remove broken set ports

* test: remove port
  • Loading branch information
yanksyoon authored Jan 2, 2024
1 parent 2aa7cbc commit 9e8d89b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ def _on_jenkins_pebble_ready(self, event: ops.PebbleReadyEvent) -> None:
return

self.unit.set_workload_version(version)
self.unit.set_ports(jenkins.WEB_PORT)
self.unit.status = ops.ActiveStatus()

def _remove_unlisted_plugins(self, container: ops.Container) -> ops.StatusBase:
Expand Down Expand Up @@ -195,6 +194,8 @@ def _on_jenkins_home_storage_attached(self, event: ops.StorageAttachedEvent) ->
container = self.unit.get_container(JENKINS_SERVICE_NAME)
if not container.can_connect():
self.unit.status = ops.WaitingStatus("Waiting for pebble.")
# This event should be handled again once the container becomes available.
event.defer()
return

command = [
Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ def test__on_jenkins_pebble_ready(
assert (
jenkins_charm.unit.status.name == ACTIVE_STATUS_NAME
), f"unit should be in {ACTIVE_STATUS_NAME}"
assert jenkins.WEB_PORT in {open_port.port for open_port in harness.model.unit.opened_ports()}


@pytest.mark.parametrize(
Expand Down

0 comments on commit 9e8d89b

Please sign in to comment.