【问题标题】:Errbot: getting yapsy error when trying to configure plugins via command line interfaceErrbot:尝试通过命令行界面配置插件时出现 yapsy 错误
【发布时间】:2017-03-01 03:25:41
【问题描述】:

我的目标是利用 puppet 初始化 errbot 的实例,以及通过脚本预配置插件。

我遵循了他们在此处找到的用户指南:

http://errbot.io/en/latest/user_guide/provisioning.html#reading-stored-values

但是我不断收到此错误:“被策略'SpecificBackendLocator'拒绝”

这是我的输出(我的 config.py 中的日志变量确实设置为 DEBUG):

        /opt/errbot$ /opt/errbot/bin/errbot --storage-get core
    05:30:46 INFO     errbot.cli                Config check passed...
    05:30:46 INFO     errbot.specific_plugin_ma storage search paths {'/opt/errbot/lib/python3.4/site-packages/errbot/storage', '/opt/errbot/extra/devops', '/opt/errbot/extra/weatherbot'}
    05:30:46 INFO     errbot.specific_plugin_ma Found those plugings available:
    05:30:46 INFO     errbot.specific_plugin_ma         Memory  (/opt/errbot/lib/python3.4/site-packages/errbot/storage/memory.py)
    05:30:46 INFO     errbot.specific_plugin_ma          Shelf  (/opt/errbot/lib/python3.4/site-packages/errbot/storage/shelf.py)
    05:30:46 INFO     errbot.specific_plugin_ma     DevOpsReactions  (/opt/errbot/extra/devops/devops.py)
    05:30:46 INFO     errbot.specific_plugin_ma     WeatherBot  (/opt/errbot/extra/weatherbot/weatherBot.py)
    05:30:46 INFO     errbot.bootstrap          Found Storage plugin: 'Memory'
    Description: This is the storage plugin for an in-memory store (non-persistent).
    05:30:46 WARNING  yapsy                     Plugin candidate '/opt/errbot/lib/python3.4/site-packages/errbot/storage/shelf.plug'  rejected by strategy 'SpecificBackendLocator'
    05:30:46 WARNING  yapsy                     Plugin candidate '/opt/errbot/extra/devops/devops.plug'  rejected by strategy 'SpecificBackendLocator'
    05:30:46 WARNING  yapsy                     Plugin candidate '/opt/errbot/extra/weatherbot/weatherbot.plug'  rejected by strategy 'SpecificBackendLocator'

{}

我尝试过的:

我尝试过使用“货架”和“内存”两种存储类型

我在 python2.7 和 3.4 中都运行过

我已经在这个论坛上搜索了所有与 errbot 相关的问题,我已经搜索了 github repo,以及搜索了我得到的错误。

我找不到任何可以帮助我解决问题的方法。

我不确定这更多是 errbot 模块的问题,还是它在我的 python 环境中的运行方式。任何朝着正确方向的推动将不胜感激。

********** 编辑****************

根据@gbin 的建议,我完全按照他的流程进行操作:

    vagrant@ops-hq-tools-chatops-app1:/opt/errbot/data$ sudo /opt/errbot/bin/errbot -c /opt/errbot/config.py -T
