saltstack / saltstack/salt

[TECH DEBT] Audit client.cmd calls to see if we're appropriately handling error conditions

Open
#61,568 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

See https://github.com/saltstack/salt/pull/61567 for an example of what happens when we aren't.

$ ag -Q 'client.cmd(' salt
salt/netapi/__init__.py:170:            return client.cmd(*args, **kwargs)
salt/utils/master.py:242:            return client.cmd(
salt/runners/salt.py:153:            return client.cmd(
salt/runners/jobs.py:56:            active_ = client.cmd("*", "saltutil.running", timeout=__opts__["timeout"])
salt/runners/survey.py:160:            minions = client.cmd(
salt/runners/lxc.py:246:            if client.cmd(host, "test.ping", timeout=20).get(host, None):
salt/runners/lxc.py:285:                            if client.cmd(name, "test.ping", timeout=20).get(
salt/runners/lxc.py:310:                kw = client.cmd(
salt/runners/lxc.py:390:                ping = client.cmd(mid_, "test.ping", timeout=20)
salt/runners/virt.py:536:            client.cmd(target, "virt.seed_non_shared_migrate", [disks, True])
salt/runners/manage.py:127:        client.cmd("*", "saltutil.regen_keys")
salt/runners/manage.py:526:    ret = ssh_client.cmd(target, "key.finger", tgt_type=tgt_type)
salt/runners/manage.py:581:        minions = client.cmd("*", "test.version", full_return=True, timeout=__opts__["timeout"])
salt/runners/ssh.py:25:    return client.cmd(tgt, fun, arg, timeout, tgt_type, kwarg)
salt/cloud/__init__.py:1250:                        ret = client.cmd(
salt/cloud/__init__.py:1275:                action_out = client.cmd(
salt/cloud/__init__.py:2242:                            client.cmd(
salt/cloud/libcloudfuncs.py:288:            minions = client.cmd(name, "mine.flush")
salt/modules/saltutil.py:1762:    return rclient.cmd(
salt/modules/saltutil.py:1836:        ret = wheel_client.cmd(

This is a list of all the places that we're calling client.cmd within Salt. If we're not passing full_return=True then we're just getting whatever shows up on the command line with no return code, so we don't know if Salt is reporting an error or not. It would be a great idea for us to check these places and ensure that that's desirable behavior or not.

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 the listed client.cmd call sites, especially salt/netapi/init.py, salt/utils/master.py, salt/runners/, salt/cloud/, and salt/modules/saltutil.py. Compare each call with the behavior shown in pull request 61567 and determine whether full_return=True or another error check is appropriate. Done means every listed call has a deliberate, reviewed error-handling decision.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 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.