# Application(\_php) cookbook deletes subtree before symlinking

**URL:** <https://discourse.chef.io/t/application--php-cookbook-deletes-subtree-before-symlinking/4206>\
**Category:** Chef Infra (archive)\
**Created:** [July 4, 2013, 2:29pm UTC](https://discourse.chef.io/t/application--php-cookbook-deletes-subtree-before-symlinking/4206 "2013-07-04T14:29:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cassiano\_Leal](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/cassiano_leal/32/86_2.png) [@Cassiano\_Leal](https://discourse.chef.io/u/Cassiano_Leal)\
**Post date:** [July 4, 2013, 2:29pm UTC](https://discourse.chef.io/t/application--php-cookbook-deletes-subtree-before-symlinking/4206/1 "2013-07-04T14:29:44Z")

</div>

Ohai!

I am trying to deploy an application using the application\_php cookbook. Most of it works as expected, but there’s still one detail to set straight before calling it done.

The application logs stuff to data/log/application.log, relative to its root location.

I want the logs to survive deploys, so the obvious thing to do is to have data/log inside the shared/ sirectory, and symlinking one to the other.

I’m doing this through the symlink\_before\_migrate attribute of the application resource, like such:

symlink\_before\_migrate(  
‘data’ =\> ‘’  
)

The weird thing is: it does the symlinking flawlessly, I have current/data linked to shared/data just fine, but everything inside it gets purged, meaning that my logs are gone after each deploy (and the whole data/\* subtree for that matter).

I couldn’t find the symlinking code in the application and application\_php cookbooks either.

Am I doing something wrong, have I hit a bug that should be ticketed, or something else?

Appreciate your pointers.

Cheers,

- cassiano

---

<div class="post-metadata">

**Author:** ![Cassiano\_Leal](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/cassiano_leal/32/86_2.png) [@Cassiano\_Leal](https://discourse.chef.io/u/Cassiano_Leal)\
**Post date:** [July 4, 2013, 2:36pm UTC](https://discourse.chef.io/t/application--php-cookbook-deletes-subtree-before-symlinking/4206/2 "2013-07-04T14:36:36Z")

</div>

Ugh... Nevermind.

I had set

purge\_before\_symlink [  
“data/"

]

which was causing the deletion of the subtree. Changed it to

purge\_before\_symlink [  
“data"

]

and all is good now, apart from my feeling a bit stupid. 🙂

- cassiano

On Thursday, July 4, 2013 at 11:29, Cassiano Leal wrote:

> Ohai!
> 
> I am trying to deploy an application using the application\_php cookbook. Most of it works as expected, but there’s still one detail to set straight before calling it done.
> 
> The application logs stuff to data/log/application.log, relative to its root location.
> 
> I want the logs to survive deploys, so the obvious thing to do is to have data/log inside the shared/ sirectory, and symlinking one to the other.
> 
> I’m doing this through the symlink\_before\_migrate attribute of the application resource, like such:
> 
> symlink\_before\_migrate(  
> ‘data’ =\> ‘'  
> )
> 
> The weird thing is: it does the symlinking flawlessly, I have current/data linked to shared/data just fine, but everything inside it gets purged, meaning that my logs are gone after each deploy (and the whole data/\* subtree for that matter).
> 
> I couldn’t find the symlinking code in the application and application\_php cookbooks either.
> 
> Am I doing something wrong, have I hit a bug that should be ticketed, or something else?
> 
> Appreciate your pointers.
> 
> Cheers,
> 
> - cassiano
