File ressource: Source = links

241 views
Skip to first unread message

Antidot SAS

unread,
Jul 27, 2012, 5:21:58 AM7/27/12
to puppet-users
Hi everyone,


Do You know if it is possible make sure puppet use the destination of symbolic link as a source file. Let me explain here is the situation.

On my puppet master:
# ls -al
total 1976
drwxr-xr-x 2 user user   4096 Jul 26 16:45 .
drwxr-xr-x 4 user user   4096 Jul 26 16:56 ..
lrwxrwxrwx 1 user user     28 Jul 26 16:35 bind9-chroot-amd64-squeeze-LATEST.deb -> bind9-chroot_9.8.1_amd64.deb
-rw-r--r-- 1 user user 403254 Jul 20 18:29 bind9-chroot_9.8.1_amd64.deb
lrwxrwxrwx 1 user user     26 Jul 26 16:36 bind9-host-amd64-squeeze-LATEST.deb -> bind9-host_9.8.1_amd64.deb
-rw-r--r-- 1 user user  58876 Jul 20 18:29 bind9-host_9.8.1_amd64.deb
lrwxrwxrwx 1 user user     26 Jul 26 16:36 bind9utils-amd64-squeeze-LATEST.deb -> bind9utils_9.8.1_amd64.deb
-rw-r--r-- 1 user user 121074 Jul 20 18:29 bind9utils_9.8.1_amd64.deb
lrwxrwxrwx 1 user user     24 Jul 26 16:37 dnsutils-amd64-squeeze-LATEST.deb -> dnsutils_9.8.1_amd64.deb
-rw-r--r-- 1 user user 142722 Jul 20 18:29 dnsutils_9.8.1_amd64.deb
lrwxrwxrwx 1 user user     18 Jul 26 16:37 host-amd64-squeeze-LATEST.deb -> host_9.8.1_all.deb
-rw-r--r-- 1 user user  17782 Jul 20 18:29 host_9.8.1_all.deb
lrwxrwxrwx 1 user user     27 Jul 26 16:40 libbind9-80-amd64-squeeze-LATEST.deb -> libbind9-80_9.8.1_amd64.deb
-rw-r--r-- 1 user user  40346 Jul 20 18:29 libbind9-80_9.8.1_amd64.deb
lrwxrwxrwx 1 user user     24 Jul 26 16:41 libdns81-amd64-squeeze-LATEST.deb -> libdns81_9.8.1_amd64.deb
-rw-r--r-- 1 user user 827854 Jul 20 18:29 libdns81_9.8.1_amd64.deb
lrwxrwxrwx 1 user user     24 Jul 26 16:41 libisc83-amd64-squeeze-LATEST.deb -> libisc83_9.8.1_amd64.deb
-rw-r--r-- 1 user user 196164 Jul 20 18:29 libisc83_9.8.1_amd64.deb
lrwxrwxrwx 1 user user     26 Jul 26 16:41 libisccc80-amd64-squeeze-LATEST.deb -> libisccc80_9.8.1_amd64.deb
-rw-r--r-- 1 user user  33356 Jul 20 18:29 libisccc80_9.8.1_amd64.deb
lrwxrwxrwx 1 user user     27 Jul 26 16:42 libisccfg82-amd64-squeeze-LATEST.deb -> libisccfg82_9.8.1_amd64.deb
-rw-r--r-- 1 user user  59924 Jul 20 18:29 libisccfg82_9.8.1_amd64.deb
lrwxrwxrwx 1 user user     26 Jul 26 16:42 liblwres80-amd64-squeeze-LATEST.deb -> liblwres80_9.8.1_amd64.deb
-rw-r--r-- 1 user user  58022 Jul 20 18:29 liblwres80_9.8.1_amd64.deb


So I declared a 'file' resource with the source attribute as followed: 
source => "puppet:///modules/${module_name}/packages/libisc83-${::architecture}-${::lsbdistcodename}-LATEST.deb"

So when I run puppet agent here is the result:
# ls -al /var/lib/puppet/tmp/
total 32
drwxr-xr-x  2 puppet puppet  4096 Jul 26 18:02 .
drwxr-x--- 12 puppet puppet  4096 Jul 25 16:11 ..
lrwxrwxrwx  1 root   root      28 Jul 26 18:02 bind9-chroot-amd64-squeeze.deb -> bind9-chroot_9.8.1_amd64.deb
lrwxrwxrwx  1 root   root      26 Jul 26 18:02 bind9-host-amd64-squeeze.deb -> bind9-host_9.8.1_amd64.deb
lrwxrwxrwx  1 root   root      26 Jul 26 18:02 bind9utils-amd64-squeeze.deb -> bind9utils_9.8.1_amd64.deb
lrwxrwxrwx  1 root   root      24 Jul 26 18:02 dnsutils-amd64-squeeze.deb -> dnsutils_9.8.1_amd64.deb
lrwxrwxrwx  1 root   root      18 Jul 26 18:02 host-amd64-squeeze.deb -> host_9.8.1_all.deb
lrwxrwxrwx  1 root   root      27 Jul 26 18:02 libbind9-80-amd64-squeeze.deb -> libbind9-80_9.8.1_amd64.deb
lrwxrwxrwx  1 root   root      24 Jul 26 18:02 libdns81-amd64-squeeze.deb -> libdns81_9.8.1_amd64.deb
lrwxrwxrwx  1 root   root      24 Jul 26 18:02 libisc83-amd64-squeeze.deb -> libisc83_9.8.1_amd64.deb
lrwxrwxrwx  1 root   root      26 Jul 26 18:02 libisccc80-amd64-squeeze.deb -> libisccc80_9.8.1_amd64.deb
lrwxrwxrwx  1 root   root      26 Jul 26 18:02 liblwres80-amd64-squeeze.deb -> liblwres80_9.8.1_amd64.deb


I can't say this really what I want, I really want puppet to follow the symbolic link and get the actual file.

Any idea how I could accomplish that behavior?


Regards,
JM

jcbollinger

unread,
Jul 27, 2012, 8:59:26 AM7/27/12
to puppet...@googlegroups.com


On Friday, July 27, 2012 4:21:58 AM UTC-5, A_SAAS wrote:
Hi everyone,


Do You know if it is possible make sure puppet use the destination of symbolic link as a source file. Let me explain here is the situation.

If I understand you correctly, you should be looking at the 'links' and 'ensure' parameters.  Something along these lines should do what I think you want:

file { "/tmp/foo":
  ensure => file,
  links => follow,
  source => puppet:///modules/${mymodule}/link_to_foo"
}


John

Antidot SAS

unread,
Jul 27, 2012, 9:15:17 AM7/27/12
to puppet...@googlegroups.com
Yes,

I search in the resource documentation but didn't see the attribute: links.

But if I set the following resource:
    file { $name:
        ensure => file,
        links  => follow,
        path   => "${common::params::tmp_dir}/${name}-${::architecture}-${::lsbdistcodename}.${extension}",
        owner  => 'root',
        group  => 'root',
        mode   => '0644',
        source => $source_real,
    }

I have the following error on the agent:
err: /Stage[main]/Bind9_chroot::Install/Common::Libs::Install_archive_package[libisc83]/File[libisc83]/ensure: change from absent to present failed: Could not rename temporary file /var/lib/puppet/tmp/libisc83-amd64-squeeze
.deb.puppettmp_6125 to /var/lib/puppet/tmp/libisc83-amd64-squeeze.deb: File written to disk did not match checksum; discarding changes ( vs {md5}d41d8cd98f00b204e9800998ecf8427e) at /etc/puppet/modules/common/manifests/libs
/install_archive_package.pp:54 at /etc/puppet/modules/common/manifests/libs/install_archive_package.pp:54


Any idea?


But thx for letting me know about the attribute.
JM




--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/GZgw5UE3slYJ.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

jcbollinger

unread,
Jul 27, 2012, 3:50:26 PM7/27/12
to puppet...@googlegroups.com


On Friday, July 27, 2012 8:15:17 AM UTC-5, A_SAAS wrote:
Yes,

I search in the resource documentation but didn't see the attribute: links.

I don't know what to tell you on that.  It's definitely documented: https://docs.puppetlabs.com/references/latest/type.html#file
 

But if I set the following resource:
    file { $name:
        ensure => file,
        links  => follow,
        path   => "${common::params::tmp_dir}/${name}-${::architecture}-${::lsbdistcodename}.${extension}",
        owner  => 'root',
        group  => 'root',
        mode   => '0644',
        source => $source_real,
    }

I have the following error on the agent:
err: /Stage[main]/Bind9_chroot::Install/Common::Libs::Install_archive_package[libisc83]/File[libisc83]/ensure: change from absent to present failed: Could not rename temporary file /var/lib/puppet/tmp/libisc83-amd64-squeeze
.deb.puppettmp_6125 to /var/lib/puppet/tmp/libisc83-amd64-squeeze.deb: File written to disk did not match checksum; discarding changes ( vs {md5}d41d8cd98f00b204e9800998ecf8427e) at /etc/puppet/modules/common/manifests/libs
/install_archive_package.pp:54 at /etc/puppet/modules/common/manifests/libs/install_archive_package.pp:54


Any idea?

Looking carefully at that message, I suspect that an empty file or no file at all was recorded in the location where Puppet thought it had written it.  This could signal a Puppet bug, but it's premature to say so definitively.  The manifest code you're working with seems fairly complex; I'd recommend creating a simple test case to narrow down where the problem may be.


John

jenrzzz

unread,
Jul 27, 2012, 6:37:48 PM7/27/12
to puppet...@googlegroups.com
Yeah, I've encountered that same problem and have not found a workaround. Hopefully a fix is in the works.


-- Jenner
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.

Stuart Cracraft

unread,
Jul 27, 2012, 11:04:58 PM7/27/12
to puppet...@googlegroups.com
Ouch!


--Stuart

Via Apple iPhone 4S on the AT&T Wireless Network

To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/UVr_nA0l4-0J.

To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.

Antidot SAS

unread,
Jul 30, 2012, 5:09:29 AM7/30/12
to puppet...@googlegroups.com
HI everyone,


I confirm that I am falling into the BUG :(. I am running puppet 2.7.18.

I have tested simple case and same issue.


Thx for pointing me the right direction.

Regards,
JM
Reply all
Reply to author
Forward
0 new messages