You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
salt-call -l info --local saltutil.sync_all
salt-call -l info --local state.apply test
Output:
----------
ID: /tmp/trash_dir
Function: file.directory
Result: False
Comment: One or more requisite failed: test./tmp/trash_dir/trash_file
Started: ...
Duration: 4ms
Changes:
----------
ID: /tmp/trash_dir/trash_file
Function: custom_state.wrap
Result: False
Comment: Parent directory not present
Changes:
Summary for local
------------
Failed: 2
------------
Expected behavior
"/tmp/trash_dir" and "/tmp/trash_dir/trash_file" should be created; the "/tmp/trash_dir/trash_file" state should be detected as needing changes and the required state which has the prereq "/tmp/trash_dir" should be created. The __opts__['test'] variable should be set to True in the states["file.managed"] state call from the custom_state.wrap state so that the prereq condition behaves correctly.
Versions Report
salt-call --versions-report
Salt Version:
Salt: 3004.1Dependency Versions:
Jinja2: 2.11.1Python: 3.6.8 (default, Aug 13 2020, 07:46:32)PyYAML: 3.13System Versions:
dist: rhel 7.9 Maipolocale: UTF-8release: 3.10.0-1160.15.2.el7.x86_64system: Linux
The text was updated successfully, but these errors were encountered:
Description
When cross calling a state module from custom state module as documented here https://docs.saltproject.io/en/latest/ref/states/writing.html#cross-calling-state-modules, if the custom module is set as target of a prereq the opts["test"] value is not correctly also set on the cross called state.
Setup
ec2 instance running rhel 7.9
classic packaging (yum install salt-minion)
create a minimum custom state to cross call another state /srv/salt/_states/custom_state.py:
create
/srv/salt/test.sls
:Steps to Reproduce the behavior
salt-call -l info --local saltutil.sync_all salt-call -l info --local state.apply test
Output:
Expected behavior
"/tmp/trash_dir" and "/tmp/trash_dir/trash_file" should be created; the "/tmp/trash_dir/trash_file" state should be detected as needing changes and the required state which has the prereq "/tmp/trash_dir" should be created. The
__opts__['test']
variable should be set to True in the states["file.managed"] state call from the custom_state.wrap state so that the prereq condition behaves correctly.Versions Report
salt-call --versions-report
The text was updated successfully, but these errors were encountered: