Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error passing Pillar data to slack engine #55774

Open
neeleshg opened this issue Jan 2, 2020 · 0 comments
Open

Error passing Pillar data to slack engine #55774

neeleshg opened this issue Jan 2, 2020 · 0 comments
Labels
Bug broken, incorrect, or confusing behavior Pillar slack All salt stuff for slack
Projects
Milestone

Comments

@neeleshg
Copy link

neeleshg commented Jan 2, 2020

Description of Issue

Unable to pass Pillar data to !state.apply command.
For eg. ! state.apply pillar=‘{“editPackage”: “vim”}’ target=*
It throws error in salt master log.
It is similar like #39783

Setup

/etc/salt/master:

file_roots:
  base:
    - /opt/salt/base
pillar_roots:
  base:
    - /opt/pillar/base
log_file: /var/log/salt/master
log_level: debug
engines_dirs:
  - /opt/engines

engines:
  - slack:
      token: 'TOKEN VALUE'
      control: True
      fire_all: false
      groups_pillar_name: 'slack_engine:groups_pillar'
      groups:
        default:
          users:
            - '*'
          commands:
            - test.ping
            - state.apply 
            - grains.ls
            - cmd.run
            - list_jobs
            - list_commands
          aliases:
            list_jobs:
              cmd: jobs.list_jobs
            list_commands:
              cmd: 'pillar.get salt:engines:slack:valid_commands target=* tgt_type=glob'
            ping_all:
              cmd: test.ping target='*'
          default_target:
            target: <MASTER MINION ID>
            tgt_type: list

/opt/salt/base/top.sls:

base:
  '*':
    - package

/opt/salt/base/package.sls:

editpackage:
  pkg.installed:
    - name: {{ pillar['editPackage']  }}

Steps to Reproduce Issue

Command executed in slackbot:

! state.apply pillar=‘{“editPackage”: “vim”}’ target=*

It shows cmdline in master log:

u'cmdline': [u'state.apply', u'pillar=\u2018{\u201ceditPackage\u201d:', u'\u201cvim\u201d}\u2019']

and throw below errors in /var/log/salt/master:

[CRITICAL][30693] Engine 'slack' could not be started!
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/salt/engines/__init__.py", line 132, in run
    self.engine[self.fun](**kwargs)
  File "/opt/engines/slack.py", line 849, in start
    raise Exception('{}'.format(traceback.format_exc()))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 671: ordinal not in range(128)

Versions Report

[root@ip-172-31-13-97 ~]# salt --versions-report
Salt Version:
           Salt: 2019.2.2
 
Dependency Versions:
           cffi: 1.6.0
       cherrypy: unknown
       dateutil: 2.6.0
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: 0.31.0
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.16 (default, Sep 13 2019, 20:28:21)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.3.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4
 
System Versions:
           dist:   
         locale: UTF-8
        machine: x86_64
        release: 4.14.152-127.182.amzn2.x86_64
         system: Linux
        version: Not Installed
@sagetherage sagetherage added Bug broken, incorrect, or confusing behavior Pillar team-core v2019.2.2 unsupported version labels Jan 9, 2020
@Ch3LL Ch3LL added this to the Approved milestone Jan 13, 2020
@sagetherage sagetherage added this to Planning in Sodium Jan 24, 2020
@sagetherage sagetherage removed the v2019.2.2 unsupported version label Apr 24, 2020
@sagetherage sagetherage removed this from Planning in Sodium May 8, 2020
@sagetherage sagetherage added the slack All salt stuff for slack label May 7, 2021
@sagetherage sagetherage modified the milestones: Approved, Silicon May 7, 2021
@sagetherage sagetherage added the Silicon v3004.0 Release code name label May 7, 2021
@sagetherage sagetherage removed the Silicon v3004.0 Release code name label Aug 12, 2021
@sagetherage sagetherage modified the milestones: Silicon, Approved Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Pillar slack All salt stuff for slack
Projects
No open projects
Magnesium
  
Awaiting triage
Development

No branches or pull requests

5 participants