saltstack / saltstack/salt

OpsGenie state returns with incorrect type for changes

Open
#55,562 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Confirmed needs-testcase Regression severity-high
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue

'changes' should be a dictionary, e.g.


      ID: monitoring-http-IPTPRDORC101-81-alert-opsgenie-close
Function: opsgenie.close_alert
    Name: aurizon-ndc-b1-monitor-http-IPTPRDORC101-81-alert-opsgenie
  Result: False
 Comment: An exception occurred in this state: 'Changes' should be a dictionary.
 Changes:   

The state returns False even though it has succeeded in talking to the OpsGenie API. Hence dependent states can't reliably use True/False return from the opsgenie states.

Simple diff that fixes this is,

--- opsgenie.py.orig 2019-12-09 15:50:35.283153678 +1000
+++ opsgenie.py 2019-12-09 15:47:55.242250951 +1000
@@ -75,7 +75,7 @@
ret = {
'result': '',
'name': '',

  •    'changes': '',
    
  •    'changes': {},
       'comment': ''
    
    }
Setup

2019.2.2

Steps to Reproduce Issue

Try to use any OpsGenie state, e.g. create_alert or close_alert

Versions Report

$ salt --versions-report
Salt Version:
Salt: 2019.2.2

Dependency Versions:
cffi: 1.6.0
cherrypy: Not Installed
dateutil: 1.5
docker-py: 1.10.6
gitdb: 0.6.4
gitpython: 1.0.1
ioflo: 1.3.8
Jinja2: 2.7.2
libgit2: 0.26.3
libnacl: 1.6.1
M2Crypto: 0.31.0
Mako: 0.8.1
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: 1.2.5
pycparser: 2.14
pycrypto: 2.6.1
pycryptodome: 3.7.3
pygit2: 0.26.4
Python: 2.7.5 (default, Aug 7 2019, 00:51:29)
python-gnupg: 0.4.3
PyYAML: 3.11
PyZMQ: 15.3.0
RAET: Not Installed
smmap: 0.9.0
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4

System Versions:
dist: centos 7.7.1908 Core
locale: UTF-8
machine: x86_64
release: 3.10.0-957.27.2.el7.x86_64
system: Linux
version: CentOS Linux 7.7.1908 Core

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in opsgenie.py and inspect the return structure used by the create_alert and close_alert states. Reproduce the issue with an OpsGenie state, then verify that a successful API call returns a dictionary for Changes and allows dependent states to use the result reliably.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.