canonical / canonical/operator
Cleaning up inconsistencies in the Manage actions how-to page
- Dominant language
- Python
- Stars
- 267
- Forks
- 136
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 28
Description
While working on #2662 , I noticed that there were inconsistencies in the Manage Relations how-to pages.
See https://github.com/canonical/operator/pull/2662#issuecomment-5288007034 for the original discussions.
Some examples:
1.
```python
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)`.
2.
```python
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`.
Contributor guide
Research direction
Start with the Manage Relations how-to pages and review the discussion in pull request #2662. Check the shown examples for undefined or inconsistent variable references, including relation versus event.relation and secret versus secret_contents. Done means the affected examples are internally consistent and accurately reflect the intended API usage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 74/100