[BUG] salt/modules/network.py: def connect() not return ret['retcode'] #57783
Labels
Bug
broken, incorrect, or confusing behavior
severity-medium
3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone
Description
A clear and concise description of what the bug is.
Related code inside develop branch
https://github.com/saltstack/salt/blob/develop/salt/modules/network.py#L1385
salt/modules/network.py: def connect() does not return ret['retcode']. This causes
salt/states/module.py: def _get_result() to return True when the ret['result'] is False.
https://github.com/saltstack/salt/blob/develop/salt/states/module.py#L650
In the following case, the changes_ret inside salt/states/module.py: def _get_result() is not doing much as the changes was still just been initialized in salt/states/module.py: def run() at
https://github.com/saltstack/salt/blob/develop/salt/states/module.py#L423
Proposed solution option #1:
Don't change salt/states/module.py. Ensure those status checking modules (like network.py: def connect()) return dictionary include ret['retcode'] value
Proposed solution option #2:
Update salt/states/module.py: def _get_result() to handle module return dictionary with ret['result': True/False, 'comment': 'text string']
Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info).
single salt master host with salt-master and salt-minion service up running
Steps to Reproduce the behavior
(Include debug logs if possible and relevant)
Expected behavior
A clear and concise description of what you expected to happen.
Expect the state summary to have Failed: 1
Screenshots
If applicable, add screenshots to help explain your problem.
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Based on the code base, this should exist from 2017 ~ 3001
Additional context
Add any other context about the problem here.
Related unit test: https://github.com/saltstack/salt/blob/develop/tests/unit/modules/test_network.py#L245
few lines in this section could be changed to something like
The text was updated successfully, but these errors were encountered: