juju_verify.verifiers.base module

Base for other modules that implement verification checks for specific charms.

class juju_verify.verifiers.base.BaseVerifier(units: List[Unit], exclude_affected_units: Optional[List[Unit]] = None)

Bases: object

Base class for implementation of verification checks for specific charms.

Classes that inherit from this base must override class variable ‘NAME’ to match charm name (e.g. ‘nova-compute’) and override methods named verify_<check_name> with actual implementation of the checks.

NotImplemented exception will be raised if attempt is made to perform check that is not implemented in child class.

NAME = ''
check_affected_machines() Result

Check if affected machines run other principal units.

Log warning if machine that run units checked by this verifier also runs other principal units that are not being checked.

check_has_sub_machines() Result

Check if the machine hosts containers or VMs.

Logs warning if there are units running on sub machines that are children of the affected machines.

static check_minimum_version(min_version: Version, units: List[Unit]) Result

Check minimum required version of juju agents on units.

get_verify_action(check: str) Callable

Return verification check as callable function without any arguments.

run_action_on_all(action: str, use_cache: bool = True, params: Optional[Dict[str, Any]] = None) Dict[str, Action]

Run juju action on all units in self.units.

For more info, see docstring for ‘run_action_on_units’.

classmethod supported_checks() List[str]

Return list of supported checks.

unit_from_id(unit_id: str) Unit

Search self.units for unit that matches ‘unit_id’.

Parameters:

unit_id – ID of the unit to find

Returns:

Unit that matches ‘unit_id’

property unit_ids: List[str]

Return entity IDs of self.units.

verify(check: str) Result

Execute requested verification check.

Parameters:

check – Check to execute

Returns:

Overall verification Result

Raises:
  • NotImplementedError – If requested check is unsupported/unknown

  • VerificationError – If check fails in unexpected manner or if list of self.units is empty

verify_reboot() Result

Child classes must override this method with custom implementation.

‘reboot’ check needs to be implemented on child classes.

verify_shutdown() Result

Child classes must override this method with custom implementation.

‘shutdown’ check needs to be implemented on child classes.