06:56:38 INFO     errbot.cli                Config check passed...
06:56:38 INFO     errbot.cli                Selected backend 'Text'.
06:56:38 INFO     errbot.cli                Checking for '/opt/errbot/data'...
06:56:38 INFO     errbot.specific_plugin_ma storage search paths {'/opt/errbot/lib/python3.4/site-packages/errbot/storage', '/opt/errbot/extra/devops'}
06:56:38 INFO     errbot.specific_plugin_ma Found those plugings available:
06:56:38 INFO     errbot.specific_plugin_ma         Memory  (/opt/errbot/lib/python3.4/site-packages/errbot/storage/memory.py)
06:56:38 INFO     errbot.specific_plugin_ma          Shelf  (/opt/errbot/lib/python3.4/site-packages/errbot/storage/shelf.py)
06:56:38 INFO     errbot.specific_plugin_ma     DevOpsReactions  (/opt/errbot/extra/devops/devops.py)
06:56:38 INFO     errbot.bootstrap          Found Storage plugin: 'Shelf'
Description: This is the storage plugin for the traditional shelf store for errbot.
06:56:38 DEBUG    errbot.specific_plugin_ma Refilter the plugins...
06:56:38 WARNING  yapsy                     Plugin candidate '/opt/errbot/lib/python3.4/site-packages/errbot/storage/memory.plug'  rejected by strategy 'SpecificBackendLocator'
06:56:38 WARNING  yapsy                     Plugin candidate '/opt/errbot/extra/devops/devops.plug'  rejected by strategy 'SpecificBackendLocator'
06:56:38 DEBUG    errbot.specific_plugin_ma Load the one remaining...
06:56:38 DEBUG    errbot.specific_plugin_ma Class to load ShelfStoragePlugin
06:56:38 DEBUG    errbot.storage            Opening storage 'repomgr'
06:56:38 DEBUG    errbot.storage.shelf      Open shelf storage /opt/errbot/data/repomgr.db
06:56:38 DEBUG    errbot.storage            Opening storage 'core'
06:56:38 DEBUG    errbot.storage.shelf      Open shelf storage /opt/errbot/data/core.db
06:56:38 INFO     errbot.specific_plugin_ma backends search paths {'/opt/errbot/lib/python3.4/site-packages/errbot/backends'}
06:56:38 INFO     errbot.specific_plugin_ma Found those plugings available:
06:56:38 INFO     errbot.specific_plugin_ma           Test  (/opt/errbot/lib/python3.4/site-packages/errbot/backends/test.py)
06:56:38 INFO     errbot.specific_plugin_ma        Graphic  (/opt/errbot/lib/python3.4/site-packages/errbot/backends/graphic.py)
06:56:38 INFO     errbot.specific_plugin_ma           Text  (/opt/errbot/lib/python3.4/site-packages/errbot/backends/text.py)
06:56:38 INFO     errbot.specific_plugin_ma       Telegram  (/opt/errbot/lib/python3.4/site-packages/errbot/backends/telegram_messenger.py)
06:56:38 INFO     errbot.specific_plugin_ma           XMPP  (/opt/errbot/lib/python3.4/site-packages/errbot/backends/xmpp.py)
06:56:38 INFO     errbot.specific_plugin_ma          Slack  (/opt/errbot/lib/python3.4/site-packages/errbot/backends/slack.py)
06:56:38 INFO     errbot.specific_plugin_ma        Hipchat  (/opt/errbot/lib/python3.4/site-packages/errbot/backends/hipchat.py)
06:56:38 INFO     errbot.specific_plugin_ma           Null  (/opt/errbot/lib/python3.4/site-packages/errbot/backends/null.py)
06:56:38 INFO     errbot.specific_plugin_ma            IRC  (/opt/errbot/lib/python3.4/site-packages/errbot/backends/irc.py)
06:56:38 INFO     errbot.bootstrap          Found Backend plugin: 'Text'
                        Description: This is the text backend for Err.
06:56:38 DEBUG    errbot.specific_plugin_ma Refilter the plugins...
06:56:38 WARNING  yapsy                     Plugin candidate '/opt/errbot/lib/python3.4/site-packages/errbot/backends/test.plug'  rejected by strategy 'SpecificBackendLocator'
06:56:38 WARNING  yapsy                     Plugin candidate '/opt/errbot/lib/python3.4/site-packages/errbot/backends/graphic.plug'  rejected by strategy 'SpecificBackendLocator'
06:56:38 WARNING  yapsy                     Plugin candidate '/opt/errbot/lib/python3.4/site-packages/errbot/backends/telegram_messenger.plug'  rejected by strategy 'SpecificBackendLocator'
06:56:38 WARNING  yapsy                     Plugin candidate '/opt/errbot/lib/python3.4/site-packages/errbot/backends/xmpp.plug'  rejected by strategy 'SpecificBackendLocator'
06:56:38 WARNING  yapsy                     Plugin candidate '/opt/errbot/lib/python3.4/site-packages/errbot/backends/slack.plug'  rejected by strategy 'SpecificBackendLocator'
06:56:38 WARNING  yapsy                     Plugin candidate '/opt/errbot/lib/python3.4/site-packages/errbot/backends/hipchat.plug'  rejected by strategy 'SpecificBackendLocator'
06:56:38 WARNING  yapsy                     Plugin candidate '/opt/errbot/lib/python3.4/site-packages/errbot/backends/null.plug'  rejected by strategy 'SpecificBackendLocator'
06:56:38 WARNING  yapsy                     Plugin candidate '/opt/errbot/lib/python3.4/site-packages/errbot/backends/irc.plug'  rejected by strategy 'SpecificBackendLocator'
06:56:38 DEBUG    errbot.specific_plugin_ma Load the one remaining...
06:56:38 DEBUG    errbot.specific_plugin_ma Class to load TextBackend
06:56:38 DEBUG    errbot.core               ErrBot init.
06:56:38 DEBUG    errbot.backends.base      Backend init.
06:56:38 DEBUG    errbot.core               created a thread pool of size 10.
06:56:38 DEBUG    errbot.backends.text      Text Backend Init.
06:56:38 DEBUG    MARKDOWN                  Successfuly imported extension module "markdown.extensions.smart_strong".
06:56:38 DEBUG    MARKDOWN                  Successfully loaded extension "markdown.extensions.smart_strong.SmartEmphasisExtension".
06:56:38 DEBUG    MARKDOWN                  Successfuly imported extension module "markdown.extensions.fenced_code".
06:56:38 DEBUG    MARKDOWN                  Successfully loaded extension "markdown.extensions.fenced_code.FencedCodeExtension".
06:56:38 DEBUG    MARKDOWN                  Successfuly imported extension module "markdown.extensions.footnotes".
06:56:38 DEBUG    MARKDOWN                  Successfully loaded extension "markdown.extensions.footnotes.FootnoteExtension".
06:56:38 DEBUG    MARKDOWN                  Successfuly imported extension module "markdown.extensions.attr_list".
06:56:38 DEBUG    MARKDOWN                  Successfully loaded extension "markdown.extensions.attr_list.AttrListExtension".
06:56:38 DEBUG    MARKDOWN                  Successfuly imported extension module "markdown.extensions.def_list".
06:56:38 DEBUG    MARKDOWN                  Successfully loaded extension "markdown.extensions.def_list.DefListExtension".
06:56:38 DEBUG    MARKDOWN                  Successfuly imported extension module "markdown.extensions.tables".
06:56:38 DEBUG    MARKDOWN                  Successfully loaded extension "markdown.extensions.tables.TableExtension".
06:56:38 DEBUG    MARKDOWN                  Successfuly imported extension module "markdown.extensions.abbr".
06:56:38 DEBUG    MARKDOWN                  Successfully loaded extension "markdown.extensions.abbr.AbbrExtension".
06:56:38 DEBUG    MARKDOWN                  Successfully loaded extension "markdown.extensions.extra.ExtraExtension".
06:56:38 DEBUG    MARKDOWN                  Successfully loaded extension "errbot.rendering.ansiext.AnsiExtension".
06:56:38 DEBUG    errbot.core               Initializing backend storage
06:56:38 DEBUG    errbot.storage            Opening storage 'text_backend'
06:56:38 DEBUG    errbot.storage.shelf      Open shelf storage /opt/errbot/data/text_backend.db
06:56:38 DEBUG    errbot.plugin_manager     All plugin roots:
06:56:38 DEBUG    errbot.plugin_manager     -> /opt/errbot/lib/python3.4/site-packages/errbot/core_plugins
06:56:38 DEBUG    errbot.plugin_manager     Add /opt/errbot/lib/python3.4/site-packages/errbot/core_plugins to sys.path
06:56:38 DEBUG    errbot.plugin_manager     -> /opt/errbot/extra/devops
06:56:38 DEBUG    errbot.plugin_manager     /opt/errbot/lib/python3.4/site-packages/errbot/core_plugins has no requirements.txt file
06:56:38 DEBUG    errbot.plugin_manager     /opt/errbot/extra/devops has no requirements.txt file
06:56:38 INFO     errbot                    webhooks:  Flag to bind /echo to echo
06:56:38 DEBUG    errbot.bootstrap          Start serving commands from the text backend

 >>> !plugin config Webserver                                                         
