Charm should be reinitialized at every hook execution in Harness
See original GitHub issueMore specifically, before every hook execution. Point is: when a ‘real’ charm runs, it is reinitialized afresh. While if you do fire eventA and eventB on the harness, the harness won’t reinitialize the charm it holds in between, which may result in some major behavioural differences between a live charm and a harness’d charm.
Use cases include:
class Charm(CharmBase):
def __init__(self):
self.relation1 = relation1 = RelationRequirer()
self.relation2 = RelationProvider(relation1.data[self.unit])
class Charm(CharmBase):
def __init__(self):
if self.container.can_connect():
self.framework.observe(self.on.foo, self._foo)
Concrete example of an affected charm: https://github.com/canonical/prometheus-k8s-operator/blob/main/src/charm.py
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:13 (13 by maintainers)
Top Results From Across the Web
Troubleshooting - Harness.io Docs
This section lists common errors you might receive when Harness attempts to collect artifacts. Workflow Hanging on Artifact Collection. If ...
Read more >Charm hooks - doc - Charmhub - Juju Discourse
All the hooks must be written to be idempotent, meaning that there should be no different from running the hook once from running...
Read more >Integration - Juju
Peer integrations. Charms can declare peer integrations, which causes each unit of an application to respond to the other units deployed in the...
Read more >moving squid NS/KNF to magma folder (fd7b74ee) · Commits · vnf ...
Now when executing `curl https://www.google.com` squid will block access to the url ... magma/hackfest_squid_cnf/charms/squid/hooks/install 0 → 120000.
Read more >Leading Blog: A Leadership Blog - LeadershipNow.com
Charming, kind, soft-spoken, and very approachable—in a word, humble. ... All relationships can change over time, even the good ones.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Defer also sneaks its way into this. Deferred evens are run together on the same charm instance/setup as the event that comes in and triggers them.
(at a minimum, relating A to B should not require that B knows the names of the endpoints of charm A. That is certainly an abstraction break)