Hi - I’m doing something which seems very simple - trying to create a file from a jinja template.
Here are my vars:
export_root:
host: “81.187.209.128/27”
options: “rw,fsid=0,insecure,no_subtree_check,async”
exports:
video:
host: “81.187.209.128/27”
options: “rw,nohide,insecure,no_subtree_check,async”
shared_dir: “/mnt/video”
Here is the template which I’m using the test var fred:
{{export_root_dir}} {{export_root.host}}({{export_root.options}})
{% for fred in exports %}
{{ fred }}
{{ fred.options }}
{% endfor %}
For some reason, fred.options fails with:
fatal: [althea.home.stanandliz.net] => {‘msg’: “One or more undefined variables: ‘str object’ has no attribute ‘options’”, ‘failed’: True}
fatal: [althea.home.stanandliz.net] => {‘msg’: “One or more undefined variables: ‘str object’ has no attribute ‘options’”, ‘failed’: True}
I have no idea why this should be the case. When I access fred, the template prints fine. It’s when I try to access the dictionary in fred that I fail.
I’m sure there is a very simple fix to this, but after about an hour, I just can’t get this to work. Can I have a few debugging clues?
many thanks in advance
Stephen