-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(db): Add db #6
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
license-eye has checked 40 files.
Valid | Invalid | Ignored | Fixed |
---|---|---|---|
17 | 1 | 22 | 0 |
Click to see the invalid file list
- tests/unit/test_irc.py
Use this command to fix any missing license headers
```bash
docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header fix
</details>
src/database.py
Outdated
data["POSTGRES_PASSWORD"], | ||
data["POSTGRES_DB"], | ||
): | ||
return default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will IRC bridge fail if the default is returned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment on my side as before
src/database.py
Outdated
|
||
return data | ||
|
||
def is_relation_ready(self) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is interesting.
Most of our charms are relying on some kind of "database is not None" (at least is my impression).
The only concern here is that by any chance this check is not done before using the relation data, will be hard to tell why there is no database configuration as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be managed through a ValidationError when the pydantic object is created more than an explicit is ready
src/irc.py
Outdated
exec_process = subprocess.run( | ||
pem_create_command, shell=True, check=True, capture_output=True) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any exception that we should catch here ?
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
license-eye has checked 45 files.
Valid | Invalid | Ignored | Fixed |
---|---|---|---|
19 | 3 | 23 | 0 |
Click to see the invalid file list
- templates/config.yaml
- templates/matrix-appservice-irc.service
- templates/matrix-appservice-irc.target
Use this command to fix any missing license headers
```bash
docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header fix
</details>
config.yaml
Outdated
@@ -0,0 +1,21 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Copyright 2024 Canonical Ltd. | |
# See LICENSE file for licensing details. | |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
license-eye has checked 49 files.
Valid | Invalid | Ignored | Fixed |
---|---|---|---|
22 | 3 | 24 | 0 |
Click to see the invalid file list
- templates/matrix-appservice-irc.service
- templates/matrix-appservice-irc.target
- tests/unit/test_charm_types.py
Use this command to fix any missing license headers
```bash
docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header fix
</details>
tests/unit/test_charm_types.py
Outdated
@@ -0,0 +1,26 @@ | |||
import pytest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import pytest | |
# Copyright 2024 Canonical Ltd. | |
# See LICENSE file for licensing details. | |
import pytest |
metadata.yaml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should merge charmcraft.yaml and metadata.yaml in charmcraft.yaml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm facing an issue here when merging:
Bad charmcraft.yaml content:
- input should be None (in field 'issues')
- extra inputs are not permitted (in field 'display-name')
- extra inputs are not permitted (in field 'docs')
- extra inputs are not permitted (in field 'maintainers')
- extra inputs are not permitted (in field 'source')
Might leave it as is for now (stumbled upon this).
+ "-outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:2048", | ||
] | ||
logger.info("Creating PEM file for IRC bridge.") | ||
subprocess.run(pem_create_command, shell=True, check=True, capture_output=True) # nosec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What did we say about that one ? I see the comment is closed but without being addressed
"""Exception raised when unable to stop the service.""" | ||
|
||
|
||
class InstallError(exceptions.SnapError): | ||
"""Exception raised when unable to install dependencies for the service.""" | ||
|
||
|
||
class IRCBRidgeService: | ||
class IRCBridgeService: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are not instance or class attributes nor constructor. I'm wondering if this shouldn't simply be a module ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could, that's in spirit of the bind-operator, it has a similar class (BindService) without a constructor or attributes. Propose to leave it as is for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but let's track the change in a ticket
"-c", | ||
f"[[ -f {IRC_BRIDGE_REGISTRATION_FILE_PATH} ]] || " | ||
f"matrix-appservice-irc -r -f {IRC_BRIDGE_REGISTRATION_FILE_PATH}" | ||
f" -u https://{matrix.host}:{IRC_BRIDGE_HEALTH_PORT} " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we intend to route traffic to the bridge machine ?
If they share the same host as matrix, then we need a reverse proxy in front of both that will route based on path or port since the hostname will resolve to the same IP for both synapse and the bridge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well spotted, this is not correct, it should be the address where the Matrix homeserver can contact the bridge. It can be a config option if we use an FQDN or an IP that is reachable from Matrix, wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeap that's tricky... the machine needs either to be accessible publicly or internally, and it should support HTTPS meaning you need either a TLS termination or support the TLS relation in the bridge :\
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depends on the communication flow, I think Matrix and the bridge talk to each other, soo it could be private? And the public part between the IRC network and the bridge happens over the Mattix homeserver. Need to check, you raised a very good point here.
Test coverage for 157d588
Static code analysis report
|
Merged as discussed - follow up work in the feat/add-plugins-lib where the rest of the comments are addressed. The failing test is due to a snap issue that is waiting to be resolved via a manual approval in the snap store (usage of a privileged interface). |
Applicable spec:
Overview
Adds a db relation and handling.
Rationale
Juju Events Changes
Module Changes
Library Changes
Checklist
src-docs
urgent
,trivial
,complex
)