saltstack / saltstack/salt

states/pkg.py and warnings on module failures.

Open
#45,227 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description of Issue/Question

states/pkg.py seems to pass back warnings, when the warnings come from states/pkg.py itself
Seems it does not support warnings being returned from modules/pkg*

e.g. It looks like it should be

if exc.info:
    if 'warnings' in exc.info # add the module warnings
        ret.setdefault('warnings', []).extend(exc.info.get('warnings'))

Sample code from states/pkg.py

        except CommandExecutionError as exc:
            ret = {'name': name, 'result': False}
            if exc.info:
                # Get information for state return from the exception.
                ret['changes'] = exc.info.get('changes', {})
                ret['comment'] = exc.strerror_without_changes
            else:
                ret['changes'] = {}
                ret['comment'] = ('An error was encountered while installing '
                                  'package(s): {0}'.format(exc))
            if warnings: # add the state warnings
                ret.setdefault('warnings', []).extend(warnings)
            return ret
Version

develop but sure it would have existing in early versions

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 states/pkg.py, especially the CommandExecutionError handler shown in the issue, and trace how warnings from modules/pkg* are placed in the exception info. Done means warnings returned by those modules are included in the state result on package failures, alongside existing state warnings.

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
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.