Hey Rich ,
Thanks for the suggestion , it seemed to solve that particular problem, but now it basically wants each variable defined in the defaults to be defined again .For some reason it is unable to use the defaults in the rescue block.I do not know why this was triggered because the connection is non existent and does not have a type defined .
Here is how the network connections looks like .
network_connections:
              - name: non_existent
                type: ethernet
                state: down
                persistent_state: absent

This is only happening if I have to check which task failed , if I just use a simple debug msg in the rescue column , it works fine .Would it be okay to just use that, since no other task is in the block ,  a failure would only come from this task .
Currently I'm just using ignore error: yes to ignore the failure of this task
Thanks,
Harsh


On Thu, Apr 30, 2020 at 10:39 PM Rich Megginson <rmeggins@redhat.com> wrote:
On 4/30/20 10:37 AM, Harsh Jain 2K18_CO_140 wrote:
> Hey everyone,
> i was trying to modify the test for downing a non existent profile using
> blocks and rescue ,and I'm getting this error
>   An unhandled exception occurred while templatinga really big JSON object
> which boils down to this
> Unexpected templating type error occurred on ({{ network_connections |
> json_query('[*][ieee802_1x]') | flatten | count > 0 }}): 'NoneType'
> object is not iterable"
> which I guess is due to an emty object being returned ?
> I'm not sure though what exactly this returns or is supposed to return
> and I'm having some trouble finding a way to fix this .
> Could someone please help guide me in the right direction ?

Seems like a bug, but hard to say without knowing what your input
`network_connections` looks like.

Does it work if you make this change?

diff --git a/defaults/main.yml b/defaults/main.yml
index 6b15964..d3977cb 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -22,7 +22,7 @@ network_provider: "{{ network_provider_current }}"

  # wpa_supplicant is required if any ieee802_1x connections are defined
  wpa_supplicant_required: "{{ network_connections |
-      json_query('[*][ieee802_1x]') | flatten | count > 0 }}"
+      selectattr('ieee802_1x', 'defined') | list | count > 0 }}"
  _network_packages_default_802_1x: ["{% if wpa_supplicant_required
        %}wpa_supplicant{% endif %}"]


> Any help is appreciated
> Thanks,
> Harsh
>
> _______________________________________________
> systemroles mailing list -- systemroles@lists.fedorahosted.org
> To unsubscribe send an email to systemroles-leave@lists.fedorahosted.org
> Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives: https://lists.fedorahosted.org/archives/list/systemroles@lists.fedorahosted.org
>
_______________________________________________
systemroles mailing list -- systemroles@lists.fedorahosted.org
To unsubscribe send an email to systemroles-leave@lists.fedorahosted.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedorahosted.org/archives/list/systemroles@lists.fedorahosted.org