-
Notifications
You must be signed in to change notification settings - Fork 617
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
Updating plugin config from within the plugin itself #1305
Comments
Hi,
in the log info i can see, that the config object contains the added value, but when i run If i add a command:
The new value is listed as part of the config. So |
I think this is related to #910. What kind of storage are you guys using? |
I'm using the default, which is STORAGE = 'Shelf' |
@bschacht Could you please check what |
hm, it returns |
@sheluchin All i get when i try is: |
Ah, now that @zaughon mentioned the persistent storage, i must admit that i was mistaken- the |
What about running What I suspect is that somewhere along the way, the configuration dict is not being updated correctly, such that the inherited errbot/errbot/storage/__init__.py Lines 43 to 61 in 77231b2
Using the errbot/errbot/plugin_manager.py Lines 343 to 347 in adc13ef
For example, doing It's worth pointing out that configuration is not stored in the plugin's persistent storage, but rather in the
If you guys are just trying to provision your plugins without having to manually do it through chat, there are instructions on how to do that http://errbot.io/en/latest/user_guide/provisioning.html, but from my testing in #910, it doesn't work. I posted #1311 last night, which seems to resolve the issue and does produce working results when using the approach suggested in the link:
That will save a new configuration for the |
(i had added ch1 and ch1 using the
Yeah, thats my impression too. But i don't know errbot good enough to find a workaround
You mean fixing that in the plugin manager or somehow in our modules?
Actually what i'm trying to do is make configuration of a plugin easier- if i have a list of 30 channels in my config, it would be easier to have a |
@sheluchin For the test bot mentioned in the initial description, that gives me: If i try to update that using I'm also under the impression that it's not being updated correctly in the storage, so it doesn't actually persist, but also not sure how exactly to fix that. |
@zaughon I'd like to try to test out your example plugin and try to fix it. I'll see if I can get around to it sometime soon - maybe tonight. If you could confirm that the issue persists with Errbot 6.0.0, which was released over the weekend, it would really be helpful. See https://github.com/errbotio/errbot/blob/master/CHANGES.rst. |
@sheluchin Seems to be the same issue:
It's still not stored to the actual configuration of the plugin, it's just sort of stored in self.config, but not permanently. This is my Example plugin atm:
|
@zaughon I made some progress, but not quite done yet. Try this: @botcmd()
def setconf(self, msg, args):
self._bot.plugin_manager.set_plugin_configuration(
self.name,
getattr(self, 'config', self.CONFIG_TEMPLATE)
)
self.configure({'USERNAME': args}) |
That specific code doesn't help, it still gives the old config:
However, if i move
|
In order to let us help you better, please fill out the following fields as best you can:
I am...
I am running...
Issue description
I'm trying to figure out whether there's a way to trigger a plugin config update in a different way than the usual
!plugin config NAME CONFIG
.I've tried creating this plugin:
But it doesn't seem to work properly. When you run the setconf command, it shows that it has been updated afterwards, but if you then run !plugin config Example to get the currently config, it's still the old configuration.
Steps to reproduce
!plugin config Example
!setconf
command!plugin config Example
During the !setconf command, it will:
Is there any way to update the configuration from a different function? Did i do something wrong?
My plan is to create a poller that checks for updates for a few CMS-systems, and then automatically updates the config.
Additional info
If you have any more information, please specify it here.
The text was updated successfully, but these errors were encountered: