Sean Kelly
2013-Jan-21 17:19 UTC
[Puppet Users] Unable to replace a symlink with regular file
I am running Puppet 2.7.x (x varies from 14 to 20 on different machines). I am trying to use Puppet to deploy a new Zabbix agent configuration file. On all machines where the file wasn''t a symlink, the deployment worked. However, every machine where it is a link, Puppet refuses to replace teh link with a regular file or do anything with it. I''ve read the type reference, and I see nothing specific about forcing symlink replacement. I''ve looked at the source, and it seems like remove_existing should be unlinking teh symlink ahead of my new file. But, it isn''t happening. Any suggestions on hwo to do this? File { backup => main, owner => "root", group => $operatingsystem ? { freebsd => "wheel", default => "root", }, mode => 644, ensure => present, } class zabbix { file { ''/usr/local/etc/zabbix'': ensure => ''directory''; ''/usr/local/etc/zabbix/zabbix_agentd.conf'': content => template("zabbix/zabbix_agentd.conf.erb"), } ... root@victor:~# ls -ld /usr/local/etc/zabbix/zabbix_agentd.conf lrwxr-xr-x 1 root wheel 64 Dec 9 2011 /usr/local/etc/zabbix/zabbix_agentd.conf -> /usr/local/flightaware/monitor-scripts/zabbix/zabbix_agentd.conf root@victor:~# puppet agent --test --debug --color=no | grep zabbix_agentd.conf 2>&1 debug: /Stage[main]/Zabbix/Service[zabbix_agentd]/subscribe: subscribes to File[/usr/local/etc/zabbix/zabbix_agentd.conf] debug: /Stage[main]/Zabbix/File[/usr/local/etc/zabbix/zabbix_agentd.conf]: Autorequiring File[/usr/local/etc/zabbix] debug: /Stage[main]/Zabbix/File[/usr/local/etc/zabbix/zabbix_agentd.conf]/mode: Not managing symlink mode Thanks! -- 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/-/mw3dMbd96TkJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Gary Larizza
2013-Jan-21 18:34 UTC
Re: [Puppet Users] Unable to replace a symlink with regular file
You should be able to add "force => true" and get this to work for you On Monday, January 21, 2013 at 9:19 AM, Sean Kelly wrote:> I am running Puppet 2.7.x (x varies from 14 to 20 on different machines). I am trying to use Puppet to deploy a new Zabbix agent configuration file. On all machines where the file wasn''t a symlink, the deployment worked. However, every machine where it is a link, Puppet refuses to replace teh link with a regular file or do anything with it. > > I''ve read the type reference, and I see nothing specific about forcing symlink replacement. I''ve looked at the source, and it seems like remove_existing should be unlinking teh symlink ahead of my new file. But, it isn''t happening. Any suggestions on hwo to do this? > > File { > backup => main, > owner => "root", > group => $operatingsystem ? { > freebsd => "wheel", > default => "root", > }, > mode => 644, > ensure => present, > } > > > class zabbix { > file { > ''/usr/local/etc/zabbix'': > ensure => ''directory''; > ''/usr/local/etc/zabbix/zabbix_agentd.conf'': > content => template("zabbix/zabbix_agentd.conf.erb"), > } > > ... > > root@victor:~# ls -ld /usr/local/etc/zabbix/zabbix_agentd.conf > lrwxr-xr-x 1 root wheel 64 Dec 9 2011 /usr/local/etc/zabbix/zabbix_agentd.conf -> /usr/local/flightaware/monitor-scripts/zabbix/zabbix_agentd.conf > > > root@victor:~# puppet agent --test --debug --color=no | grep zabbix_agentd.conf 2>&1 > debug: /Stage[main]/Zabbix/Service[zabbix_agentd]/subscribe: subscribes to File[/usr/local/etc/zabbix/zabbix_agentd.conf] > debug: /Stage[main]/Zabbix/File[/usr/local/etc/zabbix/zabbix_agentd.conf]: Autorequiring File[/usr/local/etc/zabbix] > debug: /Stage[main]/Zabbix/File[/usr/local/etc/zabbix/zabbix_agentd.conf]/mode: Not managing symlink mode > > > Thanks! > > -- > 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/-/mw3dMbd96TkJ. > To post to this group, send email to puppet-users@googlegroups.com (mailto:puppet-users@googlegroups.com). > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com (mailto:puppet-users+unsubscribe@googlegroups.com). > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Sean Kelly
2013-Jan-21 19:31 UTC
Re: [Puppet Users] Unable to replace a symlink with regular file
I''ve tried that as well. It doesn''t work. On Monday, January 21, 2013 12:34:00 PM UTC-6, Gary Larizza wrote:> > You should be able to add "force => true" and get this to work for you > > On Monday, January 21, 2013 at 9:19 AM, Sean Kelly wrote: > > I am running Puppet 2.7.x (x varies from 14 to 20 on different machines). > I am trying to use Puppet to deploy a new Zabbix agent configuration file. > On all machines where the file wasn''t a symlink, the deployment worked. > However, every machine where it is a link, Puppet refuses to replace teh > link with a regular file or do anything with it. > > I''ve read the type reference, and I see nothing specific about forcing > symlink replacement. I''ve looked at the source, and it seems like > remove_existing should be unlinking teh symlink ahead of my new file. But, > it isn''t happening. Any suggestions on hwo to do this? > > File { > backup => main, > owner => "root", > group => $operatingsystem ? { > freebsd => "wheel", > default => "root", > }, > mode => 644, > ensure => present, > } > > class zabbix { > file { > ''/usr/local/etc/zabbix'': > ensure => ''directory''; > ''/usr/local/etc/zabbix/zabbix_agentd.conf'': > content => template("zabbix/zabbix_agentd.conf.erb"), > } > ... > > root@victor:~# ls -ld /usr/local/etc/zabbix/zabbix_agentd.conf > lrwxr-xr-x 1 root wheel 64 Dec 9 2011 > /usr/local/etc/zabbix/zabbix_agentd.conf -> > /usr/local/flightaware/monitor-scripts/zabbix/zabbix_agentd.conf > > root@victor:~# puppet agent --test --debug --color=no | grep > zabbix_agentd.conf 2>&1 > debug: /Stage[main]/Zabbix/Service[zabbix_agentd]/subscribe: subscribes to > File[/usr/local/etc/zabbix/zabbix_agentd.conf] > debug: /Stage[main]/Zabbix/File[/usr/local/etc/zabbix/zabbix_agentd.conf]: > Autorequiring File[/usr/local/etc/zabbix] > debug: > /Stage[main]/Zabbix/File[/usr/local/etc/zabbix/zabbix_agentd.conf]/mode: > Not managing symlink mode > > Thanks! > > -- > 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/-/mw3dMbd96TkJ. > To post to this group, send email to puppet...@googlegroups.com<javascript:> > . > To unsubscribe from this group, send email to > puppet-users...@googlegroups.com <javascript:>. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > > >-- 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/-/uzMEDywYxD8J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Gary Larizza
2013-Jan-21 22:11 UTC
Re: [Puppet Users] Unable to replace a symlink with regular file
Have you tried explicitly setting the ensure value - a la "ensure => file" - on the files that might exist as symlinks? I tested this out locally and was able to get Puppet to overwrite a symlink with a file declaration. On Monday, January 21, 2013 at 11:31 AM, Sean Kelly wrote:> I''ve tried that as well. It doesn''t work. > > > On Monday, January 21, 2013 12:34:00 PM UTC-6, Gary Larizza wrote: > > You should be able to add "force => true" and get this to work for you > > > > > > On Monday, January 21, 2013 at 9:19 AM, Sean Kelly wrote: > > > > > I am running Puppet 2.7.x (x varies from 14 to 20 on different machines). I am trying to use Puppet to deploy a new Zabbix agent configuration file. On all machines where the file wasn''t a symlink, the deployment worked. However, every machine where it is a link, Puppet refuses to replace teh link with a regular file or do anything with it. > > > > > > I''ve read the type reference, and I see nothing specific about forcing symlink replacement. I''ve looked at the source, and it seems like remove_existing should be unlinking teh symlink ahead of my new file. But, it isn''t happening. Any suggestions on hwo to do this? > > > > > > File { > > > backup => main, > > > owner => "root", > > > group => $operatingsystem ? { > > > freebsd => "wheel", > > > default => "root", > > > }, > > > mode => 644, > > > ensure => present, > > > } > > > > > > > > > class zabbix { > > > file { > > > ''/usr/local/etc/zabbix'': > > > ensure => ''directory''; > > > ''/usr/local/etc/zabbix/zabbix_agentd.conf'': > > > content => template("zabbix/zabbix_agentd.conf.erb"), > > > } > > > > > > ... > > > > > > root@victor:~# ls -ld /usr/local/etc/zabbix/zabbix_agentd.conf > > > lrwxr-xr-x 1 root wheel 64 Dec 9 2011 /usr/local/etc/zabbix/zabbix_agentd.conf -> /usr/local/flightaware/monitor-scripts/zabbix/zabbix_agentd.conf > > > > > > > > > root@victor:~# puppet agent --test --debug --color=no | grep zabbix_agentd.conf 2>&1 > > > debug: /Stage[main]/Zabbix/Service[zabbix_agentd]/subscribe: subscribes to File[/usr/local/etc/zabbix/zabbix_agentd.conf] > > > debug: /Stage[main]/Zabbix/File[/usr/local/etc/zabbix/zabbix_agentd.conf]: Autorequiring File[/usr/local/etc/zabbix] > > > debug: /Stage[main]/Zabbix/File[/usr/local/etc/zabbix/zabbix_agentd.conf]/mode: Not managing symlink mode > > > > > > > > > Thanks! > > > > > > -- > > > 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/-/mw3dMbd96TkJ. > > > To post to this group, send email to puppet...@googlegroups.com (javascript:). > > > To unsubscribe from this group, send email to puppet-users...@googlegroups.com (javascript:). > > > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. > > > -- > 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/-/uzMEDywYxD8J. > To post to this group, send email to puppet-users@googlegroups.com (mailto:puppet-users@googlegroups.com). > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com (mailto:puppet-users+unsubscribe@googlegroups.com). > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Sean Kelly
2013-Jan-21 22:55 UTC
Re: [Puppet Users] Unable to replace a symlink with regular file
That worked, thanks! I didn''t realize "file" was even a valid setting for ensure. notice: /Stage[main]/Zabbix/File[/usr/local/etc/zabbix/zabbix_agentd.conf]/ensure: defined content as ''{md5}6b3491d534f04c4eea426b9cf83e637d'' info: /Stage[main]/Zabbix/File[/usr/local/etc/zabbix/zabbix_agentd.conf]: Scheduling refresh of Service[zabbix_agentd] notice: /Stage[main]/Zabbix/Service[zabbix_agentd]: Triggered ''refresh'' from 1 events notice: Finished catalog run in 5.32 seconds Again, thanks! On Monday, January 21, 2013 4:11:18 PM UTC-6, Gary Larizza wrote:> > Have you tried explicitly setting the ensure value - a la "ensure => file" > - on the files that might exist as symlinks? I tested this out locally and > was able to get Puppet to overwrite a symlink with a file declaration. > > On Monday, January 21, 2013 at 11:31 AM, Sean Kelly wrote: > > I''ve tried that as well. It doesn''t work. > > > On Monday, January 21, 2013 12:34:00 PM UTC-6, Gary Larizza wrote: > > You should be able to add "force => true" and get this to work for you > > On Monday, January 21, 2013 at 9:19 AM, Sean Kelly wrote: > > I am running Puppet 2.7.x (x varies from 14 to 20 on different machines). > I am trying to use Puppet to deploy a new Zabbix agent configuration file. > On all machines where the file wasn''t a symlink, the deployment worked. > However, every machine where it is a link, Puppet refuses to replace teh > link with a regular file or do anything with it. > > I''ve read the type reference, and I see nothing specific about forcing > symlink replacement. I''ve looked at the source, and it seems like > remove_existing should be unlinking teh symlink ahead of my new file. But, > it isn''t happening. Any suggestions on hwo to do this? > > File { > backup => main, > owner => "root", > group => $operatingsystem ? { > freebsd => "wheel", > default => "root", > }, > mode => 644, > ensure => present, > } > > class zabbix { > file { > ''/usr/local/etc/zabbix'': > ensure => ''directory''; > ''/usr/local/etc/zabbix/zabbix_agentd.conf'': > content => template("zabbix/zabbix_agentd.conf.erb"), > } > ... > > root@victor:~# ls -ld /usr/local/etc/zabbix/zabbix_agentd.conf > lrwxr-xr-x 1 root wheel 64 Dec 9 2011 > /usr/local/etc/zabbix/zabbix_agentd.conf -> > /usr/local/flightaware/monitor-scripts/zabbix/zabbix_agentd.conf > > root@victor:~# puppet agent --test --debug --color=no | grep > zabbix_agentd.conf 2>&1 > debug: /Stage[main]/Zabbix/Service[zabbix_agentd]/subscribe: subscribes to > File[/usr/local/etc/zabbix/zabbix_agentd.conf] > debug: /Stage[main]/Zabbix/File[/usr/local/etc/zabbix/zabbix_agentd.conf]: > Autorequiring File[/usr/local/etc/zabbix] > debug: > /Stage[main]/Zabbix/File[/usr/local/etc/zabbix/zabbix_agentd.conf]/mode: > Not managing symlink mode > > Thanks! > > -- > 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/-/mw3dMbd96TkJ. > 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. > > > -- > 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/-/uzMEDywYxD8J. > To post to this group, send email to puppet...@googlegroups.com<javascript:> > . > To unsubscribe from this group, send email to > puppet-users...@googlegroups.com <javascript:>. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > > >-- 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/-/CI6dzpN2iKEJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.