How to debug Ansible modules

16 views
Skip to first unread message

Wawrzek Niewodniczanski

unread,
Jun 4, 2019, 3:05:38 AM6/4/19
to ansible...@googlegroups.com
Hi,

I'm looking to peek into an Ansible module. It is the 'unarchvie'
module which in special circumstances is not idempotent
(https://github.com/ansible/ansible/issues/57303). I read the code. It
looks sensible to me. Now, I would like to check how it actually works
with some data.

Thanks,
Wawrzek

--
Dr Wawrzyniec Niewodniczański or Wawrzek for short
PhD in Quantum Chemistry & MSc in Molecular Engineering
WWW: http://wawrzek.name E-MAIL: jo...@wawrzek.name
Linux User #177124

Pshem Kowalczyk

unread,
Jun 4, 2019, 4:14:42 AM6/4/19
to Ansible Project

--
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 post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAC7-vpADhzTBtHDzna1WxLcnQ85qY3KU%3DREHUJaCLrRMeE3tTA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Kai Stian Olstad

unread,
Jun 4, 2019, 5:34:59 AM6/4/19
to ansible...@googlegroups.com
On 04.06.2019 09:05, Wawrzek Niewodniczanski wrote:
> Hi,
>
> I'm looking to peek into an Ansible module. It is the 'unarchvie'
> module which in special circumstances is not idempotent
> (https://github.com/ansible/ansible/issues/57303). I read the code. It
> looks sensible to me. Now, I would like to check how it actually works
> with some data.

The unarchive has some nice debug option but they are commented out on
line 436[1], 590[2] and 870[3].
And with the callback plugin debug you get some nice output, and you can
always add more "err +=" to get more output.

I might have spotted the bug in finding the debug line numbers, this PR
43479[4] in line 317
pwname has become pwnam


[1]
https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/files/unarchive.py#L436
[2]
https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/files/unarchive.py#L590
[3]
https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/files/unarchive.py#L870
[4]
https://github.com/ansible/ansible/pull/43479/files#diff-5947943aa1aba46541842caf34f526aeR317


--
Kai Stian Olstad

Kai Stian Olstad

unread,
Jun 4, 2019, 5:47:25 AM6/4/19
to ansible...@googlegroups.com
On 04.06.2019 11:34, Kai Stian Olstad wrote:
> I might have spotted the bug in finding the debug line numbers, this
> PR 43479[4] in line 317
> pwname has become pwnam

It's not it's called pwname
https://docs.python.org/2/library/pwd.html#pwd.getpwnam


--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages