saltstack / saltstack/salt

test.get_opts fails on minion if minion_sign_messages: True

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

Nobody has claimed this yet.

bug severity-medium
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue

If minion_sign_messages: True is set in the minion, running salt 'minion_id' test.get_opts fails:

2019-12-29 20:57:18,671 [salt.minion      :1482][INFO    ][1844] User sudo_user Executing command test.get_opts with jid 20191229205717044139
2019-12-29 20:57:21,328 [salt.minion      :1151][INFO    ][2680] Creating minion process manager
2019-12-29 20:57:21,404 [salt.minion      :1609][INFO    ][2680] Starting a new job 20191229205717044139 with PID 2680
2019-12-29 20:57:21,467 [salt.minion      :1937][INFO    ][2680] Returning information for job: 20191229205717044139
2019-12-29 20:57:21,467 [salt.utils.process:754 ][ERROR   ][2680] An un-handled exception from the multiprocessing process 'SignalHandlingMultiprocessingProcess-1' was caught:
Traceback (most recent call last):
  File "c:\salt\bin\lib\site-packages\salt\utils\process.py", line 747, in run
    return super(MultiprocessingProcess, self).run()
  File "c:\salt\bin\lib\multiprocessing\process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "c:\salt\bin\lib\site-packages\salt\minion.py", line 1594, in _target
    run_func(minion_instance, opts, data)
  File "c:\salt\bin\lib\site-packages\salt\minion.py", line 1589, in run_func
    return Minion._thread_return(minion_instance, opts, data)
  File "c:\salt\bin\lib\site-packages\salt\minion.py", line 1776, in _thread_return
    timeout=minion_instance._return_retry_timer()
  File "c:\salt\bin\lib\site-packages\salt\minion.py", line 1997, in _return_pub
    ret_val = self._send_req_sync(load, timeout=timeout)
  File "c:\salt\bin\lib\site-packages\salt\minion.py", line 1406, in _send_req_sync
    sig = salt.crypt.sign_message(minion_privkey_path, salt.serializers.msgpack.serialize(load))
  File "c:\salt\bin\lib\site-packages\salt\serializers\msgpack.py", line 65, in _serialize
    raise SerializationError(error)
SerializationError: can't serialize datetime.datetime(2019, 12, 29, 21, 57, 16, 781000)
Setup

Minion's config file:
minion_sign_messages: True

Steps to Reproduce Issue

On master:
salt 'minion_id' test.get_opts

Versions Report

Master:

Salt Version:
           Salt: 2019.2.2
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.5.3
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.9.4
        libgit2: 0.24.5
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: 0.24.2
         Python: 2.7.13 (default, Sep 26 2018, 18:42:22)
   python-gnupg: Not Installed
         PyYAML: 3.12
          PyZMQ: 16.0.2
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.4.3
            ZMQ: 4.2.1
 
System Versions:
           dist: debian 9.11 
         locale: UTF-8
        machine: x86_64
        release: 4.9.0-11-amd64
         system: Linux
        version: debian 9.11

Minion:

Salt Version:
           Salt: 2019.2.2

Dependency Versions:
           cffi: 1.12.2
       cherrypy: 17.4.1
       dateutil: 2.8.0
      docker-py: Not Installed
          gitdb: 2.0.6
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.10.1
        libgit2: Not Installed
        libnacl: 1.6.1
       M2Crypto: Not Installed
           Mako: 1.0.7
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: 2.19
       pycrypto: Not Installed
   pycryptodome: 3.8.1
         pygit2: Not Installed
         Python: 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
   python-gnupg: 0.4.4
         PyYAML: 3.13
          PyZMQ: 18.0.1
           RAET: Not Installed
          smmap: 2.0.5
        timelib: 0.2.4
        Tornado: 4.5.3
            ZMQ: 4.3.1

System Versions:
           dist:
         locale: cp1252
        machine: AMD64
        release: 10
         system: Windows
        version: 10 10.0.17763  Multiprocessor Free

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

Reproduce salt 'minion_id' test.get_opts with minion_sign_messages: True. Start in salt/minion.py at _send_req_sync and follow the call into salt/serializers/msgpack.py _serialize; done means the command completes without the datetime serialization exception and returns the requested options.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops, distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.