Re: [Puppet Users] Unable to replace a symlink with regular file

Gary Larizza
2013-01-21T18:34:00Z

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).