Coder Social home page Coder Social logo

err-stackstorm's People

Contributors

chilicat avatar fmnisme avatar nzlosh avatar vutny avatar ytjohn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

err-stackstorm's Issues

user not mentioned with reply

When direct messaging bot on slack it is possible to extract api_user from the execution through
{{execution.context.api_user}}
this field looks like so from the backend:
u'api_user': u'@bwalczak',

When same message is sent from channel, bot is unable to mention user hence the reply:
'api_user': u'#botroom/bwalczak',

Setup issues

Ubuntu 16.04 LTS

Having had no luck getting setup I decided to try this again on a clean machine without using virtualenv.

sudo apt-get install python-pip git python3-pip build-essentials cmake libffi-dev
sudo pip3 install errbot
mkdir errbot && cd errbot && errbot --init
pip3 install "errbot[slack]"
errbot

I ran the install plugin command and failed with the following output.

Output

[@CHANGE_ME ➡ @errbot] >>> !repos install https://github.com/fmnisme/err-stackstorm.git
[@CHANGE_ME ➡ @errbot] [␍]
Installing https://github.com/fmnisme/err-stackstorm.git...
Collecting st2client>=2.5.0 (from -r /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/requirements.txt (line 1))
  Downloading st2client-2.5.1-py2-none-any.whl (145kB)
    100% |████████████████████████████████| 153kB 2.2MB/s
Collecting sseclient-py (from -r /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/requirements.txt (line 2))
  Downloading sseclient_py-1.7-py2.py3-none-any.whl
Collecting jsonpath-rw>=1.3.0 (from st2client>=2.5.0->-r /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/requirements.txt (line 1))
  Downloading jsonpath-rw-1.4.0.tar.gz
Collecting pyyaml<4.0,>=3.11 (from st2client>=2.5.0->-r /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/requirements.txt (line 1))
  Downloading PyYAML-3.12.tar.gz (253kB)
    100% |████████████████████████████████| 256kB 1.5MB/s
Collecting six==1.10.0 (from st2client>=2.5.0->-r /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/requirements.txt (line 1))
  Downloading six-1.10.0-py2.py3-none-any.whl
Collecting python-dateutil (from st2client>=2.5.0->-r /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/requirements.txt (line 1))
  Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB)
    100% |████████████████████████████████| 194kB 1.6MB/s
Collecting requests[security]<2.15,>=2.14.1 (from st2client>=2.5.0->-r /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/requirements.txt (line 1))
  Downloading requests-2.14.2-py2.py3-none-any.whl (560kB)
    100% |████████████████████████████████| 563kB 1.5MB/s
Collecting prettytable (from st2client>=2.5.0->-r /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/requirements.txt (line 1))
  Downloading prettytable-0.7.2.zip
Collecting ply (from jsonpath-rw>=1.3.0->st2client>=2.5.0->-r /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/requirements.txt (line 1))
  Downloading ply-3.10.tar.gz (150kB)
    100% |████████████████████████████████| 153kB 3.8MB/s
Collecting decorator (from jsonpath-rw>=1.3.0->st2client>=2.5.0->-r /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/requirements.txt (line 1))
  Downloading decorator-4.2.1-py2.py3-none-any.whl
Collecting idna>=2.0.0; extra == "security" (from requests[security]<2.15,>=2.14.1->st2client>=2.5.0->-r /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/requirements.txt (line 1))
  Using cached idna-2.6-py2.py3-none-any.whl
Collecting cryptography>=1.3.4; extra == "security" (from requests[security]<2.15,>=2.14.1->st2client>=2.5.0->-r /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/requirements.txt (line 1))
  Downloading cryptography-2.1.4-cp27-cp27mu-manylinux1_x86_64.whl (2.2MB)
    100% |████████████████████████████████| 2.2MB 419kB/s
Collecting pyOpenSSL>=0.14; extra == "security" (from requests[security]<2.15,>=2.14.1->st2client>=2.5.0->-r /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/requirements.txt (line 1))
  Downloading pyOpenSSL-17.5.0-py2.py3-none-any.whl (53kB)
    100% |████████████████████████████████| 61kB 1.4MB/s
