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

Slack engine salt-run commands return exceptions #52400

Closed
olipovch opened this issue Apr 3, 2019 · 7 comments · Fixed by #63005
Closed

Slack engine salt-run commands return exceptions #52400

olipovch opened this issue Apr 3, 2019 · 7 comments · Fixed by #63005
Assignees
Labels
Bug broken, incorrect, or confusing behavior Confirmed Salt engineer has confirmed bug/feature - often including a MCVE P3 Priority 3 severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around slack All salt stuff for slack Sulfur v3006.0 release code name and version

Comments

@olipovch
Copy link
Contributor

olipovch commented Apr 3, 2019

Description of Issue/Question

salt.run commands return errors when run from Slack with the Slack Engine enabled on the master.

Discovered this when reviewing a related issue: #39783.

Setup

/etc/salt/master.d/engines.conf:

engines:
  - slack:
      token: 'xoxb-####'
      control: True
      fire_all: False
      groups:
        default:
          users:
            - '*'
          commands:
            - '*'
          default_target:
            target: localhost
            tgt_type: glob

/srv/salt/orch/get-os.sls:

get-os:
  salt.function:
    - name: grains.get
    - tgt: '*'
    - arg: 
      - os

Steps to Reproduce Issue

Attempt to run a runner function from Slack after configuring a bot:

!state.orchestrate orch.get-os

job `['state.orchestrate', 'orch.get-os']` (id: 20190402225400193489) (target: {'target': 'localhost', 'tgt_type': 'glob'}) returned

meanmachine_master:
    ----------
    fun:
        runner.state.orchestrate
    jid:
        20190402225400193489
    return:
        Exception occurred in runner state.orchestrate: Traceback (most recent call last):
          File "/usr/local/lib/python3.6/dist-packages/salt/client/mixins.py", line 364, in low
            expected_extra_kws=CLIENT_INTERNAL_KEYWORDS
          File "/usr/local/lib/python3.6/dist-packages/salt/utils/args.py", line 455, in format_call
            used_args_count
        salt.exceptions.SaltInvocationError: orchestrate takes at least 1 argument (0 given)
    success:
        False
    user:
        UNKNOWN
!jobs.active

job `['jobs.active']` (id: 20190402230245886369) (target: {'target': 'localhost', 'tgt_type': 'glob'}) returned

meanmachine_master:
    ----------
    fun:
        runner.jobs.active
    jid:
        20190402230245886369
    return:
        Exception occurred in runner jobs.active: Traceback (most recent call last):
          File "/usr/local/lib/python3.6/dist-packages/salt/client/mixins.py", line 364, in low
            expected_extra_kws=CLIENT_INTERNAL_KEYWORDS
          File "/usr/local/lib/python3.6/dist-packages/salt/utils/args.py", line 505, in format_call
            raise SaltInvocationError(msg)
        salt.exceptions.SaltInvocationError: 'args' and 'kwargs' are invalid keyword arguments for 'salt.loaded.int.runners.jobs.active'
    success:
        False
    user:
        UNKNOWN

Versions Report

Salt Version:
           Salt: 2019.2.0
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.6.1
      docker-py: Not Installed
          gitdb: 2.0.3
      gitpython: 2.1.8
          ioflo: Not Installed
         Jinja2: 2.10
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: 1.0.7
   msgpack-pure: Not Installed
 msgpack-python: 0.6.1
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 3.6.7 (default, Oct 22 2018, 11:32:17)
   python-gnupg: 0.4.1
         PyYAML: 3.12
          PyZMQ: 16.0.2
           RAET: Not Installed
          smmap: 2.0.3
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.2.5
 
System Versions:
           dist: Ubuntu 18.04 bionic
         locale: UTF-8
        machine: x86_64
        release: 4.19.11-041911-generic
         system: Linux
        version: Ubuntu 18.04 bionic
@cmcmarrow cmcmarrow self-assigned this Apr 5, 2019
@Ch3LL
Copy link
Contributor

Ch3LL commented Apr 8, 2019

looks like we need to fix this up. Thanks @olipovch

Do you know if this was occurring in previous salt versions as well?

@Ch3LL Ch3LL added Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around P3 Priority 3 labels Apr 8, 2019
@Ch3LL Ch3LL added this to the Approved milestone Apr 8, 2019
@jonesie3419
Copy link

I can confirm that I see the same issue in 2019.2.0 and it is not present in 2018.3.4:

Salt Slack.Engine: (This is the constant between both versions)

    engines:
      - slack:
          trigger: "test!"
          token: 'xoxb-xxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxx'
          control: True
          fire_all: False
          groups:
            default:
              users:
                - rob.jones
              commands:
                - help
                - show_updates
              aliases:
                show_updates:
                  type: runner
                  cmd: aqstack.show_updates
                help:
                  type: runner
                  cmd: aqstack.test_help
              default_target:
                target: saltmaster01.test.aquto.internal
                tgt_type: glob

2019.2.0 - Salt Version

