JSON Inventory Host LIst isn't accepted anymore when YUM or DNF PKG Mgr is used

17 views
Skip to first unread message

M. Manna

unread,
Jun 16, 2020, 3:46:40 AM6/16/20
to Ansible Project
Hello,

With Regards to Github Ticket - https://github.com/ansible/ansible/issues/70054

I have not reached a successful resolution. Here is the summary of the issue

1) The inventory.py script which is supposed to output JSON data is working fine when Ansible is managed via Pip.
2) The script doesn't work when Ansible package is installed via DNF or YUM.
3) We cannot use pip in produdction as it's not part of our audit system.

According to various comments, it appears that the plugins/helper packages provided with Ansible in DNF/YUM may be corrupted. Pip seems to be providing all the correct items.

I am using Python 3.

Regards,

Luca 'remix_tj' Lorenzetto

unread,
Jun 16, 2020, 3:53:53 AM6/16/20
to ansible...@googlegroups.com
Hello,

the error you're reporting:

[WARNING]: * Failed to parse /******/inventory/inventory.py with
script plugin: failed to parse executable inventory
script results from /********/inventory/inventory.py: Expecting
property name enclosed in double quotes: line 1 column 2
(char 1)

is clear. The inventory.py script returns an invalid json/yaml.

Could you please share Line 1 of the output of

inventory.py --list

?

As stated in the issue, ansible doesn't parse directly json, but yaml,
which is a superset of json.

If your script returns an invalid json/yaml newer ansible version may
not understand it correctly. And you can't expect that since a version
that accidentally understood it, it will accepted forever.

Luca
> --
> 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-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/576cc54a-3821-4a4e-ab94-7203f70162afo%40googlegroups.com.



--
"E' assurdo impiegare gli uomini di intelligenza eccellente per fare
calcoli che potrebbero essere affidati a chiunque se si usassero delle
macchine"
Gottfried Wilhelm von Leibnitz, Filosofo e Matematico (1646-1716)

"Internet è la più grande biblioteca del mondo.
Ma il problema è che i libri sono tutti sparsi sul pavimento"
John Allen Paulos, Matematico (1945-vivente)

Luca 'remix_tj' Lorenzetto, http://www.remixtj.net , <lorenze...@gmail.com>

M. Manna

unread,
Jun 16, 2020, 4:00:39 AM6/16/20
to Ansible Project
Hi,


On Tuesday, 16 June 2020 08:53:53 UTC+1, Luca 'remix_tj' Lorenzetto wrote:
Hello,

the error you're reporting:

[WARNING]:  * Failed to parse /******/inventory/inventory.py with
script plugin: failed to parse executable inventory
script results from /********/inventory/inventory.py: Expecting
property name enclosed in double quotes: line 1 column 2
(char 1)

is clear. The inventory.py script returns an invalid json/yaml.

Could you please share Line 1 of the output of

inventory.py --list

?

 I am not sure if you read my post. The problem isn't with JSON/YAML. When I install Ansible with pip package manager, this works just fine (2.6,2.7,2.8,2.9,latest).
When I install Ansible using DNF or YUM - it doesn't work and outputs that error message. How is it possible that the JSON is invalid in once case, but not both?

As stated in the issue, ansible doesn't parse directly json, but yaml,
which is a superset of json.

If your script returns an invalid json/yaml newer ansible version may
not understand it correctly. And you can't expect that since a version
that accidentally understood it, it will accepted forever.

  Repeating my previous question, how is it possible that versions 2.6,2.7,2.8,2.9 (and latest 2.9.9) all works just fine when installed using pip? I am not sure if anyone is reading my question :)

Luca

On Tue, Jun 16, 2020 at 9:46 AM M. Manna <manm...@gmail.com> wrote:
>
> Hello,
>
> With Regards to Github Ticket - https://github.com/ansible/ansible/issues/70054
>
> I have not reached a successful resolution. Here is the summary of the issue
>
> 1) The inventory.py script which is supposed to output JSON data is working fine when Ansible is managed via Pip.
> 2) The script doesn't work when Ansible package is installed via DNF or YUM.
> 3) We cannot use pip in produdction as it's not part of our audit system.
>
> According to various comments, it appears that the plugins/helper packages provided with Ansible in DNF/YUM may be corrupted. Pip seems to be providing all the correct items.
>
> I am using Python 3.
>
> Regards,
>
> --
> 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...@googlegroups.com.

Abhijeet Kasurde

unread,
Jun 16, 2020, 4:21:23 AM6/16/20
to ansible...@googlegroups.com
Hi,

We understand your concern. But

[WARNING]:  * Failed to parse /******/inventory/inventory.py with
script plugin: failed to parse executable inventory
script results from /********/inventory/inventory.py: Expecting
property name enclosed in double quotes: line 1 column 2
(char 1)

This warning is raising alarm in everyone's mind. If we take a look at the sample excerpt of JSON returned by inventory.py might help in troubleshooting the issue.
Also, could you please provide the operating system used and exact version of Ansible packages so that it will easy for others to reproduce?

To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/8135176c-11eb-4e83-a04e-452c35bc5521o%40googlegroups.com.


--
Thanks,
Abhijeet Kasurde

Luca 'remix_tj' Lorenzetto

unread,
Jun 16, 2020, 4:26:10 AM6/16/20
to ansible...@googlegroups.com
On Tue, Jun 16, 2020 at 10:00 AM M. Manna <manm...@gmail.com> wrote:
>
> Hi,
>
> On Tuesday, 16 June 2020 08:53:53 UTC+1, Luca 'remix_tj' Lorenzetto wrote:
>>
>> Hello,
>>
>> the error you're reporting:
>>
>> [WARNING]: * Failed to parse /******/inventory/inventory.py with
>> script plugin: failed to parse executable inventory
>> script results from /********/inventory/inventory.py: Expecting
>> property name enclosed in double quotes: line 1 column 2
>> (char 1)
>>
>> is clear. The inventory.py script returns an invalid json/yaml.
>>
>> Could you please share Line 1 of the output of
>>
>> inventory.py --list
>>
>> ?
>
>
> I am not sure if you read my post. The problem isn't with JSON/YAML. When I install Ansible with pip package manager, this works just fine (2.6,2.7,2.8,2.9,latest).
> When I install Ansible using DNF or YUM - it doesn't work and outputs that error message. How is it possible that the JSON is invalid in once case, but not both?
>>
>>
>> As stated in the issue, ansible doesn't parse directly json, but yaml,
>> which is a superset of json.
>>
>> If your script returns an invalid json/yaml newer ansible version may
>> not understand it correctly. And you can't expect that since a version
>> that accidentally understood it, it will accepted forever.
>>
> Repeating my previous question, how is it possible that versions 2.6,2.7,2.8,2.9 (and latest 2.9.9) all works just fine when installed using pip? I am not sure if anyone is reading my question :)

ansible isn't an all-in-one product, relies on external libs.

Please check all the libraries used by ansible packaged and by ansible
installed via pip.
Depends also if you're are installing in virtualenv, which installs
all the deps from scratch, or on an OS which already has the required
libraries.

Luca
Reply all
Reply to author
Forward
0 new messages