Collecting cffi>=1.7; platform_python_implementation != "PyPy" (from cryptography>=1.3.4; extra == "security"->requests[security]<2.15,>=2.14.1->st2client>=2.5.0->-r /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/requirements.txt (line 1))
  Downloading cffi-1.11.4-cp27-cp27mu-manylinux1_x86_64.whl (406kB)
    100% |████████████████████████████████| 409kB 1.6MB/s
Collecting enum34; python_version < "3" (from cryptography>=1.3.4; extra == "security"->requests[security]<2.15,>=2.14.1->st2client>=2.5.0->-r /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/requirements.txt (line 1))
  Downloading enum34-1.1.6-py2-none-any.whl
Collecting asn1crypto>=0.21.0 (from cryptography>=1.3.4; extra == "security"->requests[security]<2.15,>=2.14.1->st2client>=2.5.0->-r /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/requirements.txt (line 1))
  Using cached asn1crypto-0.24.0-py2.py3-none-any.whl
Collecting ipaddress; python_version < "3" (from cryptography>=1.3.4; extra == "security"->requests[security]<2.15,>=2.14.1->st2client>=2.5.0->-r /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/requirements.txt (line 1))
  Downloading ipaddress-1.0.19.tar.gz
Collecting pycparser (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography>=1.3.4; extra == "security"->requests[security]<2.15,>=2.14.1->st2client>=2.5.0->-r /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/requirements.txt (line 1))
Building wheels for collected packages: jsonpath-rw, pyyaml, prettytable, ply, ipaddress
  Running setup.py bdist_wheel for jsonpath-rw ... done
  Stored in directory: /home/ubuntu/.cache/pip/wheels/ff/80/3d/6d630248dd938306a8691b9658ee91e07fb794076d714f8ce8
  Running setup.py bdist_wheel for pyyaml ... done
  Stored in directory: /home/ubuntu/.cache/pip/wheels/2c/f7/79/13f3a12cd723892437c0cfbde1230ab4d82947ff7b3839a4fc
  Running setup.py bdist_wheel for prettytable ... done
  Stored in directory: /home/ubuntu/.cache/pip/wheels/b6/90/7b/1c22b89217d0eba6d5f406e562365ebee804f0d4595b2bdbcd
  Running setup.py bdist_wheel for ply ... done
  Stored in directory: /home/ubuntu/.cache/pip/wheels/ad/dd/ad/8ce1991a7b380dfe23d6cc81a4de5c2775bc728b5a0a7721aa
  Running setup.py bdist_wheel for ipaddress ... done
  Stored in directory: /home/ubuntu/.cache/pip/wheels/d7/6b/69/666188e8101897abb2e115d408d139a372bdf6bfa7abb5aef5
Successfully built jsonpath-rw pyyaml prettytable ply ipaddress
Installing collected packages: ply, decorator, six, jsonpath-rw, pyyaml, python-dateutil, idna, pycparser, cffi, enum34, asn1crypto, ipaddress, cryptography, pyOpenSSL, requests, prettytable, st2client, sseclient-py
Successfully installed asn1crypto cffi cryptography decorator enum34 idna ipaddress jsonpath-rw ply prettytable pyOpenSSL pycparser python-dateutil pyyaml-3.11 requests six-1.10.0 sseclient-py st2client
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Some plugins are generating errors:
  File "/home/ubuntu/.local/lib/python3.5/site-packages/yapsy/PluginManager.py", line 485, in loadPlugins
    candidate_module = imp.load_module(plugin_module_name,None,candidate_filepath,("py","r",imp.PKG_DIRECTORY))
  File "/usr/lib/python3.5/imp.py", line 244, in load_module
    return load_package(name, filename)
  File "/usr/lib/python3.5/imp.py", line 216, in load_package
    return _load(spec)
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/./init.py", line 2, in <module>
    from st2 import St2
  File "/home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/st2.py", line 7, in <module>
    from lib.st2pluginapi import St2PluginAPI
  File "/home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/lib/st2pluginapi.py", line 7, in <module>
    import sseclient
Removing /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm as it did not load correctly.
Plugins reloaded.

From Log file

2018-01-14 08:59:20,580 DEBUG    errbot.core               *** text = !repos install https://github.com/fmnisme/err-stackstorm.git

