saltstack / saltstack/salt

[BUG] error KeyError: 'master_list' in sali-minion 3005.1 logs

Open
#64,617 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-more-info needs-triage
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
Soon after minion process is started there is an error in the logs

2023-07-08 12:05:08,966 [salt.minion      :232 ][DEBUG   ][19917] Master URI: tcp://127.0.0.1:4506
2023-07-08 12:05:08,975 [salt.utils.event :315 ][DEBUG   ][19917] SaltEvent PUB socket URI: /var/run/salt/minion/minion_event_e6adef2bc4_pub.ipc
2023-07-08 12:05:08,975 [salt.utils.event :316 ][DEBUG   ][19917] SaltEvent PULL socket URI: /var/run/salt/minion/minion_event_e6adef2bc4_pull.ipc
2023-07-08 12:05:08,976 [salt.utils.event :821 ][DEBUG   ][19917] Sending event: tag = __master_failback; data = {'master': '127.0.0.1', '_stamp': '2023-07-08T12:05:08.976638'}
2023-07-08 12:05:08,977 [salt.transport.ipc:373 ][DEBUG   ][19917] Closing IPCMessageClient instance
2023-07-08 12:05:08,978 [salt.channel.client:313 ][DEBUG   ][19917] Closing AsyncReqChannel instance
2023-07-08 12:05:08,978 [salt.minion      :2690][DEBUG   ][19693] Minion of 'salt-a.domain.' is handling event tag '__master_failback'
2023-07-08 12:05:08,980 [tornado.application:356 ][ERROR   ][19693] Future <salt.ext.tornado.concurrent.Future object at 0x7f2e94f49588> exception was never retrieved: Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/salt/ext/tornado/gen.py", line 309, in wrapper
    yielded = next(result)
  File "/usr/lib/python3/dist-packages/salt/minion.py", line 2748, in handle_event
    if data["master"] != self.opts["master_list"][0]:
KeyError: 'master_list'
2023-07-08 12:05:08,980 [salt.minion      :2690][DEBUG   ][19693] Minion of 'salt-b.domain.' is handling event tag '__master_failback'
2023-07-08 12:05:08,980 [tornado.application:356 ][ERROR   ][19693] Future <salt.ext.tornado.concurrent.Future object at 0x7f2e94f49588> exception was never retrieved: Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/salt/ext/tornado/gen.py", line 309, in wrapper
    yielded = next(result)
  File "/usr/lib/python3/dist-packages/salt/minion.py", line 2748, in handle_event
    if data["master"] != self.opts["master_list"][0]:
KeyError: 'master_list'

Setup
salt-minion config

master:
  - salt-a.domain
  - salt-b.domain.
master_type: str
renderer: yaml_jinja
log_level_logfile: debug
log_level: info

Steps to Reproduce the behavior
Restart salt minion process

Expected behavior
No errors in the log

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
salt-minion --versions-report
Salt Version:
          Salt: 3005.1

Dependency Versions:
          cffi: Not Installed
      cherrypy: Not Installed
      dateutil: 2.6.1
     docker-py: Not Installed
         gitdb: 2.0.3
     gitpython: 2.1.8
        Jinja2: 2.10
       libgit2: 0.26.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 0.5.6
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: Not Installed
      pycrypto: 2.6.1
  pycryptodome: 3.4.7
        pygit2: 0.26.2
        Python: 3.6.9 (default, Oct  8 2020, 12:12:24)
  python-gnupg: 0.4.1
        PyYAML: 3.12
         PyZMQ: 17.1.2
         smmap: 2.0.3
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.2.5

System Versions:
          dist: ubuntu 18.04 Bionic Beaver
        locale: UTF-8
       machine: x86_64
       release: 5.4.0-1035-aws
        system: Linux
       version: Ubuntu 18.04 Bionic Beaver

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 salt/minion.py at handle_event around line 2748, where the __master_failback event accesses master_list. Reproduce by restarting a minion with the multi-master configuration shown, then verify that the restart produces no KeyError or related error in the logs.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.