Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Only replan if there are actual changes #148

Merged
merged 2 commits into from
Apr 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,16 @@ def _config_file_is_written(self) -> bool:
def _configure_workload(self, restart: bool = False) -> None:
"""Configure pebble layer for the nrf container."""
plan = self._container.get_plan()
layer = self._pebble_layer
if plan.services != layer.services or restart:
self._container.add_layer("nrf", layer, combine=True)
if plan.services != self._pebble_layer.services:
self._container.add_layer(
self._container_name, self._pebble_layer, combine=True
)
self._container.replan()
logger.info("New layer added: %s", self._pebble_layer)
if restart:
self._container.restart(self._service_name)
logger.info("Restarted container %s", self._service_name)
return

def _config_file_content_matches(self, content: str) -> bool:
"""Return whether the nrfcfg config file content matches the provided content.
Expand Down
Loading