Default configuration for this plugin (you can copy and paste this directly as a command):
 !plugin config Webserver 
{'HOST': '0.0.0.0',
 'PORT': 3141,
 'SSL': {'certificate': '',
         'enabled': False,
         'host': '0.0.0.0',
         'key': '',
         'port': 3142}}

 Current configuration:
 !plugin config Webserver 
{'HOST': '0.0.0.0',
 'PORT': 3141,
 'SSL': {'certificate': '',
         'enabled': False,
         'host': '0.0.0.0',
         'key': '',
         'port': 3142}}


 >>> !plugin config Webserver {'HOST': '0.0.0.0', 'PORT': 3141, 'SSL': {'certificate': '', 'enabled': False, 'host': '0.0.0.0', 'key': '',  'port': 3142}}
Plugin configuration done.

到目前为止一切顺利,那么我确保使用 sudo 发出以下命令:

/opt/errbot/bin/errbot -c /opt/errbot/config.py --storage-get core
07:01:19 INFO     errbot.cli                Config check passed...
07:01:19 INFO     errbot.specific_plugin_ma storage search paths {'/opt/errbot/extra/devops', '/opt/errbot/lib/python3.4/site-packages/errbot/storage'}
07:01:19 INFO     errbot.specific_plugin_ma Found those plugings available:
07:01:19 INFO     errbot.specific_plugin_ma     DevOpsReactions  (/opt/errbot/extra/devops/devops.py)
07:01:19 INFO     errbot.specific_plugin_ma         Memory  (/opt/errbot/lib/python3.4/site-packages/errbot/storage/memory.py)
07:01:19 INFO     errbot.specific_plugin_ma          Shelf  (/opt/errbot/lib/python3.4/site-packages/errbot/storage/shelf.py)
07:01:19 INFO     errbot.bootstrap          Found Storage plugin: 'Shelf'
Description: This is the storage plugin for the traditional shelf store for errbot.
07:01:19 WARNING  yapsy                     Plugin candidate '/opt/errbot/extra/devops/devops.plug'  rejected by strategy 'SpecificBackendLocator'
07:01:19 WARNING  yapsy                     Plugin candidate '/opt/errbot/lib/python3.4/site-packages/errbot/storage/memory.plug'  rejected by strategy 'SpecificBackendLocator'
{'configs': {'Webserver': {'PORT': 3141, 'HOST': '0.0.0.0', 'SSL': {'host': '0.0.0.0', 'key': '', 'enabled': False, 'port': 3142, 'certificate': ''}}, 'giphy': {'API_KEY': 'test'}, 'WeatherBot': None}}

所以 --storage-get 函数按预期工作。但是,当我尝试 --storage-set/merge 时:

sudo echo "{'configs': {'Webserver': {'PORT': 9999}}}" | /opt/errbot/bin/errbot -c /opt/errbot/config.py --storage-merge core
07:02:46 INFO     errbot.cli                Config check passed...
07:02:46 INFO     errbot.specific_plugin_ma storage search paths {'/opt/errbot/lib/python3.4/site-packages/errbot/storage', '/opt/errbot/extra/devops'}
07:02:46 INFO     errbot.specific_plugin_ma Found those plugings available:
07:02:46 INFO     errbot.specific_plugin_ma         Memory  (/opt/errbot/lib/python3.4/site-packages/errbot/storage/memory.py)
07:02:46 INFO     errbot.specific_plugin_ma          Shelf  (/opt/errbot/lib/python3.4/site-packages/errbot/storage/shelf.py)
07:02:46 INFO     errbot.specific_plugin_ma     DevOpsReactions  (/opt/errbot/extra/devops/devops.py)
07:02:46 INFO     errbot.bootstrap          Found Storage plugin: 'Shelf'
Description: This is the storage plugin for the traditional shelf store for errbot.
07:02:46 WARNING  yapsy                     Plugin candidate '/opt/errbot/lib/python3.4/site-packages/errbot/storage/memory.plug'  rejected by strategy 'SpecificBackendLocator'
07:02:46 WARNING  yapsy                     Plugin candidate '/opt/errbot/extra/devops/devops.plug'  rejected by strategy 'SpecificBackendLocator'
Storage does not appear to have been opened yet

