Bug in archive.extracted?

46 views
Skip to first unread message

fxp

unread,
Dec 16, 2016, 4:30:40 PM12/16/16
to Salt-users
Salt version -
salt 2016.11.0 (Carbon)


State file: java/init.sls


### ---- JAVA ---- ###

Deploy_Oracle_java:
  archive.extracted:
    - name: /usr/lib/jvm/
    - source: salt://java/files/jdk-8u112-linux-x64.tar.gz
    - user: root                                                                         
    - options: zxf


Run -

  salt 'hosta' state.apply java
hosta:
----------
          ID: Deploy_Oracle_java
    Function: archive.extracted
        Name: /usr/lib/jvm/
      Result: False
     Comment: User root does not exist
     Started: 16:16:19.186195
    Duration: 3.708 ms
     Changes:  

Summary for hosta
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1
Total run time:   3.708 ms
ERROR: Minions returned with non-zero exit code


I want to set and enforce the ownership of extracted files to root. If someone changes ownership I want it to reset back to root.
Removing " - user: root" line makes it work without issue if I add "--no-same-owner" to options because by default root extracting tar files preserves file ownerships. Adding --no-same-owner makes it now root owned. However, if I change the ownership to some other id, next run of salt does not detect this is not owned by root anymore and does not fix it.
enforce_ownership_on also doesn't work if I add it with  - user: root.

Is this a bug? or something else I'm missing? What would proper syntax be for extracting java files as root owned and enforcing it?

fxp

unread,
Dec 16, 2016, 5:04:34 PM12/16/16
to Salt-users

So I started reading the changelogs and bug reports and found that this is indeed a bug in 2016.11.0

https://github.com/saltstack/salt/issues/37969

2016.11.1 changelogs mention it - so I upgraded to 2016.11.1 and now there's another further issue -

it attempts to extract the archive EVERY time instead of ensuring the files are consistent with source and only fixing what is broken.
I think there's something still wrong with archive.extracted.

Now, error message is :


----------
          ID: Deploy_Oracle_java
    Function: archive.extracted
        Name: /usr/lib/jvm/
      Result: False
     Comment: The below paths (relative to /usr/lib/jvm/) exist, but are the incorrect type (i.e. file instead of directory or vice-versa).To proceed with extraction, set 'force' to True. Note that this will remove these paths before extracting.
             
              - jdk1.8.0_112/man/ja
     Started: 17:00:21.309866
    Duration: 2402.618 ms
     Changes:  


Daniel Santos

unread,
Jan 12, 2017, 1:55:31 PM1/12/17
to Salt-users
I've also faced the same issue and opened a bug for them:

To track it: https://github.com/saltstack/salt/issues/38711
Reply all
Reply to author
Forward
0 new messages