Salt: copy file from S3 with file.managed fails when file does not exists localy

Created on 23 Mar 2016  路  4Comments  路  Source: saltstack/salt

Description of Issue/Question

When using the following:

file.managed:
      - name: /tmp/file
      - source: s3://path/to/file
      - source_hash: md5=md5 of file

I get: File sum set for file of e444970691c085411de8e44271256f2c does not match real sum of 07530695690c78c06077f776628fb3a4

But when I wget the same file to the location at 'name' it works. It looks that it will fail if the file does not exists on local

Setup

(Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).)

Steps to Reproduce Issue

(Include debug logs if possible and relevant.)

Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

Salt Version:
           Salt: 2015.8.7

Dependency Versions:
         Jinja2: 2.7.2
       M2Crypto: Not Installed
           Mako: 0.9.1
         PyYAML: 3.10
          PyZMQ: 14.0.1
         Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.4
           cffi: 1.5.2
       cherrypy: Not Installed
       dateutil: 1.5
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          ioflo: Not Installed
        libgit2: 0.23.4
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.3.0
   mysql-python: 1.2.3
      pycparser: 2.14
       pycrypto: 2.6.1
         pygit2: 0.23.3
   python-gnupg: Not Installed
          smmap: 0.8.2
        timelib: Not Installed

System Versions:
           dist: Ubuntu 14.04 trusty
        machine: x86_64
        release: 3.13.0-74-generic
         system: Ubuntu 14.04 trusty
Bug File Servers P2 RIoT severity-medium stale

Most helpful comment

This isn't the first time this issue has been reported. I ran into a similar situation when attempting to download tomcat using file.managed. I figured that salt is checking the MD5 BEFORE the file is downloaded. MD5 is subject to change depending on the amount/content downloaded of the target file. Thus MD5 is not a constant until the file is downloaded. File.managed would need to check the MD5 AFTER the file has been downloaded.

All 4 comments

@moshe0076, thanks for reporting.

No problem - Glad to help

This isn't the first time this issue has been reported. I ran into a similar situation when attempting to download tomcat using file.managed. I figured that salt is checking the MD5 BEFORE the file is downloaded. MD5 is subject to change depending on the amount/content downloaded of the target file. Thus MD5 is not a constant until the file is downloaded. File.managed would need to check the MD5 AFTER the file has been downloaded.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

Was this page helpful?
0 / 5 - 0 ratings