File 'replace => false' doesn't match my expectations...

464 views
Skip to first unread message

Jeff

unread,
Jan 28, 2009, 3:37:57 PM1/28/09
to Puppet Users
Sorry if I missed this in the documentation...

Does this work according to its design?

When I configure this file with a template and CHANGE the file on the
client server, puppet detects a change and overwrites the file:
file { "jboss-config":
path => "/etc/sysconfig/jboss",
ensure => present,
replace => false,
owner => root,
group => root,
mode => "0644",
content => template("/var/puppet/modules/atg/files/jboss-
config.erb"),
require => Package["jboss-${release}"]
}

BUT when I configure this file with a source:
file { "jboss-config":
path => "/etc/sysconfig/jboss",
ensure => present,
replace => false,
owner => root,
group => root,
mode => "0644",
source => "puppet://$servername/atg/jboss-config",
require => Package["jboss-${release}"]
}

puppet does NOT overwrite a changed file on the client server.

I expected no overwrites in either situation.

Jeff

Andrew Shafer

unread,
Jan 29, 2009, 12:18:08 AM1/29/09
to puppet...@googlegroups.com
Jeff,

What version of Puppet are you using?

I could not reproduce this behavior with either content or source.

When replace was false the file was not changed.

When I changed the file on disk, the logs say that the checksum changed and that is replaced in the file bucket.

If you can consistently reproduce the behavior, open an issue with the steps.

Thanks,
Andrew

Jeff

unread,
Jan 30, 2009, 3:54:43 PM1/30/09
to Puppet Users
On Jan 28, 7:18 pm, Andrew Shafer <and...@reductivelabs.com> wrote:
> Jeff,
>
> What version of Puppet are you using?

Andrew,

Each time I used a template, it overwrote a changed file. Each time I
used a source, it did not.

Version: 0.24.4

I just tested one more time to make sure. The results were the same.
If I used a template AND replace => false, it still overwrote a
modified file. If I used source AND replace => false, it did not.

Jeff

Luke Kanies

unread,
Feb 5, 2009, 4:59:06 AM2/5/09
to puppet...@googlegroups.com


Definitely not the right behaviour, and fixed in recent releases.

--
The leader of Jamestown was "John Smith" (not his real name), under
whose direction the colony engaged in a number of activities,
primarily related to starving. -- Dave Barry, "Dave Barry Slept Here"
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com

Marc

unread,
Jan 20, 2015, 7:28:33 PM1/20/15
to puppet...@googlegroups.com, lu...@madstop.com
Using 'replace => false' should not trigger a checksum operation but given the time it takes with big files I think it does.
Does it make sense to perform checksum when 'replace' is set to false?

  exec { 'wget -O - http://repo01.demo.lan/coreos/coreos_qemu.img.bz2 | bzcat > /root/coreos/core01/core01.img':
    path    => '/usr/bin',
    creates => '/root/coreos/core01/core01.img',
  }

  file { [ '/root/coreos/core02/core02.img',
           '/root/coreos/core03/core03.img',
           '/root/coreos/core04/core04.img' ]:
    ensure  => file,
    replace => false,
    source  => '/root/coreos/core01/core01.img',
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
  }

Marc

jcbollinger

unread,
Jan 21, 2015, 1:56:20 PM1/21/15
to puppet...@googlegroups.com


On Tuesday, January 20, 2015 at 1:28:33 PM UTC-6, Marc necro'd an ancient thread:
Using 'replace => false' should not trigger a checksum operation but given the time it takes with big files I think it does.
Does it make sense to perform checksum when 'replace' is set to false?

  exec { 'wget -O - http://repo01.demo.lan/coreos/coreos_qemu.img.bz2 | bzcat > /root/coreos/core01/core01.img':
    path    => '/usr/bin',
    creates => '/root/coreos/core01/core01.img',
  }

  file { [ '/root/coreos/core02/core02.img',
           '/root/coreos/core03/core03.img',
           '/root/coreos/core04/core04.img' ]:
    ensure  => file,
    replace => false,
    source  => '/root/coreos/core01/core01.img',
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
  }



I appreciate that you've been searching the archives for information about your issue.  Nevertheless, when you have a new question (which yours is), please start a new thread.

I agree that it doesn't seem useful to checksum a File configured with "replace => false".  If you can confirm that checksums are in fact being computed, then you should consider filing a bug report.  In any case, a work-around and possible diagnostic test would be to set "checksum => 'mtime'" on your affected File resources.  A straight workaround with no diagnostic value would be to simply set "checksum => 'none'".


John

Marc

unread,
Jan 21, 2015, 8:51:37 PM1/21/15
to puppet...@googlegroups.com
I have filed a ticked: https://tickets.puppetlabs.com/browse/PUP-3866

Thank you,
Marc

Thomas Müller

unread,
Feb 2, 2015, 11:35:31 AM2/2/15
to puppet...@googlegroups.com, lu...@madstop.com


Am Dienstag, 20. Januar 2015 20:28:33 UTC+1 schrieb Marc:
Using 'replace => false' should not trigger a checksum operation but given the time it takes with big files I think it does.
Does it make sense to perform checksum when 'replace' is set to false?

Marc

unread,
Feb 2, 2015, 11:43:30 AM2/2/15
to puppet...@googlegroups.com, lu...@madstop.com
You cannot specify source when using checksum 'none'

Marc
Reply all
Reply to author
Forward
0 new messages