Hello all, I am a noob in using Jinja trying to quickly adapt an existing template, so please bear with me. :-)
Namely, the template is supposed to do the following: 1. for each *ci* item (taken from a result in JSON format) which have a *name* defined and which is *not none* 2. set certain custom fields based on certain parameters 3. convert to JSON The template is below: {% *for ci* in netboxResult.json.results if *ci.name* is defined and *ci.name* is not none -%} { "index": { "_index": "{{ item.index }}", "_id": "{{ ci.name }}", "_type": "document" } } {# Formatting IP addresses #} {% if ci.custom_fields.ipAddresses is defined and ci.custom_fields.ipAddresses is not none %}{% set ips = ci.custom_fields.ipAddresses.split(',') %}{% elif ci.custom_fields.vmIpAddresses is defined and ci.custom_fields.vmIpAddresses is not none %}{% set ips = ci.custom_fields.vmIpAddresses.split(',') %}{% else %}{% set ips = [] %}{% endif %} {% if ci.custom_fields.environment is defined %} { "status": {{ ci.status.label | to_json }}, "environment": {{ ci.custom_fields.environment.label | default(None) | to_json }} } {% elif ci.custom_fields.vmEnvironment is defined %} { "status": {{ ci.status.label | to_json }}, "environment": {{ ci.custom_fields.vmEnvironment.label | default(None) | to_json }} } {% endif %} {% endfor %} What I'd like to do is introduce *additional conditions* for the CI name - they should not contain the following strings: PDU, shelf, 009, OPTIC, FUSION, PatchPanel. I've tried a few simple tricks, like adding under "*% for ci*" a few more conditions for the name - but for some reason it didn't change anything. The output remained the same. I am a bit confused with the ending of the FOR with "*-%}*". If someone can help me get me on my way, it would be amazing! Thanks in advance! Regards, Igor -- You received this message because you are subscribed to the Google Groups "pocoo-libs" group. To unsubscribe from this group and stop receiving emails from it, send an email to pocoo-libs+unsubscr...@googlegroups.com. To post to this group, send email to pocoo-libs@googlegroups.com. Visit this group at https://groups.google.com/group/pocoo-libs. For more options, visit https://groups.google.com/d/optout.