Salt Version:
           Salt: 2019.2.0

Dependency Versions:
           cffi: 1.12.3
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: 0.26.6
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: 2.19
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: 0.26.4
         Python: 2.7.5 (default, Apr  9 2019, 14:30:50)
   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: centos 7.6.1810 Core
         locale: UTF-8
        machine: x86_64
        release: 3.10.0-862.2.3.el7.x86_64
         system: Linux
        version: CentOS Linux 7.6.1810 Core

2019.2.0 - Slack Output

test!help

salt APP [4:28 PM]
@rob.jones's job is submitted as salt jid 20190425202829608155
@rob.jones's job `[u'aqstack.test_help']` (id: 20190425202829608155) (target: {u'tgt_type': u'pillar', u'target': u'saltmaster01.test.aquto.internal'}) returned
salt-results-20190425202832183140 
saltmaster01.test.aquto.internal_master:
  ----------
  fun:
    runner.aqstack.test_help
  jid:
    20190425202829608155
  return:
    Exception occurred in runner aqstack.test_help: Traceback (most recent call last):
     File "/usr/lib/python2.7/site-packages/salt/client/mixins.py", line 364, in low
      expected_extra_kws=CLIENT_INTERNAL_KEYWORDS
     File "/usr/lib/python2.7/site-packages/salt/utils/args.py", line 505, in format_call
      raise SaltInvocationError(msg)
    SaltInvocationError: 'args' and 'kwargs' are invalid keyword arguments for 'salt.loaded.ext.runners.aqstack.test_help'
  success:
    False
  user:
    UNKNOWN

2018.3.4 - Salt Version

Salt Version:
           Salt: 2018.3.4

Dependency Versions:
           cffi: 1.12.3
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: 0.26.6
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: 2.19
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: 0.26.4
         Python: 2.7.5 (default, Apr  9 2019, 14:30:50)
   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: centos 7.6.1810 Core
         locale: UTF-8
        machine: x86_64
        release: 3.10.0-862.2.3.el7.x86_64
         system: Linux
        version: CentOS Linux 7.6.1810 Core

2018.3.4 - Slack Output

test!help

salt APP [4:48 PM]
@rob.jones's job is submitted as salt jid 20190425204822315024

salt APP [4:48 PM]
Printing a list of available commands for: test
- help
- show_updates

@cmcmarrow cmcmarrow removed their assignment Jun 6, 2019
@stale
Copy link

stale bot commented Jan 8, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

@stale stale bot added the stale label Jan 8, 2020
@waynew waynew added the Confirmed Salt engineer has confirmed bug/feature - often including a MCVE label Jan 8, 2020
@stale
Copy link

stale bot commented Jan 8, 2020

Thank you for updating this issue. It is no longer marked as stale.

@stale stale bot removed the stale label Jan 8, 2020
@sdklein
Copy link

sdklein commented Feb 21, 2020

Confirmed same issue on 3000.

@sdklein
Copy link

sdklein commented Feb 21, 2020

Looks like the methods are now being invoked with args and kwargs parameters as of 2019.

Simple solution is to update the methods to pass them.

Old:
def test_help():

New
def test_help(*args, **kwargs):

@ndobbs
Copy link

ndobbs commented Feb 23, 2020

I'm running into this issue as well - just setup slack engine.

           Salt: 3000

Dependency Versions:
           cffi: 1.6.0
       cherrypy: unknown
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: 0.6.4
      gitpython: 1.0.1
         Jinja2: 2.7.2
        libgit2: Not Installed
       M2Crypto: 0.31.0
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.6.2
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.5 (default, Aug  7 2019, 00:51:29)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.3.0
          smmap: 0.9.0
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.1.4

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

Error output:

   ----------
    fun:
        runner.state.orchestrate
    jid:
        20200223003037632667
    return:
        Exception occurred in runner state.orchestrate: Traceback (most recent call last):
          File "/usr/lib/python2.7/site-packages/salt/client/mixins.py", line 361, in low
            expected_extra_kws=CLIENT_INTERNAL_KEYWORDS
          File "/usr/lib/python2.7/site-packages/salt/utils/args.py", line 461, in format_call
            used_args_count
        SaltInvocationError: orchestrate takes at least 1 argument (0 given)
    success:
        False
    user:
        UNKNOWN
Collapse

@sagetherage sagetherage removed the P3 Priority 3 label Jun 3, 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 added the P3 Priority 3 label May 27, 2021
@sagetherage sagetherage modified the milestones: Silicon, Approved Aug 11, 2021
@garethgreenaway garethgreenaway added Phosphorus v3005.0 Release code name and version and removed Silicon v3004.0 Release code name labels Sep 16, 2021
@Ch3LL Ch3LL added Sulfur v3006.0 release code name and version and removed Phosphorus v3005.0 Release code name and version labels Oct 25, 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 Confirmed Salt engineer has confirmed bug/feature - often including a MCVE P3 Priority 3 severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around slack All salt stuff for slack Sulfur v3006.0 release code name and version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants