Construct variable from another variables
Open
Nobody has claimed this yet.
documentation
needs-triage
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
{% load_yaml as yaml %}
test:
dev: 'xxxxx'
test_2:
dev: 'yyyyy'
{% endload %}
{% set proj = slspath.split('/')[0] %}
{% set env = slspath.split('/')[1] %}
{% set service = slspath.split('/')[2] %}
{% set a = yaml ~ '.' ~ proj ~ '.' ~ env %}
test:
cmd.run:
- name: echo {{ a }}
Output:
test:
cmd.run:
- name: echo {'test': {'dev': 'xxxxx'}, 'test_2': {'dev': 'yyyyy'}}.test.dev <======================
Is it possible to access test yaml from dynamically created variable?
As I really want to return yaml.test.dev value no entire yaml + test.dev...
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
No source file, test, or entry point is identified. Start by reproducing the provided Salt template and inspecting how the dynamically assembled value is evaluated; done means a dynamic reference returns the nested yaml.test.dev value rather than the full mapping followed by a string path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, yaml
- Domain
- devops, infrastructure
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100