bolt icon indicating copy to clipboard operation
bolt copied to clipboard

Bolt apply does not preserve symlinks in source directories

Open lollipopman opened this issue 3 years ago • 2 comments

Describe the Bug

Given a file resource with recurse true and a directory as the source:

file { /home/butter:
    ensure       => present,
    source       => "puppet:///modules/users/home/butter}/",
    recurse      => 'remote',
    mode         => '0644',
    owner        => 'butter',
    group        => 'butter',
    force        => true,
}

$ cd /home/butter
$ tree
.
├── foo -> bar
└── bar

Bolt fails to preserve the symlink, which generates the following erroneous change:

Notice: /Stage[main]/User[butter]/File[/home/butter/foo]/ensure: current_value 'link', should be 'file' (noop)

Expected Behavior

symlink is preserved, resulting in no changes

lollipopman avatar Feb 15 '22 20:02 lollipopman

My guess is that when we tar up the module's files for the apply we loose the symlink https://github.com/puppetlabs/bolt/blob/f76f7444a1fbf44da413062e4a8e9102ccced66a/lib/bolt/applicator.rb#L341 \using Minitar. A quick glance through that library does not yield and obvious way to actually preserve the symlink when building the tar archive. If it is the case that this is the cause of this issue and that it is not an existing feature in minitar someone would probably have to land that feature in the minitar project for us to be able to make this work in bolt.

https://github.com/halostatue/minitar/issues/8

donoghuc avatar Mar 09 '22 00:03 donoghuc

@donoghuc https://github.com/halostatue/minitar/pull/42 looks promising

op-ct avatar Jul 18 '22 19:07 op-ct

This issue has not had activity for 60 days and will be marked as stale. If this issue continues to have no activity for 7 days, it will be closed.

github-actions[bot] avatar Sep 17 '22 00:09 github-actions[bot]

This issue is stale and has been closed. If you believe this is in error, or would like the Bolt team to reconsider it, please reopen the issue.

github-actions[bot] avatar Sep 24 '22 00:09 github-actions[bot]

@op-ct Apologies for the delay. I should be able to merge the symlink support and release a new version by the new year.

halostatue avatar Dec 27 '22 05:12 halostatue