diff --git a/src-docs/charm.py.md b/src-docs/charm.py.md index 8024d22..4bdeb1e 100644 --- a/src-docs/charm.py.md +++ b/src-docs/charm.py.md @@ -73,7 +73,7 @@ Unit that this execution is responsible for. --- - + ### function `reconcile` diff --git a/src-docs/charm_types.py.md b/src-docs/charm_types.py.md index 3bcd9e3..9719956 100644 --- a/src-docs/charm_types.py.md +++ b/src-docs/charm_types.py.md @@ -47,7 +47,7 @@ Returns the set of fields that have been explicitly set on this model instance. --- - + ### classmethod `userids_to_list` @@ -126,6 +126,7 @@ A named tuple representing a Datasource PostgreSQL. - `host`: Host (IP or DNS without port or protocol). - `port`: Port. - `db`: Database name. + - `uri`: Database connection URI. --- @@ -152,4 +153,27 @@ Returns the set of fields that have been explicitly set on this model instance. +--- + + + +### classmethod `from_relation` + +```python +from_relation(relation: Relation) → DatasourcePostgreSQL +``` + +Create a DatasourcePostgreSQL from a relation. + + + +**Args:** + + - `relation`: The relation to get the data from. + + + +**Returns:** + A DatasourcePostgreSQL instance. + diff --git a/src-docs/constants.py.md b/src-docs/constants.py.md index 0f5825b..7537950 100644 --- a/src-docs/constants.py.md +++ b/src-docs/constants.py.md @@ -7,13 +7,13 @@ File containing constants to be used in the charm. **Global Variables** --------------- +- **IRC_BRIDGE_HEALTH_PORT** +- **IRC_BRIDGE_KEY_ALGO** +- **IRC_BRIDGE_KEY_OPTS** - **DATABASE_NAME** - **DATABASE_RELATION_NAME** -- **IRC_BRIDGE_SNAP_NAME** -- **IRC_BRIDGE_CONFIG_PATH** -- **IRC_BRIDGE_CONFIG_TEMPLATE_PATH** -- **IRC_BRIDGE_HEALTH_PORT** - **MATRIX_RELATION_NAME** +- **IRC_BRIDGE_SNAP_NAME** - **SNAP_PACKAGES** diff --git a/src-docs/database_observer.py.md b/src-docs/database_observer.py.md index a5413d5..9a3d8fb 100644 --- a/src-docs/database_observer.py.md +++ b/src-docs/database_observer.py.md @@ -21,9 +21,8 @@ The Database relation observer. - `relation_name`: The name of the relation to observe. - `database`: The database relation interface. - - `uri`: The database uri. - + ### function `__init__` @@ -47,12 +46,24 @@ Initialize the oserver and register event handlers. Shortcut for more simple access the model. + + --- -#### property uri + + +### function `get_db` + +```python +get_db() → Optional[DatasourcePostgreSQL] +``` -Reconcile the database relation. +Return a postgresql datasource model. +**Returns:** + + - `DatasourcePostgreSQL`: The datasource model. + diff --git a/src-docs/irc.py.md b/src-docs/irc.py.md index 2861179..a201c85 100644 --- a/src-docs/irc.py.md +++ b/src-docs/irc.py.md @@ -7,9 +7,9 @@ IRC Bridge charm business logic. **Global Variables** --------------- -- **IRC_BRIDGE_CONFIG_PATH** -- **IRC_BRIDGE_CONFIG_TEMPLATE_PATH** - **IRC_BRIDGE_HEALTH_PORT** +- **IRC_BRIDGE_KEY_ALGO** +- **IRC_BRIDGE_KEY_OPTS** - **IRC_BRIDGE_SNAP_NAME** - **SNAP_PACKAGES** @@ -26,7 +26,7 @@ This class provides the necessary methods to manage the matrix-appservice-irc se --- - + ### function `configure` @@ -50,7 +50,7 @@ Configure the service. --- - + ### function `prepare` @@ -64,7 +64,7 @@ Install the snap package and create the configuration directory and file. --- - + ### function `reconcile` @@ -80,8 +80,6 @@ Reconcile the service. Simple flow: - Check if the snap is installed -- Check if we have a database relation -- Check if we have a matrix relation - Check if the configuration files exist - Check if the service is running @@ -95,7 +93,7 @@ Simple flow: --- - + ### function `reload` @@ -115,7 +113,7 @@ Check if the service is running and reload it. --- - + ### function `start` @@ -133,7 +131,7 @@ Start the matrix-appservice-irc service. --- - + ### function `stop` diff --git a/tests/integration/test_charm.py b/tests/integration/test_charm.py index d4a19e8..c990464 100644 --- a/tests/integration/test_charm.py +++ b/tests/integration/test_charm.py @@ -32,4 +32,4 @@ async def test_lifecycle_before_relations(app: ops.model.Application, ops_test: # Mypy has difficulty with ActiveStatus assert unit.workload_status == ops.model.BlockedStatus.name # type: ignore # Assert part of the message - assert "Database relation not found" in ops.model.BlockedStatus.message # type: ignore + assert ops.BlockedStatus("Database relation not found") == app.status