Skip to content

Set force_mod_watch in docker_container.running for lightweight changes - #17

Open
mitar wants to merge 2 commits into
salt-extensions:mainfrom
mitar:docker-container-force-mod-watch
Open

mitar wants to merge 2 commits into
salt-extensions:mainfrom
mitar:docker-container-force-mod-watch

Conversation

@mitar

@mitar mitar commented Sep 21, 2026

Copy link
Copy Markdown

When the normal run produces only lightweight changes (such as a network reconnect) and does not recreate or restart the container, return force_mod_watch: True so the state system still invokes mod_watch for a watched trigger. Previously the watched-state trigger was silently dropped in this case - for example, a watched config-file change would not force-replace the container if docker_container.running happened to also reconnect a network during the same run.

Heavy-change keys (container_id, state, image, forced_update) already indicate the container was recreated or restarted, so mod_watch is not needed in those cases.

The force_mod_watch return key is handled by the state system since saltstack/salt#68960 (currently on Salt's master branch). Older Salt versions do not act on it.

See: saltstack/salt#68958

Merge requirements satisfied?

[NOTICE] Bug fixes or new features require tests.

Commits signed with GPG?

No

When the normal run produces only lightweight changes (such as a network
reconnect) and does not recreate or restart the container, return
`force_mod_watch: True` so the state system still invokes `mod_watch`
for a watched trigger. Previously the watched-state trigger was silently
dropped in this case - for example, a watched config-file change would
not force-replace the container if `docker_container.running` happened
to also reconnect a network during the same run.

Heavy-change keys (`container_id`, `state`, `image`,
`forced_update`) already indicate the container was recreated or
restarted, so `mod_watch` is not needed in those cases.

The `force_mod_watch` return key is handled by the state system since
saltstack/salt#68960 (currently on Salt's master branch). Older Salt
versions do not act on it.

See: saltstack/salt#68958
@codecov

codecov Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 61.33333% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 42.32%. Comparing base (cebd4c0) to head (a17b27c).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
tests/unit/states/test_docker_container.py 50.00% 29 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #17      +/-   ##
==========================================
+ Coverage   42.10%   42.32%   +0.21%     
==========================================
  Files          26       27       +1     
  Lines        6545     6620      +75     
  Branches     1138     1139       +1     
==========================================
+ Hits         2756     2802      +46     
- Misses       3542     3571      +29     
  Partials      247      247              
Flag Coverage Δ
Linux 42.31% <61.33%> (+0.21%) ⬆️
project 37.73% <100.00%> (+0.02%) ⬆️
py310 42.26% <61.33%> (+0.21%) ⬆️
py311 42.26% <61.33%> (+0.21%) ⬆️
py314 42.26% <61.33%> (+0.21%) ⬆️
salt_3006_27 42.26% <61.33%> (+0.21%) ⬆️
salt_3008_2 42.26% <61.33%> (+0.21%) ⬆️
tests 50.68% <60.27%> (+0.30%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant