Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Nicholas Amorim
@nicholasamorim
I manage to get it working by actually ignoring the module:command or module:* and just using a plain string as st2*
But I'd like first to set up a "deny all" directive. Shouldn't this work?
ACCESS_CONTROLS_DEFAULT = {
    "*": {"denyusers": ("*",)}
}
Nicholas Amorim
@nicholasamorim
Well, as we have a small subset of users that can use the bot anyways, I used allowusers with this list... that worked
ahmadhaidarahmad
@ahmadhaidarahmad
hi
Carlos
@nzlosh
Has anyone used the Dynamic Command with arg_botcmd to register bot commands? I'm trying to figure out how to provide multiple arguments.
Carlos
@nzlosh
To give more detail around my question, this is method signature and decorations I'd like to convert to a call using Command()
    @arg_botcmd("--pack", dest="pack", type=str)
    @arg_botcmd("--filter", dest="filter", type=str)
    @arg_botcmd("--limit", dest="limit", type=int)
    @arg_botcmd("--offset", dest="offset", type=int)
    def st2help(self, msg, pack=None, filter=None, limit=None, offset=None):
Sijis Aviles
@sijis
So you want to remove the arg_botcmd?
Carlos
@nzlosh
Yes, the reason for removing the arg_botcmd was to allow users to supply a command prefix value in config.py. I was unable to reference the value using the decorator pattern so used the dynamic commands option. This was straightforward for botcmd and re_botcmd but using Command I've been unable to find the correct way to call arg_botcmd so that it adds all argparse definitions to the command. Here's the code I'm talking about https://github.com/nzlosh/err-stackstorm/blob/cddfc4e9bbe229f1bba7acb58309b5859c66b302/st2.py#L397
Rashidul Hasan
@rashidul-hasan
I'm trying errbot with slack backend. is there any way I can embed some kind of form to collect some inputs from users?
Carlos
@nzlosh
@rashidul-hasan Errbot comes with Python Flask webserver. You can enable it and define webooks in your code. https://errbot.readthedocs.io/en/latest/user_guide/plugin_development/webhooks.html
Carlos
@nzlosh
If anyone is interested, I figured out how to get arg_botcmd to work with the Command object, although it breaks encapsulation :( I'm considering creating a pull request to add a method to the Command class, so that plugins can call the method without knowing the arg_botcmd implementation details. Code's here https://github.com/nzlosh/err-stackstorm/blob/48bf7068537a579325de0e741ed80550cb33e4c8/st2.py#L401
Sijis Aviles
@sijis
I'd say put up the PR. It can at least be looked at.
Carlos
@nzlosh
OK, I'll put one together in the next couple of days. How are release cycles decided?
Sijis Aviles
@sijis
As needed. Nothing firm.
Carlos
@nzlosh
Just created a pull request to add the feature.
Mark Sullivan
@marksull

I have a philosophical question. Been using Errbot for a few years and I am the developer of the Cisco Webex Teams backend. By FAR the most common question/issue I get from new users of Errbot relates to the misconfiguration of on an errbot setting that is expected to be a tuple. I know that it is spelled out at the top of the template, but alas while it might be read, it doesn't have the desired impact:

# Note: Various config options require a tuple to be specified, even 
# when you are configuring only a single value. An example of this is
# the BOT_ADMINS option. Make sure you use a valid tuple here, even if
# you are only configuring a single item, else you will get errors.
# (So don't forget the trailing ',' in these cases)

The definition of a tuple with a single element that requires a trailing comma is one of the most annoying Python idiosyncracies that can certainly be lost on those newer to the language.

So my question is; if I created a Pull Request that put normalisation around those settings, would it be considered a suitable solution and in alignment with the goals of this project? My goal here is to improve the chance of a newbie getting it right the first time. For example:

def must_be_tuple(value):
    if isinstance(value, str):
      return tuple(value)
    return value

Or would you be more inclined to support validation of the data during bootstrap that raises a ValueError if the settings in settings are not Tuples?

if not isinstance(confit.BOT_ADMINS, tuple):
     raise ValueError('BOT_ADMINS must be defined as a tuple in config.py.')

I would be happy either way that avoids the current solution of just loading the data when it will eventually cause other issues.

Carlos
@nzlosh
@marksull I've implemented both approaches in various projects. I tend to lean towards data validation with an error message rather than tweaking sloppy configuration. I think a short feedback loop and highlighting user error gives people a chance to learn from their mistakes. That all said, I find importing a Python module isn't the most typical way to configure an application and leaves a lot of room for abuse/error. I guess there are good reason/advantages to taking such an approach.
Mark Sullivan
@marksull
thanks, I'll put in a pull request to raise errors on errbot bootstrap when the settings that require tuples have instead provided strings
gabmac
@gabmac
hi\
hi
gabmac
@gabmac
!hello
Guillaume Binet
@gbin
I just fixed the intermediate domain problem. Sorry again for all the downtime on this. It should be more stable now.
Carlos
@nzlosh
Thanks @gbin, how do I request TravisCI to re-run the unit test for my pull request?
zinob
@zinob

I am probably doing some thing stupid but i have this flow

        requested = flow.connect('server_reboot', auto_trigger=True)
        confirm_dead = requested.connect('confirm',predicate=lambda x: False)
        confirm_alive = requested.connect('really')

after running !server_reboot i get a message that i can continue with !confirm Wait what? shouldnt that predicate ensure that i cant?

zinob
@zinob
Wait. it auto-flows the the new npde if a predicate matches? But without triggering the corresponding function.. Oh that was... odd
So when i set the lambda to True it enters the "confirm" node, which has no children and thus terminates... I think?
Sijis Aviles
@sijis
@nzlosh if you rebase a new ci build will trigger. I thought you can go I to Travis ui and kick it there too.
Carlos
@nzlosh
Thanks @sijis I ended up doing that (I think I messed up one of the rebases ... I'll wait and see if it's a blocker).
Ahmed Sakr
@AhmedSakrr
hello there .. any python developer have knowledge in requests library ?
pm me
Rashidul Hasan
@rashidul-hasan
I'm trying to deploy Errbot on appengine.Errbot needs the data directory to be writable but an appengine instance's local filesystem is not writable. Is there any way to work around this?
Carlos
@nzlosh
@rashidul-hasan I don't know for sure as I've never used it but errbot supports SQL backends, perhaps using a database rather than filesystem to store persistent state will work?
Sijis Aviles
@sijis
That'll just store the plugin contents and configs. The filesystem is basically needed for logs and plugin code.
Carlos
@nzlosh
Good point, in that case, a remote filesystem with read/write access would probably be needed. NFS, SMB or anything else that can be mounted as a POSIX file system.
Stefano Ortolani
@ostefano
I am trying to have my bot (backend slack) accepting files as part of a command. However it seems to me that the backend (slack) is not really ready for that. Actually, I don't any other backend implementing this (files shared from user to bot). Any idea or hint where should I start extending errbot?
Carlos
@nzlosh
@ostefano As I understand it, you'd need to implementing the callback_stream method in the slack backend. https://github.com/errbotio/errbot/blob/8c3d74995e316a14870527901ce89f2733691c53/docs/user_guide/plugin_development/streams.rst
Stefano Ortolani
@ostefano
Implementing in the plugin, and using it in the slack backend I presume. But I would need some directions or hints if available.
Eric Fode
@ericfode

Hello! I made a plugin that lets you make subscription hooks to a pubsub channel https://github.com/ericfode/err-pubsub. You use it like this

from errbot.botplugin import BotPlugin
import err_pubsub.pubsub as ep


class APubSubber(BotPlugin):
    @ep.subhook(sub='test-sub', project='test-gcp-project')
    def afunc(self,mesg):
        self.log.info("in the message")
        self.log.info(mesg)
        mesg.ack()


    def activate(self):
        super().activate()
        pm = self._bot.plugin_manager
        pm.reload_plugin_by_name('Pubsub')

I was wondering if I might get some advice about how to get rid of the hack i have in activate to make it so that the pubsub plugin can find the tagged function in the APubSubber class the same way the webserver plugin does (I realize that plugin has a hack in the init.py file that makes it possible) just wondering if i might be able to accomplish something similar.

Rashidul Hasan
@rashidul-hasan
@ostefano I'm in the exact same position as you. need to make file upload work with Slack. Please let me know if you want to do a fork. I would love to colab
Redundancy Disorder
@redundancydisorder
Having an issue !repos update all fails with 'BotPluginManager' object has no attribute 'getAllPlugins' Which looks like the refactor at some point made repo update reference a value that was in ._bot but is not in ._bot.plugin_manager for plugin in self._bot.plugin_manager.getAllPlugins(): in plugins.py
Carlos
@nzlosh
@redundancydisorder Could you open an issue or PR on github for the problem?
Redundancy Disorder
@redundancydisorder
I was going to but I saw this old closed issue errbotio/errbot#1256 that referenced it as legacy code. So is it a known issue that has not been addressed yet.. Which means !repos update all has been broken for a really long time or is it something else.
Carlos
@nzlosh
It looks the original author gave up after the reviewers asked to use a reference rather than a subclass. I don't the history behind this, but if you're on the lastest version of errbot and think the feature is worth while, there's a good chance a PR that conforms to what the reviewers asked for would be accepted as they liked the concept.
Redundancy Disorder
@redundancydisorder
I was bashing away at a fix but I keep making it worse. More coffee might help.
Sijis Aviles
@sijis
@redundancydisorder I was banging away and got it sorta working again. I can put up a PR tomorrow, if you are willing to test it.
I'm not familiar with that part of the codebase, so it's hack-a-mole.
Redundancy Disorder
@redundancydisorder

I have a working solution based off of some of the code form that closed issue (errbotio/errbot#1256) I need to put my code into github and make a merge request.

BUT and this is a BIG BUT... I found a problem with the underlying code used by repo_manager for git clone and git pull in util.py. Seems it relies on porcelain.pull (dulwich/porcelain) and we are not supplying remote_location so it errors out with "ooking up remote from branch config not supported yet" And to make matters worse the git_clone function doesn't setup the repo correctly to even have a pull done manually. If you go to a plugin dir on the command line and run git pull you get this error "There is no tracking information for the current branch." a git branch --set-upstream-to= fixes it. But the util.ph use of porcelain.clone doesn't set the plugin up correctly to be pulled.

Sijis Aviles
@sijis
Interesting. I saw that error last night and was gonna tackle it. We may need to fix that too, as that should work.
Thanks for pointing that out.