1

I am checking the file content in file1 (which is in puppet master) with file2 (which is in agent machine). If the contents are the same mean I replace the file1 from master with file2 in agent. If the content are a different mean do nothing. So that I am using the file resource like below:

      class ysample::testing3{ file{"/opt/ytesting/ymyfiles.txt": 
      ensure=>"file", 
      source=> "puppet://puppetmaster.solartis.net/ysamplehome/ymyfiles.txt",
      sourcepermissions=>"use", 
      recurse => "true", 
      showdiff => "true", 
      validatecmd =>"/opt/ytesting -t -f %", 
      validate_replacement => "%", 
          } 
         }

but it will not replace the file with same timestamp. Can you give the solution to replace the file with same timestamp and how to check whether our resource are apply or not? After I executed this command I see:

       -rw-r--r-- 1 root root 37 Dec 22 18:51 ymyfiles.txt >>>(in master machine)    
       -rw-r--r-- 1 root root 37 Dec 22 18:19 ymyfiles.txt >>>(in agent machine)
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
  • Are you saying you want to apply the timestamp from the master's version of the file to the agent's version? Alternatively, are you saying you want to update the agent's version without changing the timestamp? Either way, why is the timestamp important? – John Bollinger Dec 28 '15 at 18:39

1 Answers1

0

From the documentation it does not appear that Puppet will currently update the mtime on managed files on the agent side. If this is important to you, please consider opening a feature request.

Felix Frank
  • 8,125
  • 1
  • 23
  • 30