Hi,
I am setting up the deployment module for a project and extending it so that I can delete content and I noticed a small bug.
In node_deploy.module there is a check to see if the node that is going to be deployed exists (line 104).
If not, it returns: xmlrpc_error($xmlrpcusererr + 1, t('Node not found'));
In deploy.module the return value of node_deploy() is checked. If it is FALSE an error is written to the log. But the value returned when the node does not exist is not FALSE. So it always reports the deployment as success.
Steps to reproduce:
- add it to a deployment plan
- delete the node
- execute deployment plan: the task will return success, while it has failed
the fix that I suggest is:
In deploy.module line 769 replace
if ($xmlrpc_result === FALSE) {
by
if (xmlrpc_errno() != NULL) {
I will create a patch for it after some testing.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 874466-deploy-delete-plan-items.patch | 6.99 KB | gdd |
| #5 | 874466-deploy-delete-plan-items.patch | 7.08 KB | gdd |
| #3 | deploy-delete-plan-items.patch | 6.47 KB | dixon_ |
Comments
Comment #1
mewren commentedI am also seeing this
Comment #2
gddI think a better fix would be to not attempt to deploy these nodes at all, and remove them from the plan if they no longer exist. This is a much cleaner solution IMO. This will potentially be a problem in other areas as well (taxonomy, users, anything really.) I will try and look into this soon.
Comment #3
dixon_The only object that can be put in a persistent plan is nodes, content types and views. All the other objects are either deployed as dependencies or deployed on the go through internal deployment plans. So it only makes sense to implement delete hooks for those types, IMO.
Here is a patch that works as expected for me. I'll put it up here for a review before I commit. This patch also removed the implementation of
hook_comment()incomment_deploy.modulethat didn't do anything useful (the delete operation on thecomments_uuidtable is handled bydeploy_uuid.module.Edit: The reason why the delete implementation for Views is handled through a form submit handler is because there is no specific hook fired when a view is deleted.
Comment #4
dixon_Comment #5
gddI've made a couple of mods to this patch, but conceptually it looks good
- I made deploy_plan_item_delete() a little more flexible, it can now take any combination of fields and values.
- I also realized this is useful as a general API function, so I moved it into deploy.module. After this patch is committed I will update all the other existing functions to use it.
- Some typos and such.
New patch attached.
Comment #6
dixon_Yeah, you are right. It probably belongs in
deploy.module!I will test this patch during this week. Hopefully tomorrow.
Comment #7
gddSomewhat simplified patch here, didn't even know about db_type_placeholder() until today!
Comment #8
dixon_Tested the patch from #7 successfully. Committed with some additional code comments. http://drupal.org/cvs?commit=434582