Hi sebastian,
pulp.results.0.stdout give me output "\e[0m"

But when I try to access in failed_when condition
It is giving me below error.
fatal: [node]: FAILED! =>

  msg: 'The conditional check ''pulp.results.0.stdout == "\e[0m"'' failed.
The error was: error while evaluating conditional (pulp.results.0.stdout ==
"\e[0m"): ''dict object'' has no attribute ''results'''

Looks like in faiked_when condition it needs dictionary?




On Wed, 3 Apr 2019, 20:18 Kunalsing Thakur <bits.kunals...@gmail.com wrote:

> when i print the pulp.results.0.stdout it will give me following output:-
> TASK [mobi_ansible_role_pulp : debug]
> ****************************************************************************
> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:9
> Wednesday 03 April 2019  14:46:40 +0000 (0:00:02.206)       0:00:09.036
> *******
> ok: [inplp01p2.infra.smf1.mobitv] =>
>   pulp.results.0.stdout: "\e[0m"
> which is blank so i want to failed this task?
>
>
> On Wednesday, April 3, 2019 at 8:14:31 PM UTC+5:30, Kunalsing Thakur wrote:
>>
>> Hi sebastian,
>> when i try to fail the task with this below condition i get the error in
>> task
>>
>> *failed_when: pulp.results.0.stdout == "\e[0m"*
>>
>> TASK [mobi_ansible_role_pulp : searching the rpm into pulp repo]
>> *************************************************
>> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:4
>> Wednesday 03 April 2019  14:40:58 +0000 (0:00:01.856)       0:00:06.231
>> *******
>> fatal: [inplp01p2.infra.smf1.mobitv]: FAILED! =>
>>   msg: 'The conditional check ''pulp.results.0.stdout == "\e[0m"''
>> failed. The error was: error while evaluating conditional
>> (pulp.results.0.stdout == "\e[0m"): ''dict object'' has no attribute
>> ''results'''
>>
>>
>> On Wednesday, April 3, 2019 at 8:01:59 PM UTC+5:30, Sebastian Meyer wrote:
>>>
>>> On 03.04.19 16:22, Kunalsing Thakur wrote:
>>> > ---
>>> > - name: Logging into pulp
>>> >   shell: pulp-admin login -u admin -p admin
>>> > - name: searching the rpm into pulp repo
>>> >   shell: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots
>>> --match
>>> > 'filename={{ item }}'
>>> >   with_items: "{{ rpmname | default([]) }}"
>>> >   register: pulp
>>> >   when: rpmsearch is defined
>>>
>>> You are using register with a loop. That means pulp.results is a list
>>> and there's an element for each item in that list.
>>>
>>> You can access the stdout for the first item with pulp.results.0.stdout
>>>
>>> Sebastian
>>> --
>>> Sebastian Meyer
>>> Linux Consultant & Trainer
>>> Mail: me...@b1-systems.de
>>>
>>> B1 Systems GmbH
>>> Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
>>> GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/0012f2e5-b6b2-4b49-9e19-1d698605c598%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/0012f2e5-b6b2-4b49-9e19-1d698605c598%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CANErU6%3Dn2Yr1kER48QZFY%2Bao1ihGNNQVv0Y92pw_9pDzSzDTNA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to