file resource issue?

19 views
Skip to first unread message

Jason McMahan

unread,
May 31, 2018, 8:22:25 PM5/31/18
to Puppet Users
Good day,
I am using the file resource to check if a file has changed or altered on github.
the code i am using is

        file { 'azure_udev_rule':
            path   => '/etc/udev/rules.d/66-azure-storage.rules',
            ensure => 'file',
            notify => Exec['azure_udev_reload'],
        }

        exec { 'azure_udev_reload':
            command     => 'udevadm control --reload-rules && udevadm trigger --subsystem-match=block',
            path        => ['/usr/sbin', '/usr/bin'],
            refreshonly => true,
        }

The problem i have is every puppet run it sees the content as changed.
Notice: /Stage[main]/Profile::Azure/File[azure_udev_rule]/content:

Info: Computing checksum on file /etc/udev/rules.d/66-azure-storage.rules
Info: /Stage[main]/Profile::Azure/File[azure_udev_rule]: Filebucketed /etc/udev/rules.d/66-azure-storage.rules to puppet with sum b775eb19522b919062b1e4aaff4c018e
Notice: /Stage[main]/Profile::Azure/File[azure_udev_rule]/content: content changed '{mtime}2018-05-31 16:28:31 -0500' to '{mtime}2018-05-31 16:31:11 -0500'
Info: /Stage[main]/Profile::Azure/File[azure_udev_rule]: Scheduling refresh of Exec[azure_udev_reload]
Debug: /Stage[main]/Profile::Azure/File[azure_udev_rule]: The container Class[Profile::Azure] will propagate my refresh event
Debug: Exec[azure_udev_reload](provider=posix): Executing 'udevadm control --reload-rules && udevadm trigger --subsystem-match=block'
Debug: Executing: 'udevadm control --reload-rules && udevadm trigger --subsystem-match=block'
Notice: /Stage[main]/Profile::Azure/Exec[azure_udev_reload]: Triggered 'refresh' from 1 events


Is this a bug, am i doing something wrong?

Any help or suggestions would be greatly appreciated.

I tried using checksum => mtime and ctime but that did not help either.
The masters are 5.3.3 version.

Thank you

Arnau

unread,
Jun 1, 2018, 8:58:37 AM6/1/18
to puppet...@googlegroups.com
Hi,

Looks like you're not the only one having such issue: https://tickets.puppetlabs.com/browse/PUP-6624 


A workaround is to force md5 checksumming:

With apache, set ContentDigest On and use:

puppet apply -e 'file { "/tmp/foo": source => "http://localhost/bar", checksum => md5 }'



unfortunately I don't think you can modify the webserver confgiuration in githubusercontent.com.

Maybe adding an extra step where you do wget first, then file -> source => file:///my_path then the other exec? 

something like: (I've not tested the code, only giving the idea):


----
}

 file { 'azure_udev_rule':
            path   => '/etc/udev/rules.d/66-azure-storage.rules',
            ensure => 'file',
            require => Exec['get_file],            
            source => '/tmp/ 66-azure-storage.rules ',
            notify => Exec['azure_udev_reload'],
        }

        exec { 'azure_udev_reload':
            command     => 'udevadm control --reload-rules && udevadm trigger --subsystem-match=block',
            path        => ['/usr/sbin', '/usr/bin'],
            refreshonly => true,
        }
----

for content hosted in a git repository I use the vcsrepo puppet module https://forge.puppet.com/puppetlabs/vcsrepo.

HTH,
Arnau


--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/27d76968-bce6-4c17-aa7d-092ea9b0a768%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jason McMahan

unread,
Jun 4, 2018, 4:22:52 PM6/4/18
to Puppet Users
Thank you for the input Arnau,
That was good suggestions.

Since we were bound by the meta data returned from the webserver we chose to do it slightly different.
Instead we created a local vsts repo, cloned the Azure/WaLinuxAgent and next we will set up a task to sync to that repo every so often. This ensure we are up to date and meta data will be created on our puppet masters.

If/when etag is supported in file resource then i will tear this process down but for now this was the way we went.

Thank you for you help.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages