Skip to content

Error on loading databag when relation available but databag isn't #298

@kayra1

Description

@kayra1

When trying to load relation data, it is possible to have the relation be available but the databag unreadable. The lib is running into an error when loading the databag because it doesn't handle the case where relation is available but the databag contents aren't.

   def _load_provider_certificates(self, relation: Relation) -> List[_Certificate]:
        try:
            provider_relation_data = _ProviderApplicationData.load(relation.data[self.charm.app])
        except DataValidationError:
            logger.debug("Invalid provider relation data")
            return []
        return copy.deepcopy(provider_relation_data.certificates)

relation.data[self.charm.app] is breaking in the above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    charmlibs-interfaces-tls-certificatesRelated to the charmlibs.interfaces.tls_certificates library specifically.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions