Forum OpenACS Q&A: Unable to delete package instance of 'Download'

Selecting delete on the Unmounted Packages page under heading "The following application packages are not mounted anywhere. You can delete an unmounted package by clicking the "delete" option." produces the following error:

Error Deleting Instance

--------------------------------------------------------------------------------
The following error was returned:
Database operation "0or1row" failed (exception NSDB, "Query was not a statement returning rows.")

--------------------------------------------------------------------------------

The download package did not have any archives set up, it had just been installed and mounted and then unmounted after server re-start.

Can anyone tell me how to remove it manually?

Regards
Richard

Collapse
Posted by Jade Rubick on
Two possible solutions:

Bug the developer to handle removal cleanly.

Go through the drop script in psql and manually do each line in the drop script, and see if you see any problems. If you do, post here.

After doing that, then try to delete again.

Does this sound like a good idea to everyone else? That's what I would try, but not sure it's the best way.

Collapse
Posted by Dave Bauer on
This is not a DROP operation. Its a delete of a package instance.

Unfortunatly most packages still can not clean up a package isntance.

All packages need a delete apm callback to remove data when a package instance is deleted.

You can look the the tables the download package created. THere is probably a folder tied to the package_id of the package instance you wish to delete. Also check cr_folders.

Collapse
Posted by Mark Aufflick on
This is a constant problem. Maybe we should tackle instance deletion across all major packages for 5.1.

It's a bit silly that we still have these problems.

Collapse
Posted by Malte Sussdorff on
Before making a TIP out of it:

How do people feel to make it a release criteria for 5.1b (b as in beta) that all packages supplied with OpenACS default installation (however we define this) have clean delete package scripts with them, or a disabled "delete package link" if it is not possible.

Collapse
Posted by Dave Bauer on
Yes. It should be a release criteria. There needs to be no TIP. The lack of delete callbacks is a bug.
Collapse
Posted by Mark Aufflick on
That's the way :)
Collapse
Posted by Jade Rubick on
We should make sure we document how to do this, however. I tried doing it in project-manager, but gave up because I couldn't figure it out and I had other time constraints.

What's a good example to emulate?

My understanding is that this is not just drop scripts (which should also be part of the release criteria), but that you have to have callbacks to delete unmounted instances.

Collapse
Posted by Vinod Kurup on
Most acs_objects in a package should be children of the package_id, right? Would it make sense to go through all children of the package_id, figure out what acs_object_type it is and then call the del function for that acs_object_type? We'd need a generic package_delete_object similar to our package_instantiate_object. I think using this for all packages would fix most of the 'delete-package' problems but I'm not sure if it would be too far-reaching by deleting data that belonged to other packages.
Collapse
Posted by Tilmann Singer on
With children - do you mean by way of context_id? This field is according to the kernel docs explicitely _only_ for security purposes (and should have been called security_context_id propably). So I wouldn't deduce any further child/parent relationships from it, at least that's what I remember from earlier discussions on this topic.
Collapse
Posted by Vinod Kurup on
Yeah, I did mean children via context_id. Oh well, I guess packages will have to write their own delete-objects callbacks. I was looking for an easy way out.
Collapse
Posted by Tom Jackson on

When you delete an object, you need to update all objects which use the object_id as their context_id, probably setting it to (What is the default now? -4?). This was discussed a while back, has acs_object.delete been changed to do this yet? Of course you also have rel_segments and permissions to delete as well.

Collapse
Posted by Richard Hamilton on
I see the question is harder to answer than it was to ask!

Is the issue with deleting unwanted user records similar and if a solution is worked through to one problem will it be applicable to both issues?

Regards
Richard