Skip to content

Cleaning up inconsistencies in the Manage actions how-to page #2688

Description

@tromai

While working on #2662 , I noticed that there were inconsistencies in the Manage Relations how-to pages.

See #2662 (comment) for the original discussions.

There are some inconsistencies in the examples, which I am planning to address in another PR. Let me know if that is okay.

Some examples:

def _on_db_relation_created(self, event: ops.RelationCreatedEvent):
    if not self.unit.is_leader():
        return
    credentials = self.create_database(event.app.name)
    data = DatabaseProviderAppData(credentials=credentials)
    relation.save(data, event.app)

relation is undefined. I assume we need event.relation.save(data, event.app).

def _update_configuration(self, _: ops.Eventbase):
    ...
    secret_contents = self.model.get_secret(id=secret_id).get_contents(
        refresh=True
    )
    self.push_configuration(
        username=secret['username'],
        password=secret['password'],
    )

I assume secret should be secret_contents.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsImprovements or additions to documentationrainy daySmall items done in ~10% of each week's time

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions