GithubHelp home page GithubHelp logo

stackstorm / st2chatops Goto Github PK

View Code? Open in Web Editor NEW
31.0 25.0 41.0 967 KB

Packaging environment for building StackStorm chatops native packages

License: Apache License 2.0

Shell 51.90% Makefile 7.23% Python 30.56% Dockerfile 10.30%
stackstorm hubot chatops slack microsoft-teams hipchat cisco-spark flowdock irc xmpp

st2chatops's Introduction

StackStorm's st2chatops

This repository delivers StackStorm Chatops in a form of packages and docker image. The package includes hubot, hubot-stackstorm and pre-installed adapters for many Chat services.

Package

Usage

For instructions to install st2chatops package from repos, please refer to StackStorm installation instruction for Deb-based or RPM-based distributions.

Make sure you've added StackStorm repos before installing the package.

Node Version

Refer to official node documentation on installing NodeJS from packages.

Building

Building of the packages is handled automatically by CircleCI. In case you'd like to run it locally, you can use our building pipeline by running docker-compose:

    docker-compose run ${DISTRO} build

Where ${DISTRO} refers to flavor name. See docker-compose.yml file for the list of supported flavors.

Docker

Usage

  • Pull the StackStorm/st2chatops image:

      docker pull stackstorm/st2chatops
    
  • Set a hostname or IP address that will be accessible form a docker container, as $ST2_HOSTNAME environment variable:

     export $ST2_HOSTNAME={MY_STACKSTORM_HOST_NAME}
    
  • Use st2chatops.env to store the settings. The example uses Slack; set appropriate environment variables for other Chat Services: Slack, Microsoft Teams, Cisco Spark, Flowdock, IRC, XMPP, RocketChat, Mattermost.

  • Use scripts/st2chatops-docker-run.sh to start the docker container instance. The script is set for Slack; for other Chats, edit it to pass the environment variables as required for your Chat service adapter. Run the script, and ensure that hubot-stackstorm is running and there are no errors:

      ./st2chatops-docker-run.sh
      docker inspect -f {{.State.Status}} stackstorm-st2chatops
      docker logs stackstorm-st2chatops
    

    To automatically start stackstorm-st2chatops, use restart policies, or integrate with a process manager.

  • Go to your Chat room and begin Chatopsing. Learn more at docs.stackstorm.com/chatops

Node Version

Grab your favorite Node.JS version (>=10.0, <=14.x), and pick your tag. Update Dockerfile as needed.

Pre-Requsites

  • Docker
  • Docker Hub Login (only if you're pushing a new version to Docker Hub)

Building

  • Step 0: Log in to docker with docker login.

    • Only have to do this the first time
  • Step 1: Build the image: docker build -t stackstorm/st2chatops:<VER> .

    • Replace <VER> with a version tag
  • Step 2: Push the container up: docker push stackstorm/st2chatops:<VER>

    • Use the same tag specified in Step 1.
  • Step 3: Update the latest tag:

    docker build -t stackstorm/st2chatops:latest .
    docker push stackstorm/st2chatops:latest
    
  • Step 4: Profit

Updating

  • hubot-slack is not compatible with coffeescript 2 (issue, PR) yet, so keep the coffee-script dependency pinned to 1.12.7
  • coffee-register is required for dynamic require, but it cannot be updated past 1.0.0 because more recent versions (eg: 2.0.0+) require coffeescript version 2.0.0+

Copyright, License, and Contributors Agreement

Copyright 2015-2019 Extreme Networks, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

By contributing you agree that these contributions are your own (or approved by your employer) and you grant a full, complete, irrevocable copyright license to all users and developers of the project, present and future, pursuant to the license of the project.

st2chatops's People

Contributors

amanda11 avatar arm4b avatar armab avatar blag avatar cognifloyd avatar emedvedev avatar enykeev avatar humblearner avatar jfryman avatar jinpingh avatar jjm avatar kami avatar lakshmi-kannan avatar lindsayhill avatar lopf avatar m4dcoder avatar manasdk avatar mrdiba avatar nmaludy avatar nzlosh avatar punkrokk avatar sergiik avatar shusugmt avatar tonybaloney avatar

Stargazers

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

Watchers

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

st2chatops's Issues

Docker st2chatops will not start rocketchat adapter

When I try to use the st2chatops docker container configured for using Rocket Chat the container will give an error that it can't find ddp.js and exits.

st2chatops log:

st2api is ready, starting hubot...
Testing hubot configuration...
Mon, 19 Jul 2021 11:56:11 GMT body-parser deprecated undefined extended: provide extended option at node_modules/hubot/src/robot.js:445:21
[Mon Jul 19 2021 13:56:11 GMT+0200 (Central European Summer Time)] DEBUG Loading adapter rocketchat
[Mon Jul 19 2021 13:56:11 GMT+0200 (Central European Summer Time)] ERROR Cannot load adapter rocketchat - Error: Cannot find module 'ddp.js'
Require stack:
- /opt/stackstorm/chatops/node_modules/@rocket.chat/sdk/node_modules/asteroid/dist/asteroid.node.js
- /opt/stackstorm/chatops/node_modules/@rocket.chat/sdk/dist/lib/driver.js
- /opt/stackstorm/chatops/node_modules/@rocket.chat/sdk/dist/index.js
- /opt/stackstorm/chatops/node_modules/hubot-rocketchat/index.js
- /opt/stackstorm/chatops/node_modules/hubot/src/robot.js
- /opt/stackstorm/chatops/node_modules/hubot/es2015.js
- /opt/stackstorm/chatops/node_modules/hubot/index.js
- /opt/stackstorm/chatops/node_modules/hubot/bin/hubot.js
- /opt/stackstorm/chatops/node_modules/hubot/bin/hubot
WARNING: hubot --config-check failed, are your adapter variables configured properly?

.env configuration:

T2_VERSION=3
ST2_CHATOPS_ENABLE=1
ST2_API_KEY=<generated api key>
TZ=Europe/Amsterdam
######################################################################
# Chat service adapter settings

# RocketChat settings (https://github.com/RocketChat/hubot-rocketchat):
#
HUBOT_ADAPTER=rocketchat
ROCKETCHAT_URL=<rocketchat url>
ROCKETCHAT_USER=<bot name>
ROCKETCHAT_PASSWORD=<bot password>
ROCKETCHAT_ROOM=<default room>

docker-compose.yml from https://github.com/stackstorm/st2-docker

...
  st2chatops:
    image: ${ST2_IMAGE_REPO:-stackstorm/}st2chatops:${ST2_VERSION:-latest}
    restart: on-failure:5
    depends_on:
      - st2api
      - st2auth
      - st2stream
    command: /st2chatops-startup.sh
    networks:
      - private
    environment:
      ST2_AUTH_URL: ${ST2_AUTH_URL:-http://st2auth:9100/}
      ST2_API_URL: ${ST2_API_URL:-http://st2api:9101/}
      ST2_STREAM_URL: ${ST2_STREAM_URL:-http://st2stream:9102/}
      ST2_API_KEY: ${ST2_API_KEY:-change-to-your-st2-api-key}
      TZ: ${TZ:-UTC}
      # enable chatops by setting this variable to any non-zero value
      # and enable/set your hubot adapter specific variables below
      ST2_CHATOPS_ENABLE: ${ST2_CHATOPS_ENABLE:-0}
      # Custom hubot adapter ENV variables to pass through which will override st2chatops.env defaults.
      # See https://github.com/StackStorm/st2chatops/blob/master/st2chatops.env
      # for the full list of supported adapters and example ENV variables.
      HUBOT_ADAPTER: ${HUBOT_ADAPTER:-slack}
      HUBOT_LOG_LEVEL: ${HUBOT_LOG_LEVEL:-debug}
      HUBOT_SLACK_TOKEN: ${HUBOT_SLACK_TOKEN:-}
    volumes:
      - ./scripts/st2chatops-startup.sh:/st2chatops-startup.sh
    dns_search: .
...

How can I solve this issue?

Start maintaining the CHANGELOG.md

It would be great to start putting together and maintaining CHANGELOG.md for this repo.

To avoid confusion from user's side, the history should cover at least 1 full release.
Some of the st2ci and st2cd automation needs to be done to cut the Changelog for every new release.

Remove chatops command

How do you unregister a chatops command? I registered the run remote command from the documentation, which works. However, unregistering does either not work or the process is not straightforward. Removing the file from the my-chatops/aliases and running st2ctl reload --register-all does not work. service st2chatops restart doesn't help either.
Is this a bug or just not documented?

Edit:
I figured out that
st2 run packs.uninstall packs=my-chatops
service st2chatops restart
does the trick. Is there a way to remove single commands from a pack without removing the whole thing?

st2chatops cannot be installed without st2 repo on a separate instance

We allow installation of st2chatops on a separate instance : https://github.com/StackStorm/st2chatops/blob/master/st2chatops.env#L23.
However, it depends on st2 package as st2 creates /var/log/st2/.

Discovered here : StackStorm/ansible-st2#125 (comment)

RUNNING HANDLER [st2chatops : restart st2chatops] ******************************
fatal: [centos6]: FAILED! => {"changed": false, "failed": true, "msg": "touch: cannot touch `/var/log/st2/st2chatops.log': No such file or directory\nrunuser: group st2 does not exist\n"}

Saying that, st2chatops package should try to create /var/log/st2/ dirs as well as st2 user if it doesn't exists yet.

chatops.post_message crashes st2chatops using Rocket.Chat

SUMMARY

Manually triggering chatops.post_message results in a crash of st2chatops using Rocket.Chat.

STACKSTORM VERSION

$ st2 --version
st2 3.4.1, on Python 3.6.9

$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="18.04.5 LTS (Bionic Beaver)"
...

installed using the following command:
bash <(curl -sSL https://stackstorm.com/packages/install.sh) --user=st2admin --password=Ch@ngeMe --version=3.4.1

Steps to reproduce the problem

  1. Install StackStorm on a clean VM. (I'm using StackStorm version 3.4.1 because of #167)
  2. Configure st2chatops by editing the `/opt/stackstorm/chatops/st2chatops.env
  3. Test if the bot replies from Rocket.Chat: hubot help results in a list with commands
  4. tail -f /var/log/syslog and try !st2 list actions
    The bot returns: Give me just a moment to find the actions for you... (details available at <url_omitted>)
    The log shows some action and task handling until:
Aug  9 12:10:42 stackstorm hubot[12591]: [Mon Aug 09 2021 12:10:42 GMT+0000 (Coordinated Universal Time)] ERROR TypeError: Cannot read property 'roomID' of undefined
Aug  9 12:10:42 stackstorm hubot[12591]:     at strings.map (/opt/stackstorm/chatops/node_modules/hubot-rocketchat/index.js:155:25)
Aug  9 12:10:42 stackstorm hubot[12591]:     at Array.map (<anonymous>:null:null)
Aug  9 12:10:42 stackstorm hubot[12591]:     at RocketChatBotAdapter.send (/opt/stackstorm/chatops/node_modules/hubot-rocketchat/index.js:154:20)
Aug  9 12:10:42 stackstorm hubot[12591]:     at Robot.messageRoom (/opt/stackstorm/chatops/node_modules/hubot/src/robot.js:608:23)
Aug  9 12:10:42 stackstorm hubot[12591]:     at sendChunk (/opt/stackstorm/chatops/node_modules/hubot-stackstorm/src/lib/adapters/rocketchat.js:73:25)
Aug  9 12:10:42 stackstorm hubot[12591]:     at RocketChatAdapter.postData (/opt/stackstorm/chatops/node_modules/hubot-stackstorm/src/lib/adapters/rocketchat.js:78:5)
Aug  9 12:10:42 stackstorm hubot[12591]:     at EventSource.<anonymous> (/opt/stackstorm/chatops/node_modules/hubot-stackstorm/src/lib/stackstorm_api.js:453:20)
Aug  9 12:10:42 stackstorm hubot[12591]:     at EventSource.emit (events.js:198:13)
Aug  9 12:10:42 stackstorm hubot[12591]:     at _emit (/opt/stackstorm/chatops/node_modules/eventsource/lib/eventsource.js:172:17)
Aug  9 12:10:42 stackstorm hubot[12591]:     at parseEventStreamLine (/opt/stackstorm/chatops/node_modules/eventsource/lib/eventsource.js:186:9)
Aug  9 12:10:42 stackstorm hubot[12591]:     at IncomingMessage.<anonymous> (/opt/stackstorm/chatops/node_modules/eventsource/lib/eventsource.js:150:11)
Aug  9 12:10:42 stackstorm hubot[12591]:     at IncomingMessage.emit (events.js:198:13)
Aug  9 12:10:42 stackstorm hubot[12591]:     at addChunk (_stream_readable.js:288:12)
Aug  9 12:10:42 stackstorm hubot[12591]:     at readableAddChunk (_stream_readable.js:269:11)
Aug  9 12:10:42 stackstorm hubot[12591]:     at IncomingMessage.Readable.push (_stream_readable.js:224:10)
Aug  9 12:10:42 stackstorm hubot[12591]:     at HTTPParser.parserOnBody (_http_common.js:124:22)
Aug  9 12:10:42 stackstorm hubot[12591]:     at TLSSocket.socketOnData (_http_client.js:451:20)
Aug  9 12:10:42 stackstorm hubot[12591]:     at TLSSocket.emit (events.js:198:13)
Aug  9 12:10:42 stackstorm hubot[12591]:     at addChunk (_stream_readable.js:288:12)
Aug  9 12:10:42 stackstorm hubot[12591]:     at readableAddChunk (_stream_readable.js:269:11)
Aug  9 12:10:42 stackstorm hubot[12591]:     at TLSSocket.Readable.push (_stream_readable.js:224:10)
Aug  9 12:10:42 stackstorm hubot[12591]:     at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
Aug  9 12:10:42 stackstorm hubot[12591]: [Mon Aug 09 2021 12:10:42 GMT+0000 (Coordinated Universal Time)] ERROR TypeError: Cannot read property 'roomID' of undefined
Aug  9 12:10:42 stackstorm hubot[12591]:     at strings.map (/opt/stackstorm/chatops/node_modules/hubot-rocketchat/index.js:155:25)
Aug  9 12:10:42 stackstorm hubot[12591]:     at Array.map (<anonymous>:null:null)
Aug  9 12:10:42 stackstorm hubot[12591]:     at RocketChatBotAdapter.send (/opt/stackstorm/chatops/node_modules/hubot-rocketchat/index.js:154:20)
Aug  9 12:10:42 stackstorm hubot[12591]:     at Robot.messageRoom (/opt/stackstorm/chatops/node_modules/hubot/src/robot.js:608:23)
Aug  9 12:10:42 stackstorm hubot[12591]:     at sendChunk (/opt/stackstorm/chatops/node_modules/hubot-stackstorm/src/lib/adapters/rocketchat.js:73:25)
Aug  9 12:10:42 stackstorm hubot[12591]:     at RocketChatAdapter.postData (/opt/stackstorm/chatops/node_modules/hubot-stackstorm/src/lib/adapters/rocketchat.js:78:5)
Aug  9 12:10:42 stackstorm hubot[12591]:     at EventSource.<anonymous> (/opt/stackstorm/chatops/node_modules/hubot-stackstorm/src/lib/stackstorm_api.js:453:20)
Aug  9 12:10:42 stackstorm hubot[12591]:     at EventSource.emit (events.js:198:13)
Aug  9 12:10:42 stackstorm hubot[12591]:     at _emit (/opt/stackstorm/chatops/node_modules/eventsource/lib/eventsource.js:172:17)
Aug  9 12:10:42 stackstorm hubot[12591]:     at parseEventStreamLine (/opt/stackstorm/chatops/node_modules/eventsource/lib/eventsource.js:186:9)
Aug  9 12:10:42 stackstorm hubot[12591]:     at IncomingMessage.<anonymous> (/opt/stackstorm/chatops/node_modules/eventsource/lib/eventsource.js:150:11)
Aug  9 12:10:42 stackstorm hubot[12591]:     at IncomingMessage.emit (events.js:198:13)
Aug  9 12:10:42 stackstorm hubot[12591]:     at addChunk (_stream_readable.js:288:12)
Aug  9 12:10:42 stackstorm hubot[12591]:     at readableAddChunk (_stream_readable.js:269:11)
Aug  9 12:10:42 stackstorm hubot[12591]:     at IncomingMessage.Readable.push (_stream_readable.js:224:10)
Aug  9 12:10:42 stackstorm hubot[12591]:     at HTTPParser.parserOnBody (_http_common.js:124:22)
Aug  9 12:10:42 stackstorm hubot[12591]:     at TLSSocket.socketOnData (_http_client.js:451:20)
Aug  9 12:10:42 stackstorm hubot[12591]:     at TLSSocket.emit (events.js:198:13)
Aug  9 12:10:42 stackstorm hubot[12591]:     at addChunk (_stream_readable.js:288:12)
Aug  9 12:10:42 stackstorm hubot[12591]:     at readableAddChunk (_stream_readable.js:269:11)
Aug  9 12:10:42 stackstorm hubot[12591]:     at TLSSocket.Readable.push (_stream_readable.js:224:10)
Aug  9 12:10:42 stackstorm hubot[12591]:     at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
Aug  9 12:10:42 stackstorm hubot[12591]: [Mon Aug 09 2021 12:10:42 GMT+0000 (Coordinated Universal Time)] INFO Hubot will shut down ...
Aug  9 12:10:42 stackstorm hubot[12591]: [Mon Aug 09 2021 12:10:42 GMT+0000 (Coordinated Universal Time)] WARNING Stream error: Event { type: 'error' }

Manually triggering chatops.post_message:

  1. Open chatops.post_message action (https://<vm_ip>/#/actions/chatops.post_message).
  2. Enter Rocket.Chat room name at channel and a test message at message.
  3. tail -f /var/log/syslog and click run.
  4. The StackStorm history shows a successful execution.
  5. The syslog shows a less successful execution:
Aug  9 11:05:30 stackstorm st2scheduler[6444]: 2021-08-09 11:05:30,708 INFO [-] [61110bfa823a28a7e056383d] Retrieved item "61110bfae7bba26eb7af2b29" from scheduling queue.
Aug  9 11:05:30 stackstorm st2scheduler[6444]: 2021-08-09 11:05:30,711 INFO [-] [61110bfa823a28a7e056383d] Scheduling Liveaction "61110bfa823a28a7e056383c". (queue_item_id='61110bfae7bba26eb7af2b29')
Aug  9 11:05:30 stackstorm st2scheduler[6444]: 2021-08-09 11:05:30,713 INFO [-] [61110bfa823a28a7e056383d] Liveaction "61110bfa823a28a7e056383c" with status "requested" is updated to status "scheduled." (queue_item_id='61110bfae7bba26eb7af2b29')
Aug  9 11:05:30 stackstorm st2scheduler[6444]: 2021-08-09 11:05:30,750 INFO [-] The status of action execution is changed from requested to scheduled. <LiveAction.id=61110bfa823a28a7e056383c, ActionExecution.id=61110bfa823a28a7e056383d>
Aug  9 11:05:30 stackstorm st2actionrunner[11119]: 2021-08-09 11:05:30,782 INFO [-] Dispatched {~}action_execution: 61110bfa823a28a7e056383d / {~}live_action: 61110bfa823a28a7e056383c with "running" status.
Aug  9 11:05:30 stackstorm st2actionrunner[11119]: 2021-08-09 11:05:30,786 INFO [-] Dispatching Action to a runner (liveaction_db={'action': 'chatops.post_message', 'action_is_workflow': False, 'callback': {}, 'context': {'trace_context': {}, 'user': 'st2admin', 'pack': 'chatops'}, 'delay': None, 'end_timestamp': None, 'id': '61110bfa823a28a7e056383c', 'notify': None, 'parameters': {'channel': 'IT', 'message': 'testmessage'}, 'result': {}, 'runner_info': {'hostname': 'stackstorm', 'pid': 11119}, 'start_timestamp': '2021-08-09 11:05:30.660666+00:00', 'status': 'running', 'task_execution': None, 'workflow_execution': None},runner_type_db={'description': 'A runner for emitting an announcement event on the stream.', 'enabled': True, 'id': '610d37b8a1e45fa40ff5251d', 'name': 'announcement', 'output_key': None, 'output_schema': {}, 'query_module': None, 'runner_module': 'announcement_runner', 'runner_package': 'announcement_runner', 'runner_parameters': {'experimental': {'default': False, 'description': 'Flag to indicate acknowledgment of using experimental runner', 'required': True, 'type': 'boolean'}, 'route': {'default': 'general', 'description': 'The routing_key used to route the message to consumers. Might be a list of words, delimited by dots.', 'maxLength': 255, 'minLength': 1, 'type': 'string'}}, 'uid': 'runner_type:announcement'})
Aug  9 11:05:30 stackstorm hubot[17042]: [Mon Aug 09 2021 11:05:30 GMT+0000 (Coordinated Universal Time)] DEBUG Chatops message received: {"payload": {"extra": null, "context": null, "whisper": false, "user": null, "message": "testmessage", "channel": "IT"}, "trace_context": {}}
Aug  9 11:05:30 stackstorm hubot[17042]: [Mon Aug 09 2021 11:05:30 GMT+0000 (Coordinated Universal Time)] ERROR TypeError: Cannot read property 'roomID' of undefined
Aug  9 11:05:30 stackstorm hubot[17042]:     at strings.map (/opt/stackstorm/chatops/node_modules/hubot-rocketchat/index.js:155:25)
Aug  9 11:05:30 stackstorm hubot[17042]:     at Array.map (<anonymous>:null:null)
Aug  9 11:05:30 stackstorm hubot[17042]:     at RocketChatBotAdapter.send (/opt/stackstorm/chatops/node_modules/hubot-rocketchat/index.js:154:20)
Aug  9 11:05:30 stackstorm hubot[17042]:     at Robot.messageRoom (/opt/stackstorm/chatops/node_modules/hubot/src/robot.js:608:23)
Aug  9 11:05:30 stackstorm hubot[17042]:     at sendChunk (/opt/stackstorm/chatops/node_modules/hubot-stackstorm/src/lib/adapters/rocketchat.js:73:25)
Aug  9 11:05:30 stackstorm hubot[17042]:     at RocketChatAdapter.postData (/opt/stackstorm/chatops/node_modules/hubot-stackstorm/src/lib/adapters/rocketchat.js:78:5)
Aug  9 11:05:30 stackstorm hubot[17042]:     at EventSource.<anonymous> (/opt/stackstorm/chatops/node_modules/hubot-stackstorm/src/lib/stackstorm_api.js:453:20)
Aug  9 11:05:30 stackstorm hubot[17042]:     at EventSource.emit (events.js:198:13)
Aug  9 11:05:30 stackstorm hubot[17042]:     at _emit (/opt/stackstorm/chatops/node_modules/eventsource/lib/eventsource.js:172:17)
Aug  9 11:05:30 stackstorm hubot[17042]:     at parseEventStreamLine (/opt/stackstorm/chatops/node_modules/eventsource/lib/eventsource.js:186:9)
Aug  9 11:05:30 stackstorm hubot[17042]:     at IncomingMessage.<anonymous> (/opt/stackstorm/chatops/node_modules/eventsource/lib/eventsource.js:150:11)
Aug  9 11:05:30 stackstorm hubot[17042]:     at IncomingMessage.emit (events.js:198:13)
Aug  9 11:05:30 stackstorm hubot[17042]:     at addChunk (_stream_readable.js:288:12)
Aug  9 11:05:30 stackstorm hubot[17042]:     at readableAddChunk (_stream_readable.js:269:11)
Aug  9 11:05:30 stackstorm hubot[17042]:     at IncomingMessage.Readable.push (_stream_readable.js:224:10)
Aug  9 11:05:30 stackstorm hubot[17042]:     at HTTPParser.parserOnBody (_http_common.js:124:22)
Aug  9 11:05:30 stackstorm hubot[17042]:     at TLSSocket.socketOnData (_http_client.js:451:20)
Aug  9 11:05:30 stackstorm hubot[17042]:     at TLSSocket.emit (events.js:198:13)
Aug  9 11:05:30 stackstorm hubot[17042]:     at addChunk (_stream_readable.js:288:12)
Aug  9 11:05:30 stackstorm hubot[17042]:     at readableAddChunk (_stream_readable.js:269:11)
Aug  9 11:05:30 stackstorm hubot[17042]:     at TLSSocket.Readable.push (_stream_readable.js:224:10)
Aug  9 11:05:30 stackstorm hubot[17042]:     at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
Aug  9 11:05:30 stackstorm hubot[17042]: [Mon Aug 09 2021 11:05:30 GMT+0000 (Coordinated Universal Time)] ERROR TypeError: Cannot read property 'roomID' of undefined
Aug  9 11:05:30 stackstorm hubot[17042]:     at strings.map (/opt/stackstorm/chatops/node_modules/hubot-rocketchat/index.js:155:25)
Aug  9 11:05:30 stackstorm hubot[17042]:     at Array.map (<anonymous>:null:null)
Aug  9 11:05:30 stackstorm hubot[17042]:     at RocketChatBotAdapter.send (/opt/stackstorm/chatops/node_modules/hubot-rocketchat/index.js:154:20)
Aug  9 11:05:30 stackstorm hubot[17042]:     at Robot.messageRoom (/opt/stackstorm/chatops/node_modules/hubot/src/robot.js:608:23)
Aug  9 11:05:30 stackstorm hubot[17042]:     at sendChunk (/opt/stackstorm/chatops/node_modules/hubot-stackstorm/src/lib/adapters/rocketchat.js:73:25)
Aug  9 11:05:30 stackstorm hubot[17042]:     at RocketChatAdapter.postData (/opt/stackstorm/chatops/node_modules/hubot-stackstorm/src/lib/adapters/rocketchat.js:78:5)
Aug  9 11:05:30 stackstorm hubot[17042]:     at EventSource.<anonymous> (/opt/stackstorm/chatops/node_modules/hubot-stackstorm/src/lib/stackstorm_api.js:453:20)
Aug  9 11:05:30 stackstorm hubot[17042]:     at EventSource.emit (events.js:198:13)
Aug  9 11:05:30 stackstorm hubot[17042]:     at _emit (/opt/stackstorm/chatops/node_modules/eventsource/lib/eventsource.js:172:17)
Aug  9 11:05:30 stackstorm hubot[17042]:     at parseEventStreamLine (/opt/stackstorm/chatops/node_modules/eventsource/lib/eventsource.js:186:9)
Aug  9 11:05:30 stackstorm hubot[17042]:     at IncomingMessage.<anonymous> (/opt/stackstorm/chatops/node_modules/eventsource/lib/eventsource.js:150:11)
Aug  9 11:05:30 stackstorm hubot[17042]:     at IncomingMessage.emit (events.js:198:13)
Aug  9 11:05:30 stackstorm hubot[17042]:     at addChunk (_stream_readable.js:288:12)
Aug  9 11:05:30 stackstorm hubot[17042]:     at readableAddChunk (_stream_readable.js:269:11)
Aug  9 11:05:30 stackstorm hubot[17042]:     at IncomingMessage.Readable.push (_stream_readable.js:224:10)
Aug  9 11:05:30 stackstorm hubot[17042]:     at HTTPParser.parserOnBody (_http_common.js:124:22)
Aug  9 11:05:30 stackstorm hubot[17042]:     at TLSSocket.socketOnData (_http_client.js:451:20)
Aug  9 11:05:30 stackstorm hubot[17042]:     at TLSSocket.emit (events.js:198:13)
Aug  9 11:05:30 stackstorm hubot[17042]:     at addChunk (_stream_readable.js:288:12)
Aug  9 11:05:30 stackstorm hubot[17042]:     at readableAddChunk (_stream_readable.js:269:11)
Aug  9 11:05:30 stackstorm hubot[17042]:     at TLSSocket.Readable.push (_stream_readable.js:224:10)
Aug  9 11:05:30 stackstorm hubot[17042]:     at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
Aug  9 11:05:30 stackstorm hubot[17042]: [Mon Aug 09 2021 11:05:30 GMT+0000 (Coordinated Universal Time)] INFO Hubot will shut down ...
Aug  9 11:05:30 stackstorm hubot[17042]: [Mon Aug 09 2021 11:05:30 GMT+0000 (Coordinated Universal Time)] WARNING Stream error: Event { type: 'error' }
Aug  9 11:05:30 stackstorm st2rulesengine[6445]: 2021-08-09 11:05:30,873 INFO [-] Found 0 rules defined for trigger core.st2.generic.actiontrigger
Aug  9 11:05:30 stackstorm st2rulesengine[6445]: 2021-08-09 11:05:30,875 INFO [-] No matching rules found for trigger instance 61110bfad482a41b070b836b.
Aug  9 11:05:31 stackstorm hubot[17042]: [Mon Aug 09 2021 11:05:31 GMT+0000 (Coordinated Universal Time)] DEBUG Chatops message received: {"payload": {"extra": null, "context": null, "whisper": false, "user": null, "message": "testmessage", "channel": "IT"}, "trace_context": {}}
Aug  9 11:05:31 stackstorm hubot[17042]: /opt/stackstorm/chatops/node_modules/hubot-rocketchat/index.js:155
Aug  9 11:05:31 stackstorm hubot[17042]:       if (envelope.user.roomID) driver.sendToRoomId(text, envelope.user.roomID)
Aug  9 11:05:31 stackstorm hubot[17042]:                         ^
Aug  9 11:05:31 stackstorm hubot[17042]: TypeError: Cannot read property 'roomID' of undefined
Aug  9 11:05:31 stackstorm hubot[17042]:     at strings.map (/opt/stackstorm/chatops/node_modules/hubot-rocketchat/index.js:155:25)
Aug  9 11:05:31 stackstorm hubot[17042]:     at Array.map (<anonymous>:null:null)
Aug  9 11:05:31 stackstorm hubot[17042]:     at RocketChatBotAdapter.send (/opt/stackstorm/chatops/node_modules/hubot-rocketchat/index.js:154:20)
Aug  9 11:05:31 stackstorm hubot[17042]:     at Robot.messageRoom (/opt/stackstorm/chatops/node_modules/hubot/src/robot.js:608:23)
Aug  9 11:05:31 stackstorm hubot[17042]:     at sendChunk (/opt/stackstorm/chatops/node_modules/hubot-stackstorm/src/lib/adapters/rocketchat.js:73:25)
Aug  9 11:05:31 stackstorm hubot[17042]:     at RocketChatAdapter.postData (/opt/stackstorm/chatops/node_modules/hubot-stackstorm/src/lib/adapters/rocketchat.js:78:5)
Aug  9 11:05:31 stackstorm hubot[17042]:     at EventSource.<anonymous> (/opt/stackstorm/chatops/node_modules/hubot-stackstorm/src/lib/stackstorm_api.js:453:20)
Aug  9 11:05:31 stackstorm hubot[17042]:     at EventSource.emit (events.js:198:13)
Aug  9 11:05:31 stackstorm hubot[17042]:     at _emit (/opt/stackstorm/chatops/node_modules/eventsource/lib/eventsource.js:172:17)
Aug  9 11:05:31 stackstorm hubot[17042]:     at parseEventStreamLine (/opt/stackstorm/chatops/node_modules/eventsource/lib/eventsource.js:186:9)
Aug  9 11:05:31 stackstorm hubot[17042]:     at IncomingMessage.<anonymous> (/opt/stackstorm/chatops/node_modules/eventsource/lib/eventsource.js:150:11)
Aug  9 11:05:31 stackstorm hubot[17042]:     at IncomingMessage.emit (events.js:198:13)
Aug  9 11:05:31 stackstorm hubot[17042]:     at addChunk (_stream_readable.js:288:12)
Aug  9 11:05:31 stackstorm hubot[17042]:     at readableAddChunk (_stream_readable.js:269:11)
Aug  9 11:05:31 stackstorm hubot[17042]:     at IncomingMessage.Readable.push (_stream_readable.js:224:10)
Aug  9 11:05:31 stackstorm hubot[17042]:     at HTTPParser.parserOnBody (_http_common.js:124:22)
Aug  9 11:05:31 stackstorm hubot[17042]:     at TLSSocket.socketOnData (_http_client.js:451:20)
Aug  9 11:05:31 stackstorm hubot[17042]:     at TLSSocket.emit (events.js:198:13)
Aug  9 11:05:31 stackstorm hubot[17042]:     at addChunk (_stream_readable.js:288:12)
Aug  9 11:05:31 stackstorm hubot[17042]:     at readableAddChunk (_stream_readable.js:269:11)
Aug  9 11:05:31 stackstorm hubot[17042]:     at TLSSocket.Readable.push (_stream_readable.js:224:10)
Aug  9 11:05:31 stackstorm hubot[17042]:     at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
Aug  9 11:05:31 stackstorm systemd[1]: st2chatops.service: Main process exited, code=exited, status=1/FAILURE
Aug  9 11:05:31 stackstorm systemd[1]: st2chatops.service: Failed with result 'exit-code'.
Aug  9 11:05:37 stackstorm systemd[1]: st2chatops.service: Service hold-off time over, scheduling restart.
Aug  9 11:05:37 stackstorm systemd[1]: st2chatops.service: Scheduled restart job, restart counter is at 10.
Aug  9 11:05:37 stackstorm systemd[1]: Stopped StackStorm service st2chatops.
Aug  9 11:05:37 stackstorm systemd[1]: Started StackStorm service st2chatops.

Will st2chatops adapter support rocket chat?

Hi guys,

My staff are using rocketChat as our chatops tool.

I want my channel BOT to do some tasks by using stackstorm, everytime he responses only some ack info, such as:

Want me to take that off your hand? You got it! Don't forget your execution ID:........

but I really want to get the results of those tasks, so I'm now trying to config rocketChat on st2chatops, unfortunately, I find there's no adapter for rocketChat.

need your help

Installer waits forever on el6 if HUBOT_SLACK_TOKEN is defined

NOTE: This issue only applies to el6 systems.

Define the HUBOT_SLACK_TOKEN variable, and then install BWC using:

curl -sSL -O https://brocade.com/bwc/install/install.sh && chmod +x install.sh
./install.sh --user=st2admin --password='Ch@ngeMe' --license=${BWC_LICENSE_KEY}

After displaying the ok_message, the installer will wait forever. CTRL-C to proceed, and CTRL-C again to cancel the BWC installation.

After cancelling the installation, you can reproduce the issue by executing the following script any number of times:

#!/bin/bash

adddate() {
    while IFS= read -r line; do
        echo "$(date +%Y%m%dT%H%M%S%z) $line"
    done
}

configure_st2chatops() {
  echo "Start"
  sudo service st2chatops restart
  echo "Finish"
}

configure_st2chatops | adddate | sudo tee a
exit ${PIPESTATUS[0]}

You'll notice that configure_st2chatops finishes, but the pipe never closes. You can remove adddate from the pipe, but that makes no difference. If you replace configure_st2chatops | adddate | sudo tee a with configure_st2chatops, then the script finishes as expected (but then there's no logging with timestamps).

On the other hand, if you leave the pipe as specified above, but comment out sudo service st2chatops restart, the pipe closes successfully.

We can conclude there's something in sudo service st2chatops restart that doesn't interact well with pipes. The other services on el6 use the daemon function as opposed to nohup_start. Compare https://github.com/StackStorm/st2chatops/blob/master/rpm/st2chatops.init with https://github.com/StackStorm/st2-packages/blob/master/packages/st2/rpm/st2api.init

I was unable to replace nohup_start with daemon in a way that successfully started st2chatops (i.e., hubot). Hopefully I've provided enough information here so someone else can easily fix. If not, I'll try to figure it out.

Proposal: Support Nodejs 10.x

Nodejs 10.x was released in April 2018.

We currently support Nodejs 6.x.

I propose we skip 8.x, and go straight to 10.x support.

Required:

  • Test st2chatops with Nodejs 10.x
  • Update CI to use 10.x
  • Figure out upgrade path for existing users
  • Update packaging scripts to install 10.x
  • Update documentation to use 10.x.

chatops connect to Slack always fail - st2 3.2.0

Using hubot token

 HUBOT_SLACK_TOKEN=xoxb-my-hubot-token \
> HUBOT_ADAPTER=slack \
> HUBOT_LOG_LEVEL=debug \
> HUBOT_SLACK_RTM_CLIENT_OPTS='{ "logLevel": "debug" }' \
> HUBOT_SLACK_RTM_CLIENT_OPTS='{ "retryConfig": { "retries": 20 } }' \
> HUBOT_SLACK_RTM_START_OPTS='{ "mpim_aware": true }' \
>  ./bin/hubot --adapter slack
body-parser deprecated undefined extended: provide extended option node_modules/hubot/src/robot.js:445:21
[Wed Jun 17 2020 22:25:02 GMT-0700 (Pacific Daylight Time)] DEBUG Loading adapter slack
[Wed Jun 17 2020 22:25:03 GMT-0700 (Pacific Daylight Time)] INFO hubot-slack adapter v4.5.5
warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
[Wed Jun 17 2020 22:25:03 GMT-0700 (Pacific Daylight Time)] DEBUG RtmClient initialized with options: {"retryConfig":{"retries":20},"maxRequestConcurrency":1}
[Wed Jun 17 2020 22:25:03 GMT-0700 (Pacific Daylight Time)] DEBUG RtmClient#start() with options: {"mpim_aware":true}
[Wed Jun 17 2020 22:25:04 GMT-0700 (Pacific Daylight Time)] DEBUG SlackBot#authenticated() Found self in RTM start data
[Wed Jun 17 2020 22:25:04 GMT-0700 (Pacific Daylight Time)] INFO Logged in as @hubot in workspace hubot-test-20
[Wed Jun 17 2020 22:25:05 GMT-0700 (Pacific Daylight Time)] INFO Connected to Slack RTM
[Wed Jun 17 2020 22:25:05 GMT-0700 (Pacific Daylight Time)] DEBUG Loading scripts from /opt/stackstorm/chatops/scripts
[Wed Jun 17 2020 22:25:05 GMT-0700 (Pacific Daylight Time)] DEBUG Loading scripts from /opt/stackstorm/chatops/src/scripts
[Wed Jun 17 2020 22:25:05 GMT-0700 (Pacific Daylight Time)] DEBUG Loading external-scripts from npm packages
[Wed Jun 17 2020 22:25:05 GMT-0700 (Pacific Daylight Time)] DEBUG Using slack adapter
[Wed Jun 17 2020 22:25:05 GMT-0700 (Pacific Daylight Time)] INFO Requesting a token...
[Wed Jun 17 2020 22:25:05 GMT-0700 (Pacific Daylight Time)] DEBUG Parsing help for /opt/stackstorm/chatops/node_modules/hubot-stackstorm/src/stackstorm.js
[Wed Jun 17 2020 22:25:05 GMT-0700 (Pacific Daylight Time)] DEBUG Parsing help for /opt/stackstorm/chatops/node_modules/hubot-help/src/help.coffee
[Wed Jun 17 2020 22:25:05 GMT-0700 (Pacific Daylight Time)] ERROR Failed to authenticate: Invalid or missing credentials
[Wed Jun 17 2020 22:25:05 GMT-0700 (Pacific Daylight Time)] ERROR undefined
[Wed Jun 17 2020 22:25:05 GMT-0700 (Pacific Daylight Time)] ERROR {"name":"APIError","status":401,"message":"Invalid or missing credentials"}
[Wed Jun 17 2020 22:25:05 GMT-0700 (Pacific Daylight Time)] INFO Hubot will shut down ...
[Wed Jun 17 2020 22:25:05 GMT-0700 (Pacific Daylight Time)] INFO Disconnected from Slack RTM
[Wed Jun 17 2020 22:25:05 GMT-0700 (Pacific Daylight Time)] INFO Exiting...

Using a bot user token

 HUBOT_SLACK_TOKEN=xoxb-my-bot-token \
> HUBOT_ADAPTER=slack \
> HUBOT_LOG_LEVEL=debug \
> HUBOT_SLACK_RTM_CLIENT_OPTS='{ "logLevel": "debug" }' \
> HUBOT_SLACK_RTM_CLIENT_OPTS='{ "retryConfig": { "retries": 20 } }' \
> HUBOT_SLACK_RTM_START_OPTS='{ "mpim_aware": true }' \
>  ./bin/hubot --adapter slack
body-parser deprecated undefined extended: provide extended option node_modules/hubot/src/robot.js:445:21
[Wed Jun 17 2020 22:19:27 GMT-0700 (Pacific Daylight Time)] DEBUG Loading adapter slack
[Wed Jun 17 2020 22:19:28 GMT-0700 (Pacific Daylight Time)] INFO hubot-slack adapter v4.5.5
warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
[Wed Jun 17 2020 22:19:28 GMT-0700 (Pacific Daylight Time)] DEBUG RtmClient initialized with options: {"retryConfig":{"retries":20},"maxRequestConcurrency":1}
[Wed Jun 17 2020 22:19:28 GMT-0700 (Pacific Daylight Time)] DEBUG RtmClient#start() with options: {"mpim_aware":true}
[Wed Jun 17 2020 22:19:29 GMT-0700 (Pacific Daylight Time)] DEBUG SlackBot#authenticated() Found self in RTM start data
[Wed Jun 17 2020 22:19:29 GMT-0700 (Pacific Daylight Time)] INFO Logged in as @ansible-bot in workspace hubot-test-20
[Wed Jun 17 2020 22:19:30 GMT-0700 (Pacific Daylight Time)] INFO Connected to Slack RTM
[Wed Jun 17 2020 22:19:30 GMT-0700 (Pacific Daylight Time)] DEBUG Loading scripts from /opt/stackstorm/chatops/scripts
[Wed Jun 17 2020 22:19:30 GMT-0700 (Pacific Daylight Time)] DEBUG Loading scripts from /opt/stackstorm/chatops/src/scripts
[Wed Jun 17 2020 22:19:30 GMT-0700 (Pacific Daylight Time)] DEBUG Loading external-scripts from npm packages
[Wed Jun 17 2020 22:19:30 GMT-0700 (Pacific Daylight Time)] DEBUG Using slack adapter
[Wed Jun 17 2020 22:19:30 GMT-0700 (Pacific Daylight Time)] INFO Requesting a token...
[Wed Jun 17 2020 22:19:30 GMT-0700 (Pacific Daylight Time)] DEBUG Parsing help for /opt/stackstorm/chatops/node_modules/hubot-stackstorm/src/stackstorm.js
[Wed Jun 17 2020 22:19:30 GMT-0700 (Pacific Daylight Time)] DEBUG Parsing help for /opt/stackstorm/chatops/node_modules/hubot-help/src/help.coffee
[Wed Jun 17 2020 22:19:30 GMT-0700 (Pacific Daylight Time)] ERROR Failed to authenticate: Invalid or missing credentials
[Wed Jun 17 2020 22:19:30 GMT-0700 (Pacific Daylight Time)] ERROR undefined
[Wed Jun 17 2020 22:19:30 GMT-0700 (Pacific Daylight Time)] ERROR {"name":"APIError","status":401,"message":"Invalid or missing credentials"}
[Wed Jun 17 2020 22:19:30 GMT-0700 (Pacific Daylight Time)] INFO Hubot will shut down ...
[Wed Jun 17 2020 22:19:30 GMT-0700 (Pacific Daylight Time)] INFO Disconnected from Slack RTM
[Wed Jun 17 2020 22:19:30 GMT-0700 (Pacific Daylight Time)] INFO Exiting...

And the hubot token I used here is still working

Here is the env version

[root@ chatops]# st2 --version
st2 3.2.0, on Python 2.7.5
[root@ chatops]#
[root@ chatops]# bin/hubot -v
Must provide HUBOT_ADAPTER ENV variable to start.
See README.md for more information
[root@ chatops]# HUBOT_ADAPTER=slack bin/hubot -v
body-parser deprecated undefined extended: provide extended option node_modules/hubot/src/robot.js:445:21
[Wed Jun 17 2020 22:54:16 GMT-0700 (Pacific Daylight Time)] DEBUG Loading adapter slack
[Wed Jun 17 2020 22:54:17 GMT-0700 (Pacific Daylight Time)] INFO hubot-slack adapter v4.5.5
warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
[Wed Jun 17 2020 22:54:17 GMT-0700 (Pacific Daylight Time)] DEBUG RtmClient initialized with options: undefined
3.1.1
[root@ chatops]#

No response in Slack

This is fresh install of stackStorm where st2chatops/hubot is installed as part of stackstorm. There is no error/warning observed in logs but I dont get any response back in slack channel. Attaching log and st2chatops.env.

Jul 26 16:12:04 stackstorm systemd[1]: Stopped StackStorm service st2chatops.
Jul 26 16:12:21 stackstorm systemd[1]: Started StackStorm service st2chatops.
Jul 26 16:12:21 stackstorm systemd[1]: Starting StackStorm service st2chatops...
Jul 26 16:12:38 stackstorm hubot[2441]: [Tue Jul 26 2016 16:12:38 GMT-0400 (EDT)] DEBUG Loading adapter slack
Jul 26 16:12:41 stackstorm hubot[2441]: [Tue Jul 26 2016 16:12:41 GMT-0400 (EDT)] INFO Connecting...
Jul 26 16:13:13 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:13 GMT-0400 (EDT)] INFO Logged in as vp, but not yet connected
Jul 26 16:13:13 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:13 GMT-0400 (EDT)] INFO Slack client now connected
Jul 26 16:13:13 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:13 GMT-0400 (EDT)] DEBUG Loading scripts from /opt/stackstorm/chatops/scripts
Jul 26 16:13:13 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:13 GMT-0400 (EDT)] DEBUG Loading scripts from /opt/stackstorm/chatops/src/scripts
Jul 26 16:13:13 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:13 GMT-0400 (EDT)] DEBUG Loading hubot-scripts from /opt/stackstorm/chatops/node_modules/hubot-scripts/src
Jul 26 16:13:13 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:13 GMT-0400 (EDT)] DEBUG Loading external-scripts from npm packages
Jul 26 16:13:13 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:13 GMT-0400 (EDT)] INFO Using ST2_API_KEY as authentication. Expiry will lead to bot exit.
Jul 26 16:13:13 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:13 GMT-0400 (EDT)] DEBUG Using slack post data handler.
Jul 26 16:13:13 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:13 GMT-0400 (EDT)] DEBUG Parsing help for /opt/stackstorm/chatops/node_modules/hubot-stackstorm/scripts/st
Jul 26 16:13:13 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:13 GMT-0400 (EDT)] INFO Loading commands....
Jul 26 16:13:13 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:13 GMT-0400 (EDT)] DEBUG Parsing help for /opt/stackstorm/chatops/node_modules/hubot-help/src/help.coffee
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: pack deploy [packs ] [branch ] -
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: pack deploy {{repo_name}} packs {{packs}} branch {{branch}} - Down
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: pack deploy {{repo_name}} packs {{packs}} - Download StackStorm pa
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: pack deploy [branch ] - Download StackS
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: pack deploy {{repo_name}} branch {{branch=master}} - Download Stac
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: pack deploy {{repo_name}} - Download StackStorm packs via ChatOps
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: pack info {{pack}} - Get StackStorm pack information via ChatOps
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: show git clone {{repo_name}} - Show the Git clone command for a gi
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: st2 list {{ limit=10 }} actions - List available StackStorm action
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: st2 list {{ limit=10 }} actions from {{ pack }} - List available S
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: st2 get execution {{ id }} - Retrieve details for a single executi
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: st2 show execution {{ id }} - Retrieve details for a single execut
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: st2 executions get {{ id }} - Retrieve details for a single execut
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: st2 executions show {{ id }} - Retrieve details for a single execu
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: st2 list {{ limit=10 }} executions - List available StackStorm exe
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: st2 list {{ limit=10 }} executions with status {{ status }} - List
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: st2 list {{ limit=10 }} executions for action {{ action }} - List
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: st2 re-run execution {{ id }} - Re-run an action execution.
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: st2 executions re-run {{ id }} - Re-run an action execution.
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: st2 list {{ limit=10 }} rules - List available StackStorm rules.
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: st2 list {{ limit=10 }} rules from {{ pack }} - List available Sta
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: st2 list {{ limit=10 }} sensors - List available StackStorm sensor
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] DEBUG Added command: st2 list {{ limit=10 }} sensors from {{ pack }} - List available S
Jul 26 16:13:14 stackstorm hubot[2441]: [Tue Jul 26 2016 16:13:14 GMT-0400 (EDT)] INFO 21 commands are loaded

st2chatops.env:
export HUBOT_ADAPTER=slack
export HUBOT_SLACK_TOKEN=xxxxxxxx
export HUBOT_SLACK_EXIT_ON_DISCONNECT=1

body-parser deprecated undefined extended: provide extended option prevent st2chatops start

I installed StackStorm 3.2.0 via ansible playbook

ansible-playbook stackstorm.yml --verbose

Git HEAD of ansible playbook is

commit 97108985f3351d696d3413f2db3cf3d43eb43a89
Merge: 86a1cec 35abf1d
Author: JP Bourget <[email protected]>
Date:   Tue Apr 14 13:40:42 2020 -0400

    Merge pull request #258 from StackStorm/custom_nginx

    Custom nginx

When I try to start st2chatops, it failed to start with error messages like

systemctl status st2chatops
● st2chatops.service - StackStorm service st2chatops
   Loaded: loaded (/usr/lib/systemd/system/st2chatops.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Sun 2020-06-21 21:36:00 PDT; 6min ago
  Process: 15385 ExecStart=/opt/stackstorm/chatops/bin/hubot $DAEMON_ARGS (code=exited, status=0/SUCCESS)
 Main PID: 15385 (code=exited, status=0/SUCCESS)

Jun 21 21:35:59 agentavtone-masterone.fyre.ibm.com systemd[1]: Started StackStorm service st2chatops.
Jun 21 21:36:00 agentavtone-masterone.fyre.ibm.com hubot[15385]: Mon, 22 Jun 2020 04:36:00 GMT body-parser deprecated undefined extended: provide extended option at node_modules/hubot/src/...t.js:445:21
Jun 21 21:36:00 agentavtone-masterone.fyre.ibm.com hubot[15385]: [Sun Jun 21 2020 21:36:00 GMT-0700 (Pacific Daylight Time)] DEBUG Loading adapter shell
Jun 21 21:36:00 agentavtone-masterone.fyre.ibm.com hubot[15385]: No history available
Jun 21 21:36:00 agentavtone-masterone.fyre.ibm.com hubot[15385]: [137B blob data]
Jun 21 21:36:00 agentavtone-masterone.fyre.ibm.com hubot[15385]: [Sun Jun 21 2020 21:36:00 GMT-0700 (Pacific Daylight Time)] DEBUG Loading scripts from /opt/stackstorm/chatops/src/scripts
Hint: Some lines were ellipsized, use -l to show in full.

I can run ./bin/hubot --adapter slack from command line and I can get hubot connect to my Slack workspace.

HUBOT_SLACK_TOKEN=xoxb-my-token HUBOT_ADAPTER=slack HUBOT_LOG_LEVEL=debug HUBOT_SLACK_RTM_CLIENT_OPTS='{ "logLevel": "de
bug" }' HUBOT_SLACK_RTM_CLIENT_OPTS='{ "retryConfig": { "retries": 20 } }' HUBOT_SLACK_RTM_START_OPTS='{ "mpim_aware": true }'  ./bin/hubot --adapter slack

body-parser deprecated undefined extended: provide extended option node_modules/hubot/src/robot.js:445:21
[Sun Jun 21 2020 21:38:06 GMT-0700 (Pacific Daylight Time)] DEBUG Loading adapter slack
[Sun Jun 21 2020 21:38:07 GMT-0700 (Pacific Daylight Time)] INFO hubot-slack adapter v4.5.5
warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
[Sun Jun 21 2020 21:38:07 GMT-0700 (Pacific Daylight Time)] DEBUG RtmClient initialized with options: {"retryConfig":{"retries":20},"maxRequestConcurrency":1}
[Sun Jun 21 2020 21:38:07 GMT-0700 (Pacific Daylight Time)] DEBUG RtmClient#start() with options: {"mpim_aware":true}
[Sun Jun 21 2020 21:38:08 GMT-0700 (Pacific Daylight Time)] DEBUG SlackBot#authenticated() Found self in RTM start data
[Sun Jun 21 2020 21:38:08 GMT-0700 (Pacific Daylight Time)] INFO Logged in as @hubot in workspace hubot-test-20
[Sun Jun 21 2020 21:38:09 GMT-0700 (Pacific Daylight Time)] INFO Connected to Slack RTM

The log message from command line also claims body-parser deprecated undefined extended. Seem like this error prevented st2chatops service start via systemctl.

body-parser deprecated undefined extended: provide extended option node_modules/hubot/src/robot.js:445:21

Node.js 6 Requires doesn't work on EL6

When installing updated st2chatops package since #78 it should rely on node.js 6 only as dependency, defined via Requires: nodejs >= 6.0, nodejs < 7.0.

It does not, - even with older node.js 4 package installation works, which is not a desired behavior.

CI jobs are succeeding despite errors in them

st2chatops build and test jobs showing green ✔️ status, ignoring error return codes during the script executions.


  • Set all st2chatops builds to fail upon errors.
  • Ensure not a breaking change
  • el7
  • el6
  • bionic
  • xenial
  • trusty

Add Changelog

This repo is missing a CHANGELOG, making it difficult to understand what has changed since a particular version in the STackStorm release process.

st2chatops doesn't exit on ERROR, keeps waiting/unresponsive when AUTH/API unresolved

Spot during the StackStorm/st2-dockerfiles#19 K8s/Docker work

If ST2 AUTH/API urls can't be DNS resolved, ERROR state is reached, however st2chatops doesn't exit with respective error code. Instead it's being unresponsive/hanging/waiting in a running state.

It should exit instead (or retry with limit). This especially makes Docker env unreliable where we expect the process to exit/stop if something didn't work properly.

Reproducing

cd /opt/stackstorm/chatops
ST2_AUTH_URL=http://non-existent:9100/ ST2_API_URL=http://non-existent:9101/ bin/hubot 

Log

$ docker logs 9c1d109416fd
body-parser deprecated undefined extended: provide extended option node_modules/hubot/src/robot.js:445:21
[Thu Apr 04 2019 17:03:57 GMT+0000 (Coordinated Universal Time)] DEBUG Loading adapter slack
[Thu Apr 04 2019 17:03:57 GMT+0000 (Coordinated Universal Time)] INFO hubot-slack adapter v4.5.5
warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
[Thu Apr 04 2019 17:03:57 GMT+0000 (Coordinated Universal Time)] DEBUG RtmClient initialized with options: undefined
[Thu Apr 04 2019 17:03:57 GMT+0000 (Coordinated Universal Time)] DEBUG RtmClient#start() with options: {}
[Thu Apr 04 2019 17:03:58 GMT+0000 (Coordinated Universal Time)] DEBUG SlackBot#authenticated() Found self in RTM start data
[Thu Apr 04 2019 17:03:58 GMT+0000 (Coordinated Universal Time)] INFO Logged in as @stanley in workspace arma
[Thu Apr 04 2019 17:03:58 GMT+0000 (Coordinated Universal Time)] INFO Connected to Slack RTM
[Thu Apr 04 2019 17:03:58 GMT+0000 (Coordinated Universal Time)] DEBUG Loading scripts from /opt/stackstorm/chatops/scripts
[Thu Apr 04 2019 17:03:58 GMT+0000 (Coordinated Universal Time)] DEBUG Loading scripts from /opt/stackstorm/chatops/src/scripts
[Thu Apr 04 2019 17:03:58 GMT+0000 (Coordinated Universal Time)] DEBUG Loading external-scripts from npm packages
[Thu Apr 04 2019 17:03:58 GMT+0000 (Coordinated Universal Time)] INFO Requesting a token...
[Thu Apr 04 2019 17:03:58 GMT+0000 (Coordinated Universal Time)] DEBUG Using slack post data handler.
[Thu Apr 04 2019 17:03:58 GMT+0000 (Coordinated Universal Time)] DEBUG Parsing help for /opt/stackstorm/chatops/node_modules/hubot-stackstorm/scripts/stackstorm.js
[Thu Apr 04 2019 17:03:58 GMT+0000 (Coordinated Universal Time)] DEBUG Parsing help for /opt/stackstorm/chatops/node_modules/hubot-help/src/help.coffee
[Thu Apr 04 2019 17:03:58 GMT+0000 (Coordinated Universal Time)] ERROR Failed to authenticate: getaddrinfo ENOTFOUND non-existent non-existent:9100
(node:24) UnhandledPromiseRejectionWarning: Error: getaddrinfo ENOTFOUND non-existent non-existent:9100
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26)

(node:24) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:24) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Default log level should be INFO

The default log level set in st2chatops.env is debug

# Log level
export HUBOT_LOG_LEVEL=debug

This makes st2chatops log messages every 2 minutes, containing every alias loaded. This results in large st2chatops.log files.

I think it would be better to have a default log level 'INFO'.

Regenerate npm-shrinkwrap to up-to-date dependencies (security)

As a maintenance work, we'll need to regenerate our npm-shrinkwrap.json to get rid of outdated or potentially vulnerable npm dependencies for st2chatops.

Extra care about making sure that updated dependencies don't break existing chatops behavior (happened before).

please update hubot-spark

st2chatops currently bundles hubot-spark 1.7.1 which in turn uses a 3rd party cisco spark module.

hubot-spark 2.0.0 uses the official cisco sdk and fixes several issues including being able to receive messages in rooms.

Use Node.js v6.x

Node.js v4.x goes into maintenance mode as of 2017-04-01.

We should update our packaging to use Node.js v6.x by default.

Build fails on 3rd party Forked PRs

Example: https://circleci.com/gh/StackStorm/st2chatops/253

This happens because of several reasons:

  • Build assumes that HUBOT_SLACK_TOKEN is provided
  • Build assumes that PACKAGECLOUD_TOKEN is provided

For security reasons these env variables are hidden https://circleci.com/docs/fork-pr-builds/#security-implications-of-running-builds-for-pull-requests-from-forks for forked builds.
But it's possible to make some steps optional which require envs. For example HUBOT_SLACK_TOKEN is not needed for the PR builds.

For the moment it means it's hardly possible to accept 3rd party contributions.

st2chatops never fires an action

From user report on [email protected] or googlegroups.

"This was, in fact, a problem with the matching rules. All of the sample
commands I had found used !rules and !help - this did not work. Everything
immediately worked fine when I used '! rules' and '! help'. Hope this helps
someone along the way."

This sounds like a bug with out help string geenration?

API call for stream fails because of presence of 'x-auth-token' query param

I'm unsure if this is an issue with this Docker image (really, the versions of various things in it) or something else, but I'm running into issues. I've tried this with both ST2 1.3.x and 1.4dev.

When hubot tries to query /v1/stream, it uses a request like the following (which is proxied through nginx):

172.17.0.36 - - [12/Feb/2016:16:45:20 -0800] "GET /api/v1/stream?x-auth-token=9e1fdd874bf04c0ba0789ced62f51d97 HTTP/1.1" 500 46 "-" "-"

The 500 error is returned because of this error in st2api.log:

2016-02-12 16:38:30,274 139669775957680 ERROR log [-] API call failed: get_all() got an unexpected keyword argument 'x-auth-token'
Traceback (most recent call last):
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/pecan/core.py", line 631, in __call__
    self.invoke_controller(controller, args, kwargs, state)
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/pecan/core.py", line 531, in invoke_controller
    result = controller(*args, **kwargs)
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/st2common/models/api/base.py", line 245, in callfunction
    raise e
TypeError: get_all() got an unexpected keyword argument 'x-auth-token' (_exception_data={},_exception_class='TypeError',_exception_message="get_all() got an unexpected keyword argument 'x-auth-token'")

As far as I can tell, this request form is allowed by ST2.

repository docker.io/stackstorm/hubot not found: does not exist or no pull access

Hi team.

When I tried to pull st2chatops docker image, I got below error.

root# docker pull stackstorm/hubotUsing default tag: latest
Trying to pull repository docker.io/stackstorm/hubot ...
repository docker.io/stackstorm/hubot not found: does not exist or no pull access

It seems like my shell cannot find the docker image.

st2chatops needs logrotate configuration

The st2chatops package should ship with a logrotate configuration file, similar to https://github.com/StackStorm/st2/blob/master/conf/logrotate.conf

Otherwise the Chatops logs get out of hand, e.g:

brocade@BWC:~$ du -hs /var/log/st2/st2chatops.log
581M    /var/log/st2/st2chatops.log
brocade@BWC:~$ 

This should have the same rotation policy as the st2 logrotate configuration.

Important:

  • file should not get deleted on RPM upgrade
  • Ensure st2chatops gracefully handles re-opening log files.

OSError when executing ansible playbook from chatops

When I create a new chatop action and alias to run a playbook, the playbook executes but thrown an error when executed from st2/chatops.

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: OSError: [Errno 2] No such file or directory
fatal: [hq-r1]: FAILED! => {"failed": true, "msg": "Unexpected failure during module execution.", "stdout": ""}
	to retry, use: --limit @/opt/stackstorm/packs/st2_chatops_aliases/playbooks/show_bgp_status.retry

when i execute the playbook manually it runs fine and output the bgp-neighbor.

I cannot find anything that is responsible for the error 'OSError' not on Ansible and not on ST2

Use correctly /etc/sysconfig and /etc/default env defaults

There are places for default env variables in different distro families:

  • /etc/sysconfig - for Red Hat-like
  • /etc/default - for debian-like

We support them in init files:
https://github.com/StackStorm/st2chatops/blob/master/debian/st2chatops.upstart#L24
https://github.com/StackStorm/st2chatops/blob/master/rpm/st2chatops.service#L10

So st2chatops.env should not overwrite env variable, if it was already passed.
The good example is: https://github.com/StackStorm/st2chatops/blob/master/st2chatops.env#L1

export ST2_HOSTNAME="${ST2_HOSTNAME:-localhost}"

^^ Do that for every other env variable in st2chatops.env as a rule.


Ideally, apart of editing existing st2chatops.env (sed-like stuff is error-prone) user can just place his custom variables (good to do with Configuration Management tools) in /etc/sysconfig/st2chatops or /etc/default/st2chatops and be sure that they're used as a priority.

INFO Slack client closed, waiting for reconnect

Hello,
We found that st2chatops is have random disconnections from slack,
The expected behavior that the hubot/stackstorm will try to reconnect slack.
At logs we found line 'INFO Slack client closed, waiting for reconnect' but it's not trying to reconnect.

Incorrectly posting to multiple rooms with hubot-spark

When listing multiple rooms in HUBOT_SPARK_ROOMS, responses from st2 chatops.run are delivered to all rooms instead of only the room the message originated in.

HUBOT_SPARK_ROOMS is defined as:
export HUBOT_SPARK_ROOMS='xxxxxxx,yyyyyy,zzzzzz'

Thanks.

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.