unarchive, zip and idempotence

70 views
Skip to first unread message

Wawrzek Niewodniczanski

unread,
May 28, 2019, 12:01:02 PM5/28/19
to ansible...@googlegroups.com
Hi,
I have a zip files with 3 jars inside (no directory). When I use
unarchive it always finds diff, even if files already exist.
With simple diff i see:

.f....o..?? bcpkix-jdk15on-1.60.jar
.f....o..?? bcprov-jdk15on-1.60.jar
.f....o..?? doorman.jar

Is that known problem? If not I'll try to prepare a test case for bug report.

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

Dick Visser

unread,
May 28, 2019, 3:29:27 PM5/28/19
to ansible...@googlegroups.com
What does your task:playbook exactly look like?

--
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-vpCyj6jLT1PjRwod3K%2B8cyexa5V64o%3DaPkbbyWB66hhQMQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.

Wawrzek Niewodniczanski

unread,
May 31, 2019, 7:04:59 PM5/31/19
to ansible...@googlegroups.com
On Tue, 28 May 2019 at 20:29, Dick Visser <dick....@geant.org> wrote:
>
> What does your task:playbook exactly look like?

I've played around and the problem is with setting files ownerships. I
created simple example (see below) and attached test.zip example. If
we remove 2 last lines task will be idempotence.

Wawrzek

---
- hosts: localhost,
become: true
tasks:
- name: unarchive
unarchive:
src: /tmp/test.zip
dest: output
mode: 0700
remote_src: true
owner: wawrzek2
group: admin
test.zip

Kai Stian Olstad

unread,
Jun 1, 2019, 9:04:04 AM6/1/19
to ansible...@googlegroups.com
On 01.06.2019 01:04, Wawrzek Niewodniczanski wrote:
> On Tue, 28 May 2019 at 20:29, Dick Visser <dick....@geant.org> wrote:
>>
>> What does your task:playbook exactly look like?
>
> I've played around and the problem is with setting files ownerships. I
> created simple example (see below) and attached test.zip example. If
> we remove 2 last lines task will be idempotence.
>
> Wawrzek
>
> ---
> - hosts: localhost,
> become: true
> tasks:
> - name: unarchive
> unarchive:
> src: /tmp/test.zip
> dest: output
> mode: 0700
> remote_src: true
> owner: wawrzek2
> group: admin

I can confirm this behavior, but it's only the owner that causing problems.

So it's a bug in unarchive when using become and the owner parameter is different from root in Ansible 2.8.0 that I tested on.


--
Kai Stian Olstad

Wawrzek Niewodniczanski

unread,
Jun 1, 2019, 12:52:19 PM6/1/19
to ansible...@googlegroups.com
On Sat, 1 Jun 2019 at 14:03, Kai Stian Olstad
<ansible-pr...@olstad.com> wrote:
>
> On 01.06.2019 01:04, Wawrzek Niewodniczanski wrote:
> > On Tue, 28 May 2019 at 20:29, Dick Visser <dick....@geant.org> wrote:
> >>
> >> What does your task:playbook exactly look like?
> >
> > I've played around and the problem is with setting files ownerships.
[...]

>
> I can confirm this behavior, but it's only the owner that causing problems.
>
> So it's a bug in unarchive when using become and the owner parameter is different from root in Ansible 2.8.0 that I tested on.
>
Thanks Kai,

I'm going to raise a ticket on Github.

Wawrzek

Wawrzek Niewodniczanski

unread,
Jun 4, 2019, 3:07:38 AM6/4/19
to ansible...@googlegroups.com
On Sat, 1 Jun 2019 at 17:51, Wawrzek Niewodniczanski <ma...@wawrzek.name> wrote:
> On Sat, 1 Jun 2019 at 14:03, Kai Stian Olstad
> <ansible-pr...@olstad.com> wrote:
[...]
> > I can confirm this behavior, but it's only the owner that causing problems.
> >
> > So it's a bug in unarchive when using become and the owner parameter is different from root in Ansible 2.8.0 that I tested on.
> I'm going to raise a ticket on Github.

FYI the ticket is https://github.com/ansible/ansible/issues/57303

Wawrzek Niewodniczanski

unread,
Jun 4, 2019, 7:08:27 AM6/4/19
to ansible...@googlegroups.com
Thanks to Kai findings (shared in another thread) I can confirm that
following change to Ansible 2.7.2 fixes the problem:

--- unarchive.py.bak 2019-06-04 11:41:24.000000000 +0100
+++ unarchive.py 2019-06-04 11:46:27.000000000 +0100
@@ -316,7 +316,7 @@
fut_owner = fut_uid = None
if self.file_args['owner']:
try:
- tpw = pwd.getpwname(self.file_args['owner'])
+ tpw = pwd.getpwnam(self.file_args['owner'])
except:
try:
tpw = pwd.getpwuid(self.file_args['owner'])

I'm going to updated the ticket.

Wawrzek Niewodniczanski

unread,
Jun 4, 2019, 7:10:20 AM6/4/19
to ansible...@googlegroups.com
On Tue, 4 Jun 2019 at 12:08, Wawrzek Niewodniczanski <ma...@wawrzek.name> wrote:
>
> following change to Ansible 2.7.2 fixes the problem:

Clarification - it's ansible 2.7.10
Reply all
Reply to author
Forward
0 new messages