Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nrobinaubertin committed Nov 14, 2024
1 parent 335a922 commit 2980436
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ module = "tests.*"
[tool.pylint]
disable = "wrong-import-order"

[tool.pylint.tests]
disable = ["too-many-arguments"]

[tool.pytest.ini_options]
minversion = "6.0"
log_cli_level = "INFO"
Expand Down
6 changes: 3 additions & 3 deletions src/bind.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def stop(self) -> None:
logger.error(error_msg)
raise StopError(error_msg) from e

def setup(self, unit_name: str, snap_path: str) -> None:
def setup(self, unit_name: str, snap_path: str | None) -> None:
"""Prepare the machine.
Args:
Expand Down Expand Up @@ -230,7 +230,7 @@ def update_zonefiles_and_reload(
logger.debug("Update and reload duration (ms): %s", (time.time_ns() - start_time) / 1e6)

def _install_snap_package(
self, snap_name: str, snap_channel: str, snap_path: str, refresh: bool = False
self, snap_name: str, snap_channel: str, snap_path: str | None, refresh: bool = False
) -> None:
"""Installs snap package.
Expand All @@ -245,7 +245,7 @@ def _install_snap_package(
"""
try:
# If a snap resource was not given, install the snap as published on snapcraft
if snap_path == "":
if snap_path is None or snap_path == "":
snap_cache = snap.SnapCache()
snap_package = snap_cache[snap_name]

Expand Down
3 changes: 1 addition & 2 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,10 @@ def __init__(self, *args: typing.Any):
self.unit.open_port("tcp", 53) # Bind DNS
self.unit.open_port("udp", 53) # Bind DNS

# Try to check if the `charmed-bind-snap` resource is defined.
# Record if the `charmed-bind-snap` resource is defined.
# Using this can be useful when debugging locally
# More information about resources:
# https://juju.is/docs/sdk/resources#heading--add-a-resource-to-a-charm
self.snap_path: str = ""
try:
self.snap_path = str(self.model.resources.fetch("charmed-bind-snap"))
except ops.ModelError as e:
Expand Down
8 changes: 0 additions & 8 deletions tests/integration/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@

"""Helper functions for the integration tests."""

# Ignore duplicate code from the helpers (they can be in the charm also)
# pylint: disable=duplicate-code
# Ignore functions having too many arguments (will be removed in the future)
# pylint: disable=too-many-positional-arguments

# Ignore too many args warning. I NEED THEM OKAY ?!
# pylint: disable=too-many-arguments

import json
import logging
import pathlib
Expand Down

0 comments on commit 2980436

Please sign in to comment.