Distributing binary files with salt

512 views
Skip to first unread message

Anders Bruun Olsen

unread,
Oct 22, 2012, 9:44:06 AM10/22/12
to Salt-users
Hi,

I am currently writing a salt-state for setting up a server with some custom software we need. We get an installer from the software creator which needs to be run as a shell script (it is a Java-based server software). It is a bash-script with a bunch of binary data appended. For this I was expecting to distribute the installer-file with a file.managed. So far I have only tested this with Salty Vagrant, but I have run into an irritating problem. The file that is created by salt is 0 bytes when run by "vagrant provision" (which just runs state.highstate). If I do a "salt-call state.highstate" from the virtual machine, the problem is the same, but if I do a "salt-call state.single file.managed ..." (with the same data as in the sls-file) it does the right thing, but outputs a whole boat load of binary data on the screen.

The state I am using:

ilexserver-installer:
  file.managed:
    - name: /opt/iLEXServer_2_0047.sh
    - src: salt://ilex/iLEXServer_2_0047.sh

The output state.highstate gives me when the file does not yet exist in /opt:
[default] [INFO    ] Executing state file.managed for /opt/iLEXServer_2_0047.sh
[default] [INFO    ] {'new': 'file /opt/iLEXServer_2_0047.sh created'}
----------
    State: - file
    Name:      /opt/iLEXServer_2_0047.sh
    Function:  managed
        Result:    True
        Comment:   Empty file
        Changes:   new: file /opt/iLEXServer_2_0047.sh created

And when the file exists as a 0 byte file:
[default] [INFO    ] Executing state file.managed for /opt/iLEXServer_2_0047.sh
[default] [INFO    ] No changes made for /opt/iLEXServer_2_0047.sh
----------
    State: - file
    Name:      /opt/iLEXServer_2_0047.sh
    Function:  managed
        Result:    True
        Comment:   File /opt/iLEXServer_2_0047.sh is in the correct state
        Changes:   


I know that it says in the output that it is an empty file, but it is not empty in the salt root. With Salty Vagrant there is no master server, it just mounts the salt root-dirs directly in the VM. I have check /srv/salt/ilex in the VM and the file is there, is not empty and is accessible as root (I am not running salt as an unprivileged user here).

Is this a known issue?
Is file.managed only meant to be used with text files?
If file.managed does not handle binary files, what would be the recommended way to distribute binary installers like this? NFS?

--
Anders Bruun Olsen
It-ansvarlig
Det Danske Sprog- og Litteraturselskab
(Society for Danish Language and Literature)

Jack Kuan

unread,
Oct 22, 2012, 9:58:18 AM10/22/12
to salt-...@googlegroups.com
'src' should be 'source' instead.

This email and any files transmitted with it are confidential and intended solely for the recipient(s). If you are not the named addressee you should not disseminate, distribute, copy or alter this email. Any views or opinions presented in this email are solely those of the author and might not represent those of theScore, Inc. or any of its affiliates. Warning: Although theScore, Inc. has taken reasonable precautions to ensure no viruses are present in this email, the company cannot accept responsibility for any loss or damage arising from the use of this email or attachments.

Anders Bruun Olsen

unread,
Oct 22, 2012, 10:07:22 AM10/22/12
to salt-...@googlegroups.com
GAH!
Thank you for spotting my dumb mistake so fast. It works now :)

2012/10/22 Jack Kuan <jack...@thescore.com>
Reply all
Reply to author
Forward
0 new messages