2018-01-14 08:59:20,580 DEBUG    errbot.plugins.ACLs       Check repos_install for ACLs.
2018-01-14 08:59:20,580 INFO     errbot.plugins.ACLs       Matching ACL {} against username @CHANGE_ME for command Plugins:repos_install
2018-01-14 08:59:20,580 INFO     errbot.plugins.ACLs       Check if repos_install is admin only command.
2018-01-14 08:59:20,581 INFO     errbot.core               Processing command 'repos_install' with parameters 'https://github.com/fmnisme/err-stackstorm.git' from @CHANGE_ME
2018-01-14 08:59:20,597 DEBUG    errbot.flow               Test if the command repos_install is a trigger for an inflight flow ...
2018-01-14 08:59:20,597 DEBUG    errbot.flow               None matched.
2018-01-14 08:59:21,822 DEBUG    errbot.plugin_manager     All plugin roots:
2018-01-14 08:59:21,822 DEBUG    errbot.plugin_manager     -> /home/ubuntu/.local/lib/python3.5/site-packages/errbot/core_plugins
2018-01-14 08:59:21,822 DEBUG    errbot.plugin_manager     -> /home/ubuntu/errbot/plugins/err-example
2018-01-14 08:59:21,823 DEBUG    errbot.plugin_manager     -> /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm
2018-01-14 08:59:21,823 DEBUG    errbot.plugin_manager     Add /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm to sys.path
2018-01-14 08:59:21,823 DEBUG    errbot.plugin_manager     /home/ubuntu/.local/lib/python3.5/site-packages/errbot/core_plugins has no requirements.txt file
2018-01-14 08:59:21,823 DEBUG    errbot.plugin_manager     /home/ubuntu/errbot/plugins/err-example has no requirements.txt file
2018-01-14 08:59:21,823 INFO     errbot.plugin_manager     Installing packages from '/home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/requirements.txt'.
2018-01-14 08:59:29,849 INFO     errbot                    webhooks:  Flag to bind /echo to                           echo
2018-01-14 08:59:29,869 ERROR    yapsy                     Unable to import plugin: /home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/.
Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.5/site-packages/yapsy/PluginManager.py", line 485, in loadPlugins
    candidate_module = imp.load_module(plugin_module_name,None,candidate_filepath,("py","r",imp.PKG_DIRECTORY))
  File "/usr/lib/python3.5/imp.py", line 244, in load_module
    return load_package(name, filename)
  File "/usr/lib/python3.5/imp.py", line 216, in load_package
    return _load(spec)
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/./__init__.py", line 2, in <module>
    from st2 import St2
  File "/home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/st2.py", line 7, in <module>
    from lib.st2pluginapi import St2PluginAPI
  File "/home/ubuntu/errbot/data/plugins/fmnisme/err-stackstorm/lib/st2pluginapi.py", line 7, in <module>
    import sseclient
ImportError: No module named 'sseclient'

MESSAGE_SIZE_LIMIT not honoured

Hi there,
It seems that MESSAGE_SIZE_LIMIT is not honoured for st2 responses. I was able to test it by making an action that returns large output and set MESSAGE_SIZE_LIMIT=100.
Result was cut in the middle (afaik Slack defaults to 4k characters)

Fix SSL certificate verification.

SSL verification is implemented inconsistently in the plugin and doesn't handle dev/poc cases where an SSL certificate is self-signed but the user wishes to continue regardless.

Rocketchat - error install plugin and callback

Hi I try install plugin err-stackstorm on errbot-rocketchat

I installed errbot-rocketchat with the follow link

https://github.com/cardoso/errbot-rocketchat

Rocketchat 0.65.1
Stackstorm 2.10.1
Python 3.6.7
Ubuntu 18.04
Errbot 5.2.0(edit setup.py on errbot-rocketchat before run virtualenv/bin/python setup.py install)

I have a connection between errbot and rocketchat.

I can configure plugin Webserver(add Webserver on Core_Plugins in errbot-rocketchat/src/aoikrocketchaterrbot/config.py file)

But when I try to install plugin err-stackstorm get the follow errors:

CRITICAL st2 Invalid credentials when communicating with StackStorm API.
ERROR errbot.plugin_manager Failed to execute pip install for ./bot_data/plugins/fmnisme/err-stackstorm/requirements.txt.

But the plugin and requeriments appears as installed and I can execute !st2help and commands run on Stackstorm

The problem is the callback not send to my channel on server chat, get the follow error:

12:01:59 DEBUG    aoikrocketchaterrbot      # ----- Call `callback_message` -----
12:01:59 DEBUG    errbot.core               *** frm = iperez
12:01:59 DEBUG    errbot.core               *** username = iperez
12:01:59 DEBUG    errbot.core               *** text = !st2 pack show ansible
12:01:59 DEBUG    errbot.core               Matching 'st2 pack show ansible' against '^st2 .*' produced a match
12:01:59 DEBUG    errbot.plugins.ACLs       Check st2_execute_actionalias for ACLs.
12:01:59 INFO     errbot.plugins.ACLs       Matching ACL {} against username iperez for command St2:st2_execute_actionalias
12:01:59 INFO     errbot.plugins.ACLs       Check if st2_execute_actionalias is admin only command.
12:01:59 INFO     errbot.core               Processing command 'st2_execute_actionalias' with parameters 'st2 pack show ansible' from iperez
12:01:59 DEBUG    errbot.core               Triggering callback_message on Backup
12:01:59 DEBUG    errbot.core               Triggering callback_message on Health
12:01:59 DEBUG    errbot.flow               Test if the command st2_execute_actionalias is a trigger for an inflight flow ...
12:01:59 DEBUG    errbot.core               Triggering callback_message on Help
12:01:59 DEBUG    errbot.flow               None matched.
12:01:59 DEBUG    errbot.core               Triggering callback_message on Plugins
12:01:59 DEBUG    st2                       Message received from chat backend.
		_body [<class 'str'>] pack show ansible
		_from [<class 'yapsy_loaded_plugin_AoikRocketChatErrbot_0.RocketChatUser'>] iperez
		_to [<class 'yapsy_loaded_plugin_AoikRocketChatErrbot_0.RocketChatUser'>] errbot
		_parent [<class 'NoneType'>] None
		_delayed [<class 'bool'>] False
		_extras [<class 'dict'>] {'msg_info': {'_id': '8gyZg6DvRveLXHbkv', 'rid': 'GENERAL', 'msg': '!st2 pack show ansible', 'ts': datetime.datetime(2019, 1, 16, 15, 1, 59, 622000, tzinfo=datetime.timezone.utc), 'u': {'_id': 'qsWobD2XnNokYJWyo', 'username': 'iperez', 'name': 'iperez'}, 'mentions': [], 'channels': [], '_updatedAt': datetime.datetime(2019, 1, 16, 15, 1, 59, 625000, tzinfo=datetime.timezone.utc)}}
		_flow [<class 'NoneType'>] None
		ctx [<class 'dict'>] {}


12:01:59 DEBUG    errbot.core               Triggering callback_message on Utils
12:01:59 DEBUG    lib.st2pluginapi          Create st2 client with https://172.17.0.2 https://172.17.0.2/api/v1 {'token': '2fc3fd8127144cbd90c58c812f2ff99b'}
12:01:59 DEBUG    errbot.core               Triggering callback_message on ACLs
12:01:59 DEBUG    errbot.core               Triggering callback_message on Webserver
12:01:59 DEBUG    requests.packages.urllib3 Starting new HTTPS connection (1): 172.17.0.2
12:01:59 DEBUG    errbot.core               Triggering callback_message on St2
/home/ivan/.local/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
12:01:59 DEBUG    requests.packages.urllib3 https://172.17.0.2:443 "POST /api/v1/actionalias/match HTTP/1.1" 200 1526
12:01:59 DEBUG    lib.st2pluginapi          Create st2 client with https://172.17.0.2 https://172.17.0.2/api/v1 {'token': '2fc3fd8127144cbd90c58c812f2ff99b'}
12:01:59 DEBUG    lib.st2pluginapi          Execution: ['pack show ansible', 'pack show {{ pack }}', 'pack_show', 'iperez', 'errbot', 'iperez', 'iperez']
12:01:59 DEBUG    requests.packages.urllib3 Starting new HTTPS connection (1): 172.17.0.2
/home/ivan/.local/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
12:01:59 DEBUG    requests.packages.urllib3 https://172.17.0.2:443 "POST /api/v1/aliasexecution HTTP/1.1" 201 6665
12:01:59 DEBUG    st2                       action alias execution result: type=<class 'str'> Something is happening ... 
12:01:59 DEBUG    errbot.flow               Test if the command st2_execute_actionalias is a trigger for an inflight flow ...
12:01:59 DEBUG    errbot.flow               None matched.
12:01:59 DEBUG    errbot.flow               Test if the command st2_execute_actionalias is an auto-trigger for any flow ...
12:01:59 DEBUG    sseclient                 Dispatching st2.liveaction__create event, 508 bytes...
12:01:59 DEBUG    sseclient                 Dispatching st2.execution__create event, 2649 bytes...
12:01:59 DEBUG    sseclient                 Dispatching st2.liveaction__update event, 508 bytes...
12:01:59 DEBUG    sseclient                 Dispatching st2.execution__update event, 2718 bytes...
12:01:59 DEBUG    sseclient                 Dispatching st2.liveaction__update event, 544 bytes...
12:02:01 DEBUG    sseclient                 Dispatching st2.execution__update event, 2821 bytes...
12:02:01 DEBUG    sseclient                 Dispatching st2.liveaction__update event, 1244 bytes...
12:02:01 DEBUG    sseclient                 Dispatching st2.execution__update event, 3633 bytes...
12:02:01 DEBUG    sseclient                 Dispatching st2.liveaction__create event, 611 bytes...
12:02:01 DEBUG    sseclient                 Dispatching st2.execution__create event, 5251 bytes...
12:02:01 DEBUG    sseclient                 Dispatching st2.liveaction__update event, 611 bytes...
12:02:01 DEBUG    sseclient                 Dispatching st2.execution__update event, 5320 bytes...
12:02:01 DEBUG    sseclient                 Dispatching st2.liveaction__update event, 647 bytes...
12:02:01 DEBUG    sseclient                 Dispatching st2.execution__update event, 5423 bytes...
12:02:01 DEBUG    sseclient                 Dispatching st2.liveaction__update event, 697 bytes...
12:02:01 DEBUG    sseclient                 Dispatching st2.liveaction__update event, 711 bytes...
12:02:01 DEBUG    sseclient                 Dispatching st2.execution__update event, 5543 bytes...
12:02:01 DEBUG    sseclient                 Dispatching st2.liveaction__create event, 687 bytes...
12:02:02 DEBUG    sseclient                 Dispatching st2.execution__create event, 2946 bytes...
12:02:02 DEBUG    sseclient                 Dispatching st2.liveaction__update event, 687 bytes...
12:02:02 DEBUG    sseclient                 Dispatching st2.execution__update event, 3015 bytes...
12:02:02 DEBUG    sseclient                 Dispatching st2.liveaction__update event, 723 bytes...
12:02:02 DEBUG    sseclient                 Dispatching st2.execution__update event, 3118 bytes...
12:02:02 DEBUG    sseclient                 Dispatching st2.liveaction__update event, 1703 bytes...
12:02:02 DEBUG    sseclient                 Dispatching st2.execution__update event, 4210 bytes...
12:02:02 DEBUG    sseclient                 Dispatching st2.liveaction__update event, 711 bytes...
12:02:02 DEBUG    sseclient                 Dispatching st2.execution__update event, 5571 bytes...
12:02:02 DEBUG    sseclient                 Dispatching st2.liveaction__create event, 1539 bytes...
12:02:02 DEBUG    sseclient                 Dispatching st2.execution__create event, 4291 bytes...
12:02:02 DEBUG    sseclient                 Dispatching st2.liveaction__update event, 1539 bytes...
12:02:02 DEBUG    sseclient                 Dispatching st2.execution__update event, 4360 bytes...
12:02:02 DEBUG    sseclient                 Dispatching st2.liveaction__update event, 1575 bytes...
12:02:02 DEBUG    sseclient                 Dispatching st2.execution__update event, 4463 bytes...
12:02:02 DEBUG    sseclient                 Dispatching st2.announcement__errbot event, 965 bytes...
12:02:02 DEBUG    lib.st2pluginapi          *** Errbot announcement event detected! ***
st2.announcement__errbot event, 965 bytes

12:02:02 DEBUG    lib.st2adapters           Posting Message: whisper=False, message=Getting back to you about the `ansible` pack: {~}
Here's the full index entry at StackStorm Exchange: ```author: StackStorm, Inc.
content:
  actions:
    count: 8
    resources:
    - command_local
    - galaxy.list
    - playbook
    - vault.decrypt
    - vault.encrypt
    - galaxy.install
    - command
    - galaxy.remove
  tests:
    count: 1
    resources:
    - test_actions_lib_ansiblebaserunner.py
description: st2 content pack containing ansible integrations
email: [email protected]
keywords:
- ansible
- cfg management
- configuration management
name: ansible
ref: ansible
repo_url: https://github.com/StackStorm-Exchange/stackstorm-ansible
version: 0.5.5

To install the pack: `pack install ansible`
If the pack is already installed, I will upgrade it to the latest version, keeping the config.
, user=iperez, channel=iperez, extra={}
12:02:02  CRITICAL lib.st2pluginapi          St2 stream listener - An error occurred: <class 'ValueError'> Argument `in_reply_to` must be given..Backing off 10 seconds.

My errbot-rocketchat/src/aoikrocketchaterrbot/config.py file

# coding: utf-8
"""
Errbot config module.

Config options:
https://github.com/errbotio/errbot/blob/master/errbot/config-template.py
"""
from __future__ import absolute_import

# Standard imports
from datetime import datetime
import logging


# Backend name
BACKEND = 'AoikRocketChatErrbot'

# Data directory containing data of backends and plugins
BOT_DATA_DIR = './bot_data'

# Directory containing extra backends
BOT_EXTRA_BACKEND_DIR = './backends'

# Directory containing extra plugins
BOT_EXTRA_PLUGIN_DIR = './plugins'

# Admin bot user names
BOT_ADMINS = ('iperez')

# Core plugin names
CORE_PLUGINS = ('ACLs', 'Backup', 'Health', 'Help', 'Plugins', 'Utils', 'Webserver')

# Log file path
BOT_LOG_FILE = './errbot.log'

# Logging level
BOT_LOG_LEVEL = logging.DEBUG

STACKSTORM = {
    'auth_url': 'https://172.17.0.2/auth/v1',
    'api_url': 'https://172.17.0.2/api/v1',
    'stream_url': 'https://172.17.0.2/stream/v1',

    'verify_cert': False,
    'api_auth': {
        'user': {
            'name': 'admin',
            'password': "changeme",
        },
        'token': "2fc3fd8127144cbd90c58c812f2ff99b",
        'key': 'NjNjNWIzYmI1ZThjMWIwNTM0NzM0NWJjNGNmNmJhNzAyYWI3ZWNmY2UxZDY1OGJjODVmYTVmY2NjMTJkMjUwZQ'
    },
    'timer_update': 600, #  Unit: second.  Interval for Errbot to refresh to list of available action aliases.
}

class AOIKROCKETCHATERRBOT_CONFIG(object):
    """
    Config object for AoikRocketChatErrbot.

    Config values can be overridden by env variables. Config key `SERVER_URI`
    maps to env variable name `AOIKROCKETCHATERRBOT_SERVER_URI`. Use string
    '0', 'false' or 'no' to mean boolean false in env variable value.
    """

    # Meteor server URI.
    #
    # Required.
    #
    # E.g.: 'ws://127.0.0.1:3000/websocket'
    #
    SERVER_URI = 'ws://127.0.0.1:3000/websocket'

    # Meteor client login username.
    #
    # Required.
    #
    LOGIN_USERNAME = 'errbot'

    # Meteor client login password.
    #
    # Required.
    #
    LOGIN_PASSWORD = 'errbot'

    # Whether patch meteor client to fix an existing bug.
    #
    # Default is true.
    #
    PATCH_METEOR_CLIENT = True

    # Whether reconnect is enabled.
    #
    # Default is true.
    #
    RECONNECT_ENABLED = True

    # Whether heartbeat is enabled.
    #
    # If enabled, a specified heartbeat function will be called at a specified
    # interval.
    #
    # Default is false.
    #
    HEARTBEAT_ENABLED = False

    # Heartbeat interval in seconds.
    #
    # Default is 10.
    #
    HEARTBEAT_INTERVAL = 10

    # Create heartbeat function
    @classmethod
    def _heartbeat_func(cls, backend):
        """
        Heartbeat function.

        :param backend: Backend object.

        :return: None.
        """
        # Create message
        msg = 'Heartbeat: {}'.format(datetime.now().strftime('%H:%M:%S'))

        # Send message
        backend.send_rocketchat_message(
            params={
                # Room ID
                'rid': 'GENERAL',
                # Message
                'msg': msg,
            }
        )

    # Heartbeat function object.
    #
    # The function takes the backend object as argument.
    #
    # Required if config `HEARTBEAT_ENABLED` is true.
    #
    HEARTBEAT_FUNC = _heartbeat_func

    # Logging level for this backend only
    BOT_LOG_LEVEL = logging.DEBUG

I need the function ACL to limit action-alias to chat channels/users and server chat on-premise

Implement unit tests

There's not enough unit tests in place to provide a good level of quality control.

multiple alias formats not working

I am trying to put multiple formats in single alias

following this --> https://docs.stackstorm.com/chatops/aliases.html#multiple-formats-in-a-single-alias

here's alias I've put together

---
name: "get_ip_address"
pack: "core"
description: "get_ip_address"
action_ref: "core.get_ip_address"
formats:
     - "get ip {{tag_key}} {{tag_value}} {{tag_key2}} {{tag_value2}}"
     - "get ip {{tag_key}} {{tag_value}}"
ack:
 format: "Thinking...\n Execution id: '{{execution.id}}'"
 enabled: false
 append_url: false
result:
 extra:
   slack:
     color: "#00AA00"
     pretext: "Here's your response {{execution.context.api_user}}"
     title: "title"
     text: "optional text"
 format: |
   {{ execution.result.stdout}}

when I hit !st2 get ip ec2_tag_cluster qa-blue I am getting result, but when I hit !st2 get ip ec2_tag_cluster qa-blue a b

I am getting st2 command 'get ip ec2_tag_cluster qa-blue a b' not found. Check help with !st2help

in st2help I can see two formats listed

!st2 get ip {{tag_key}} {{tag_value}} {{tag_key2}} {{tag_value2}} -- get_ip_address
!st2 get ip {{tag_key}} {{tag_value}} -- get_ip_address

Is this repo under active maintenance?

Hi @nzlosh

I have found out that you started active development and fixing issues in your own repo at https://github.com/nzlosh/err-stackstorm

Just want to check here, would you plan to keep maintaining this repository, to port changes, accept issues or contributions and so on?
I'm asking primarily because if I would like to create new bleeding edge StackStorm+Errbot deployment, which plugin is better to pick up?

Thank you for your dedication to this awesome project!

Installation documentation missing chatops pack step

When setting up a new installation, errbot depends on the chatops pack being installed before copying the errbot rule file into the pack directory. This step isn't included in the documentation and needs to be fixed.

Proposal: Out of Band chat backend user authentication

Implement an out of bands authentication mechanism over a secure channel that uses a challenge/response exchange and a One-Time use URL to exchange user credentials.

A description of the process is as follows:

  1. Chat user X@chatbackend triggers login with bot command /st2 authenticate <response string>.
  2. Err-stackstorm processes the trigger and calculates an unique ID and response hash.
  3. Err-stackstorm stores X@chatbackend identification using unique ID as key.
  4. Err-stackstorm responds via private 1to1 chat to X@chatbackend with a URL+unique ID.
  5. X@chatbackend opens a web browser (session UserX) and accesses URL+unique ID.
  6. Err-stackstorm looks up unique ID, and if it exists, presents a form requesting <response string>.
  7. UserX provides <response string> in form and submits.
  8. Err-stackstorm destroys URL reference, calculates hash from <response string> and compares with stored hash value.
  9. If hash values match a second form is presented requesting StackStorm API username/password.
  10. UserX provides username/password for StackStorm API.
  11. Err-stackstorm preforms authentication with user credentials.
  12. StackStorm API reponds with a User Token or authentication failure.
  13. Err-stackstorm discards user credentials and if authentication was successful stores User Token using UniqueID as key.
  14. Err-stackstorm sends private 1to1 to user X@chatbackend informing of authentication success/failure.

The data stored by err-stackstorm would allow using RBAC in Stackstorm by mapping a chatbackend user to a stackstorm user token. For example:

{
    "<unique id>" : {
        "response_hash": "<hash>",
        "backend_id": "U4H00PLGP",
        "st2_user_token": "3ade615c721a415eab09d092a09c1a5b",
        "authentication_date": "2017-10-10T17:39:42+0200"
    }
}

When a user calls an action alias, err-stackstorm will lookup the users backend_id and use the associated st2_user_token for all calls to StackStorm's API.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.