Skip to content

Commit 8b08293

Browse files
Upgrade trusted to use new facade method
Application facade has a new method for calling configuration values on it. Use that instead of the old way. This is a breaking change if you're using it from pylibjuju and we should probably be aware of that in the future. Luckily the fix is to just use the latest pylibjuju with this fix in it.
1 parent db3f255 commit 8b08293

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

juju/application.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,18 @@ async def set_trusted(self, trust):
394394
log.debug(
395395
'Setting config for %s: %s', self.name, config)
396396

397-
return await app_facade.SetApplicationsConfig(args=[{
397+
# Unfortunately we have to do this in a lazy fashion, attempting to use
398+
# the method early will cause an error. Attempting to call this
399+
# dynamically causes issues with how the client code is wired up... we
400+
# end up with a missing _toPy attr.
401+
# Using a lambda to only throw it away when it's wrong seems a problem
402+
# as well.
403+
config_method = None
404+
if self._facade_version() < 13:
405+
config_method = app_facade.SetApplicationsConfig
406+
else:
407+
config_method = app_facade.SetConfigs
408+
return await config_method(args=[{
398409
"application": self.name,
399410
"config": config,
400411
}])

0 commit comments

Comments
 (0)