saltstack / saltstack/salt

salt.modules.keyboard function get_sys traceback when cmd.run fails

Open
#56,071 1 comment 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

File "/usr/lib/python3/dist-packages/salt/modules/keyboard.py", line 50, in get_sys
ret = out[1].replace('"', '')
IndexError: list index out of range

Setup (sls):
set /etc/default/keyboard:
  keyboard.system:
    - name: de

As in https://docs.saltstack.com/en/develop/ref/modules/all/salt.modules.keyboard.html

Steps to Reproduce Issue

If the internal cmd.run for get_sys does not work (logged out = 'Could not get properties: Connection timed out') the traceback appears!

salt --versions-report

Salt Version:
Salt: 2019.2.2

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: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 3.6.9 (default, Nov 7 2019, 10:44:02)
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: ANSI_X3.4-1968
machine: x86_64
release: 4.15.0-64-generic
system: Linux
version: Ubuntu 18.04 bionic

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 with /usr/lib/python3/dist-packages/salt/modules/keyboard.py, especially get_sys around line 50, and reproduce the issue using the keyboard.system state described in the report. Inspect how get_sys handles the internal cmd.run result when it reports a timeout. Done means that failure no longer produces an IndexError traceback and is handled consistently with the module's existing behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.