hw-cookbooks/aptly — pull request #9 by 3dinfluence (2014-07-28 02:09:29+00:00)
Title: repo_add remove_files hack

I believe that a bug in aptly that's causing this behavior and not the lwrp.

This patch just works around the aptly bug. But will likely cause other issues as the newly written level db files as well as the log file end up being owned by root.

Using a resource like this example:
```
# Add deb files from incoming to repository
aptly_repo "my_test_repo" do
action :add
remove_files true
directory "/var/repository/incoming/precise/test"
end
```
Even when the files are set to 0666 and owner:group set to aptly like this:
```
/var/repository/incoming/precise/test# ls -las
total 36
4 drwxrwsr-x 2 aptly aptly 4096 Jul 27 14:35 .
4 drwxr-xr-x 6 aptly aptly 4096 Jul 27 01:08 ..
28 -rw-rw-rw- 1 aptly aptly 24600 Jul 27 14:35 foo-1.0.0_amd64.deb
```
The command
`aptly repo add -remove-files my_test_repo /var/repository/incoming/precise/test` returns
`ERROR: unable to remove file: remove /var/repository/incoming/precise/test/foo-1.0.0_amd64.deb: permission denied`

Running the command as root works as expected.