我收到此错误“存储似乎尚未打开。

我通过谷歌搜索错误找到了这个链接:

http://errbot.io/en/latest/_modules/errbot/storage.html

但我无法理解需要更改哪些内容才能合并或设置配置值。

【问题讨论】:

    标签: python python-3.x errbot chatops


    【解决方案1】:

    rejected by strategy 'SpecificBackendLocator' 是来自 yapsy 的误导性警告,它说插件不是它在循环所有插件时所看到的,这是正常行为。

    您为core 获得的条目是{},为空。只是你的 Errbot 实例还没有存储任何东西。

    例如查看此会话:

    (errbot)mymachine ➜  errbot (master) errbot -T
    08:36:27 INFO     errbot.cli                Config check passed...
    08:36:27 INFO     errbot.cli                Selected backend 'Text'.
    08:36:27 INFO     errbot.cli                Checking for '../errbot-data'...
    08:36:27 INFO     errbot.specific_plugin_ma storage search paths {'/home/gbinet/projects/errbot/errbot/storage'}
    08:36:27 INFO     errbot.specific_plugin_ma Found those plugings available:
    08:36:27 INFO     errbot.specific_plugin_ma          Shelf  (/home/gbinet/projects/errbot/errbot/storage/shelf.py)
    08:36:27 INFO     errbot.specific_plugin_ma         Memory  (/home/gbinet/projects/errbot/errbot/storage/memory.py)
    08:36:27 INFO     errbot.bootstrap          Found Storage plugin: 'Shelf'
    Description: This is the storage plugin for the traditional shelf store for errbot.
    08:36:27 WARNING  yapsy                     Plugin candidate '/home/gbinet/projects/errbot/errbot/storage/memory.plug'  rejected by strategy 'SpecificBackendLocator'
    08:36:27 INFO     errbot.specific_plugin_ma backends search paths {'/home/gbinet/projects/errbot/errbot/backends'}
    [...]
    08:36:27 INFO     errbot.bootstrap          Found Backend plugin: 'Text'
                                                    Description: This is the text backend for Err.
    08:36:27 WARNING  yapsy                     Plugin candidate '/home/gbinet/projects/errbot/errbot/backends/irc.plug'  rejected by strategy 'SpecificBackendLocator'
    [...]
    
    
     >>> !plugin config Webserver
    Default configuration for this plugin (you can copy and paste this directly as a command):
     !plugin config Webserver
    {'HOST': '0.0.0.0',
     'PORT': 3141,
     'SSL': {'certificate': '',
             'enabled': False,
             'host': '0.0.0.0',
             'key': '',
             'port': 3142}}
    
    
    
     >>> !plugin config Webserver {'HOST': '0.0.0.0', 'PORT': 3141, 'SSL': {'certificate': '', 'enabled': False, 'host': '0.0.0.0', 'key': '',  'port': 3142}}
    Plugin configuration done.
    
     >>> ^C
    

    这已经为插件“Webserver”存储了一个配置,然后你可以在从命令行转储所有配置时看到它:

    (errbot)mymachine ➜  errbot (master) errbot --storage-get core                                                                                                                                                                                                                                               
    08:37:54 INFO     errbot.cli                Config check passed...
    08:37:54 INFO     errbot.specific_plugin_ma storage search paths {'/home/gbinet/projects/errbot/errbot/storage'}
    08:37:54 INFO     errbot.specific_plugin_ma Found those plugings available:
    08:37:54 INFO     errbot.specific_plugin_ma          Shelf  (/home/gbinet/projects/errbot/errbot/storage/shelf.py)
    08:37:54 INFO     errbot.specific_plugin_ma         Memory  (/home/gbinet/projects/errbot/errbot/storage/memory.py)
    08:37:54 INFO     errbot.bootstrap          Found Storage plugin: 'Shelf'
    Description: This is the storage plugin for the traditional shelf store for errbot.
    08:37:54 WARNING  yapsy                     Plugin candidate '/home/gbinet/projects/errbot/errbot/storage/memory.plug'  rejected by strategy 'SpecificBackendLocator'
    
    
    {'configs': {'Webserver': {'PORT': 3141, 'SSL': {'enabled': False, 'port': 3142, 'key': '', 'host': '0.0.0.0', 'certificate': ''}, 'HOST': '0.0.0.0'}}}
    

    【讨论】:

    • 这行得通,但是我遇到了另一个错误“存储似乎尚未打开”,经过进一步审查,我用 sudo 重新运行“errbot --storage-get core”,它当前返回了所有存储的配置。谢谢!
    【解决方案2】:

    我做了你所做的,它对我有用。

    你的配置有什么特别的吗?

    (errbot)mymachine ➜  errbot (master) echo "{'configs': {'Webserver': {'PORT': 9999}}}" | errbot --storage-merge core                                                                                                                                                                                                   <<<
    14:22:12 INFO     errbot.cli                Config check passed...
    14:22:12 INFO     errbot.specific_plugin_ma storage search paths {'/home/gbinet/projects/errbot/errbot/storage'}
    14:22:12 INFO     errbot.specific_plugin_ma Found those plugings available:
    14:22:12 INFO     errbot.specific_plugin_ma          Shelf  (/home/gbinet/projects/errbot/errbot/storage/shelf.py)
    14:22:12 INFO     errbot.specific_plugin_ma         Memory  (/home/gbinet/projects/errbot/errbot/storage/memory.py)
    14:22:12 INFO     errbot.bootstrap          Found Storage plugin: 'Shelf'
    Description: This is the storage plugin for the traditional shelf store for errbot.
    14:22:12 WARNING  yapsy                     Plugin candidate '/home/gbinet/projects/errbot/errbot/storage/memory.plug'  rejected by strategy 'SpecificBackendLocator'
    
    (errbot)mymachine ➜  errbot (master) errbot --storage-get core
    14:22:57 INFO     errbot.cli                Config check passed...
    14:22:57 INFO     errbot.specific_plugin_ma storage search paths {'/home/gbinet/projects/errbot/errbot/storage'}
    14:22:57 INFO     errbot.specific_plugin_ma Found those plugings available:
    14:22:57 INFO     errbot.specific_plugin_ma          Shelf  (/home/gbinet/projects/errbot/errbot/storage/shelf.py)
    14:22:57 INFO     errbot.specific_plugin_ma         Memory  (/home/gbinet/projects/errbot/errbot/storage/memory.py)
    14:22:57 INFO     errbot.bootstrap          Found Storage plugin: 'Shelf'
    Description: This is the storage plugin for the traditional shelf store for errbot.
    14:22:57 WARNING  yapsy                     Plugin candidate '/home/gbinet/projects/errbot/errbot/storage/memory.plug'  rejected by strategy 'SpecificBackendLocator'
    {'configs': {'Webserver': {'PORT': 9999}}}
    

    【讨论】:

    • 好吧,这看起来像以前的权限问题。我在错误的地方使用了 sudo。当我使用echo "{'configs': {'Webserver': {'PORT': 9999}}}" | sudo /opt/errbot/bin/errbot -c /opt/errbot/config.py --storage-merge core 或者只是进入“sudo su”时它可以工作。再次感谢您的帮助!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-26
    • 1970-01-01
    • 2021-07-11
    相关资源
    最近更新 更多