@reactive.when('charm.installed')
@reactive.when('db-router.connected')
def db_router_request(db_router):
"""Send DB Router request to MySQL InnoDB Cluster.
Using the db-router interface send connection request.
So, basically, charms.reactive is calling db_router_request() without the db_router arg which is supposed to come from "@reactive.when('db-router.connected')"
So it looks like a bug in charms.reactive.
Typically, 'easy' fixes are to do:
@reactive.when('charm.installed')
@reactive.when('db-router.connected')
def db_router_request():
db_router = reactive.relations.endpoint_from_flag('db-router.connected')
if not db_router:
return
with charm.provide_charm_instance() as instance:
Either way, it looks like the current pattern in the code isn't robust enough to work around the issue in charms.openstack.
Note: charms.reactive is unlikely to be updated, particularly when we can work around it.
re:
> Alex, can you help me show me the latest commits of rev108 and rev111 in the https://opendev.org/openstack/charm-mysql-router/ repository? Or those two versions are coming from different branches during charm release?
So latest/edge is build from the "master" branch, whereas 8.0/stable is built from the stable/jammy branch.
But I don't think this error is due to the mysql-router code, per se, but rather something odd going on in charms.reactive when doing the juju switch.
So the bug output is this:
unit-keystone- mysql-router- 1: 16:16:00 WARNING unit.keystone- mysql-router/ 1.upgrade- charm self._action(*args) mysql-router- 1: 16:16:00 WARNING unit.keystone- mysql-router/ 1.upgrade- charm TypeError: db_router_request() missing 1 required positional argument: 'db_router'
unit-keystone-
and the (joint) code in question is:
@reactive. when('charm. installed' ) when('db- router. connected' ) request( db_router) :
@reactive.
def db_router_
"""Send DB Router request to MySQL InnoDB Cluster.
Using the db-router interface send connection request.
:param db_router: DB-Router interface interface: MySQLRouterRequires object
:type db_router_
"""
So, basically, charms.reactive is calling db_router_request() without the db_router arg which is supposed to come from "@reactive. when('db- router. connected' )"
So it looks like a bug in charms.reactive.
Typically, 'easy' fixes are to do:
@reactive. when('charm. installed' ) when('db- router. connected' ) request( ): relations. endpoint_ from_flag( 'db-router. connected' ) charm_instance( ) as instance:
@reactive.
def db_router_
db_router = reactive.
if not db_router:
return
with charm.provide_
As to why it is doing this; I guess we'd need to look at charms.reactive. It could be due to either a race in the interface (https:/ /github. com/juju- solutions/ charms. reactive/ issues/ 231#issuecommen t-775325418) or something not quite right during the upgrade in the sqlite db: https:/ /github. com/juju- solutions/ charms. reactive/ issues/ 221
Either way, it looks like the current pattern in the code isn't robust enough to work around the issue in charms.openstack.
Note: charms.reactive is unlikely to be updated, particularly when we can work around it.
re:
> Alex, can you help me show me the latest commits of rev108 and rev111 in the https:/ /opendev. org/openstack/ charm-mysql- router/ repository? Or those two versions are coming from different branches during charm release?
So latest/edge is build from the "master" branch, whereas 8.0/stable is built from the stable/jammy branch.
But I don't think this error is due to the mysql-router code, per se, but rather something odd going on in charms.reactive when doing the juju switch.