Issue #16906 has been reported by Joshua Hoblitt.

----------------------------------------
Bug #16906: DIE DIRECTORY, DIE!!! - file type will not replace a directory with 
a symlink
https://projects.puppetlabs.com/issues/16906

Author: Joshua Hoblitt
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 3.0.0
Keywords: 
Branch: 


It seems like the file type should be able to recursively unlink an existing 
directory structure in order to replace it with a symlink.  At present, you 
have to resort to an exec to nuke a pre-existing directory.

    [root@pipen11 /]# stat /data
    File: `/data'
    Size: 4096          Blocks: 8          IO Block: 4096   directory
    Device: fd00h/64768d        Inode: 2621441     Links: 4
    Access: (1775/drwxrwxr-t)  Uid: (    0/    root)   Gid: (  112/    iraf)
    Access: 2012-10-09 18:05:41.000000000 -0700
    Modify: 2012-10-09 18:01:22.000000000 -0700
    Change: 2012-10-09 18:01:22.000000000 -0700
    [root@pipen11 /]# stat /data1
    File: `/data1'
    Size: 4096          Blocks: 8          IO Block: 4096   directory
    Device: 821h/2081d  Inode: 2           Links: 3
    Access: (1777/drwxrwxrwt)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2012-10-09 18:05:41.000000000 -0700
    Modify: 2012-10-08 18:33:22.000000000 -0700
    Change: 2012-10-08 18:57:19.000000000 -0700
    [root@pipen11 /]# cd
    [root@pipen11 ~]# vim data.pp
    [root@pipen11 ~]# cat data.pp 
    file { "/data":
    ensure  => link,
    target  => '/data1',
    replace => true,
    force   => true,
    recurse => true,
    }
    [root@pipen11 ~]# puppet apply --verbose data.pp 
    Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
    Info: Applying configuration version '1349831290'
    Finished catalog run in 0.07 seconds
    [root@pipen11 ~]# vim data.pp
    [root@pipen11 ~]# cat data.pp 
    file { "/data":
    ensure  => link,
    target  => '/data1',
    force   => true,
    }
    [root@pipen11 ~]# puppet apply --verbose data.pp 
    Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
    Info: Applying configuration version '1349831312'
    Info: /Stage[main]//File[/data]: Recursively backing up to filebucket
    Info: /Stage[main]//File[/data]: Recursively backing up to filebucket
    Error: Could not remove existing file
    Error: /Stage[main]//File[/data]/ensure: change from directory to link 
failed: Could not remove existing file
    Finished catalog run in 0.07 seconds
    [root@pipen11 ~]# vim data.pp
    [root@pipen11 ~]# cat data.pp 
    file { "/data":
    ensure  => link,
    target  => '/data1',
    force   => true,
    replace => true,
    }
    [root@pipen11 ~]# puppet apply --verbose data.pp 
    Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
    Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
    Info: Applying configuration version '1349831334'
    Info: /Stage[main]//File[/data]: Recursively backing up to filebucket
    Info: /Stage[main]//File[/data]: Recursively backing up to filebucket
    Error: Could not remove existing file
    Error: /Stage[main]//File[/data]/ensure: change from directory to link 
failed: Could not remove existing file
    Finished catalog run in 0.07 seconds



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to