-
Notifications
You must be signed in to change notification settings - Fork 3
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
GitHub workflow for validating terraform deploy
+ upgrading charms
#81
base: main
Are you sure you want to change the base?
Conversation
…teful stuff from the charm implementation
@@ -1,8 +1,34 @@ | |||
name: test-observer-api |
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 migrated to the new one-yaml format.
backend/charm/src/faults.py
Outdated
class UnitReadinessFault: | ||
"""A ReadinessFault describes the reason for a unit not to be ready.""" | ||
|
||
def __init__(self, reason: str, parent=None): |
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 experienced a Python noob issue here that I worked around by ignoring type hinting the parent
here: I tried adding a type hint parent=UnitReadinessFault | None
here but VS Code with mypy running didn't appreciate that. I also tried stringifying it, which made VS Code happy but caused a runtime issue with "str" | None
being taken at charm runtime to be the type.
if not self.unit.is_leader(): | ||
raise SystemExit(0) |
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 moved away from this needless SystemExit(0)
business everywhere I saw.
terraform deploy
terraform deploy
and charm upgrading
terraform deploy
and charm upgradingterraform deploy
+ upgrading charms
"python.analysis.extraPaths": [ | ||
"./backend/charm/lib" | ||
], | ||
"cmake.sourceDirectory": "/home/mz2/Developer/test_observer/frontend/linux" |
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.
are you sure about including this path to settings?
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.
Yes, this was intentional since VS Code looked like it was now doing relative path updates. However, what I committed was the wrong state of the file 🤦
backend/charm/src/charm.py
Outdated
self._update_layer_and_restart(None) | ||
|
||
def _on_database_relation_broken(self, event): | ||
self.unit.status = WaitingStatus("Waiting for database relation") | ||
self.unit.status = WaitingStatus("Waiting for database relation after breaking relation") | ||
raise SystemExit(0) |
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.
can you use sys.exit(0)
instead?
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.
Neither should be done, it should just return.
terraform deploy
results in a successful deploy on a fresh microk8s cloud.metadata.yml
and moves all the charm metadata to the moderncharmcraft.yml
only format.online
state check (see https://github.com/canonical/pebble#layer-specification) to the backend charm.