[BUG] pyobjects renderer fails with Sls require
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
Using the pyobjects renderer, specifying a require requisite argument on Sls require=Sls("requirement") gives an error
[CRITICAL] Rendering SLS test failed, render error: name 'Sls' is not defined
...
NameError: name 'Sls is not defined
The equivalent to specify a requirement on a full sls in jinja|yaml which works is
include:
- requirement
"/testfile":
file.managed:
- owner: "root"
- group: "root"
- require:
- sls: "requirement"
Setup
-
ec2 instance running rhel 7.9
-
classic packaging (yum install salt-minion)
-
Create
/srv/salt/test.sls:#!pyobjects include("requirement") File.managed("/testfile", owner="root", group="root", require=Sls("requirement")) -
[] Create
/srv/salt/requirement.sls:#!pyobjects File.managed("/requirement", owner="root", group="root")
Steps to Reproduce the behavior
salt-call --local state.apply test
Expected behavior
Expected to create a require requisite on the full sls requirement file.
Versions Report
salt-call --versions-report
Salt Version:
Salt: 3004.1
System Versions:
dist: rhel 7.9 Maipo
locale: UTF-8
release: 3.10.0-1160.15.2.el7.x86_64
system: Linux
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with salt-call --local state.apply test using /srv/salt/test.sls and /srv/salt/requirement.sls. Trace how the pyobjects renderer resolves the Sls requisite and compare it with the working jinja|yaml form. Done means the pyobjects example creates the requisite without a NameError and existing renderer tests still pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100