Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Carlos
@nzlosh
@sijis:matrix.org Do you build and upload the wheel manually to pypi? I can't seem to find any reference to it in github actions. From what I've read, one way to address this issue would be to build two versions of the wheel, one that is tagged with py37.py38 built using py3.7 or py3.8 and another tagged with py39.py310 built using py3.9 or py3.10. I'm not sure if the original wheel tagged with py3 would need to be taken down or if pip will select the most specific version first.
2 replies
Nyior Clement Jr.
@Nyior

I'm stuck trying to post the payload received by a webhook function to a Mattermost channel. This is what my webhook function looks like:

@webhook
 def github_issues(self,  payload):
       self.log.debug(repr(payload))
       return(payload)

Expected Outcome: I expect that return(payload) should forward the received payload to the Mattermost channels I've added my bot to. My bot account currently sits in two Mattermost channels

How it's Working Out: The payload is reaching the function, but it's not being forwarded to the channels I've added the bot to.

Is there anything I need to fix in the function or anywhere to make this arrangement work?

Carlos
@nzlosh
Take another look at the webhook documentation, it doesn't work like you're expecting https://errbot.readthedocs.io/en/latest/user_guide/plugin_development/webhooks.html. There is an example in the documentation how to send messages to the backend when the webhook is called.
Nyior Clement Jr.
@Nyior
@nzlosh Thank you :) I figured out I had to use send() to push data to the backend. This is my updated function just in case someone else needs it:
    @webhook
    def github_issues(self, payload):
        for room in self.rooms():
            self.send(
                self.build_identifier(f"~{room.name}"),
                'Title: Issue {0}!\n Issue URL: {1}'.format(payload['action'], payload['issue']['url']),
            )
Carlos
@nzlosh
:thumbsup: Good stuff and thanks for sharing.
sijis
@sijis:matrix.org
[m]
Ya, it shouldn't. I think the package will include the version of python
sijis
@sijis:matrix.org
[m]
@nzlosh: I've uploaded a specific py37 wheel. https://pypi.org/project/errbot/6.1.9/#files.
Carlos
@nzlosh
Thanks so much for sorting that out @sijis:matrix.org I'll test it shortly
Carlos
@nzlosh

Just tested a clean install of errbot 6.1.9 using a py37 virtualenv and it works as expected. Tested under py38, it fails.

errbot -h
Traceback (most recent call last):
  File "/root/virtualenv/errbot_py38/bin/errbot", line 5, in <module>
    from errbot.cli import main
  File "/root/virtualenv/errbot_py38/lib/python3.8/site-packages/errbot/cli.py", line 27, in <module>
    from errbot.bootstrap import CORE_BACKENDS
  File "/root/virtualenv/errbot_py38/lib/python3.8/site-packages/errbot/bootstrap.py", line 10, in <module>
    from errbot.plugin_manager import BotPluginManager
  File "/root/virtualenv/errbot_py38/lib/python3.8/site-packages/errbot/plugin_manager.py", line 8, in <module>
    from graphlib import CycleError
ModuleNotFoundError: No module named 'graphlib'

pip pulled in the py3 wheel.

(errbot_py38) root@u2004:~# pip install errbot
Collecting errbot
  Downloading errbot-6.1.9-py3-none-any.whl (198 kB)
Carlos
@nzlosh
Installation under python3.9 doesn't have a wheel for dulwich, so installing errbot requires a compiler and python headers to be present on the machine. I don't know if we consider this an errbot issue.
      dulwich/_objects.c:22:10: fatal error: Python.h: No such file or directory
         22 | #include <Python.h>
            |          ^~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> dulwich

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Installation under py310 works perfectly.
sijis
@sijis:matrix.org
[m]
Seems like I have to do one for each py version. Not a problem
Carlos
@nzlosh
Yeah, it seems to be one of the biggest pain points when supporting multiple Python versions.
sijis
@sijis:matrix.org
[m]
uploaded a py38 version.
the issue is mainly because of the version dependency of https://github.com/errbotio/errbot/blob/master/setup.py#L45-L46
1 reply
sijis
@sijis:matrix.org
[m]
we'll have to slim down the supported versions to simplify this a bit.
kennedy
@kennedy
I am using errbot for an internal ChatOps, and I am looking into publishing my plugins to a private repo. Is there away to have errbot to automatically install a list of plugins during startup?
sijis
@sijis:matrix.org
[m]

Yes, as part of your build process you can clone the repo and put it in the plugins directory.

You could also setup the server to use a private key/token that accesses your repo too

javabipe
@javabipe
hi
how are you?
sijis
@sijis:matrix.org
[m]
Setuptools does a good enough job in doing dependencies for version. It's not done much at all either,so its a matter of remembering to build those out when cutting a release. It's really easy actually
@javabipe: hello. Welcome
Carlos
@nzlosh
Fair enough. It would be great if we could automate the build process with GitHub actions. It could be triggered to build all the python versions when a commit is tagged with a semver number.
sijis
@sijis:matrix.org
[m]
auto-builds docker images and pushes to latest -> errbotio/errbot#1577
Carlos
@nzlosh
Great work, thanks sijis.
sijis
@sijis:matrix.org
[m]
Cleaning up documentation warnings => errbotio/errbot#1582
Starting to remove built-in slack backend in favor for v3 -> errbotio/errbot#1581
Jothimani
@JothimaniRkrish_twitter
Hello All,
need some help here pls,
  • is there a health check param to monitor BOT's health apart from infra metrics
  • also instead of sentry can I use something else for exception monitoring. Dynatrace, Datadog etc.
sijis
@sijis:matrix.org
[m]

@JothimaniRkrish_twitter: you can create your own webhook for a healthcheck.

For exception handling, not at a core level. You can configure custom/internal plugins to use whatever apm system of your choice.

Jonathan Linenberg
@johnclark84
Hi guys,
I got an error trying to lunch an event from slack. I'm using slack backend v3 with socket mode:
errbot    | 2022-06-29 14:57:08,698 ERROR    slack_sdk.socket_mode.builtin.client Failed to run a request listener: 'event'
errbot    | Traceback (most recent call last):
errbot    |   File "/usr/local/lib/python3.8/site-packages/slack_sdk/socket_mode/client.py", line 143, in run_message_listeners
errbot    |     listener(self, request)  # type: ignore
errbot    |   File "/home/errbot/backends/slackv3/slackv3.py", line 377, in _sm_generic_event_handler
errbot    |     self._generic_wrapper(req.payload)
errbot    |   File "/home/errbot/backends/slackv3/slackv3.py", line 357, in _generic_wrapper
errbot    |     event = event_data["event"]
errbot    | KeyError: 'event'
Carlos
@nzlosh
What event was sent that triggered the error? Do you have an example of it that you can share?
Carlos
@nzlosh
I've responded in the github issue you created.
sijis
@sijis:matrix.org
[m]
I'm curious of exactly what are you trying to accomplish. What is the exact flow/step/process going on? Something like
  • I have bot command .command opt1
  • that's suppose to "do something"
  • its partially working / or getting an error
Jonathan Linenberg
@johnclark84
@nzlosh @sijis:matrix.org my objective is open a slack modal from slack shortcut, so basis in what I read, I need to reply this event with the view.opens payload so Slack can open it. I'm trying to deploy some modals for creating a incident and capture the inputs fields to I can pass them to Jira plugin and create an issue with the data
Matt McLane
@mmclane
Morning everyone.
I have been having issues with getting the poller to start for a couple days. Would anyone be able to help me with it?
Mark Sullivan
@marksull
@mmclane you will have to provide more details before we can offer any advice
Carlos
@nzlosh
@marksull Matt is referring to this issue errbotio/errbot#1586
I've not had time to dig into the details. It looks like there's double initialisation going on. My current guess is something to do with the use of super() but that's all I've got for now.
Mark Sullivan
@marksull
@mmclane you shouldn't be doing the super().activate in your pagerduty_activate() method because activate() would have already been called when the plugin loaded. The only time you would want to do the super().activate() is if you were overriding activate with your own implementation, for example, if you wanted to call your_method every 60 seconds and wanted to start this as soon as the plugin was started.
def activate(self):
         super().activate()
         self.start_poller(60, self.your_method, 1)
Carlos
@nzlosh
Nicely explained! Thanks @marksull :thumbsup:
Matt McLane
@mmclane
Thank you for the answer
Matt McLane
@mmclane
When I remove the statement super().activate(), my activate() function does run but I don't see the results of the scheduled function which leads me to think that the poller isn't running.
Matt McLane
@mmclane
I had tried to remove the super().activate() statement but I didn't see the start_poller() function working so I figured it was needed since it was in the documentation.
I updated my github issue with an example.
sijis
@sijis:matrix.org
[m]

I haven't looked at your example, but I can say the core plugin that checks for latest version uses a poller.

https://github.com/errbotio/errbot/blob/master/errbot/core_plugins/vcheck.py

Matt McLane
@mmclane
Thanks.. I think I am starting to figure out what the problem was. I think it didn't seem like it was running because I was using yield to send messages and instead I need to use send. That wasn't very clear.
Matt McLane
@mmclane
Thanks for the help. You can see my solution here: https://github.com/mmclane/gir/tree/main/plugins/pagerduty
Its not perfect but I think its working.