Bug 493421

Summary: deleteTreeAndProfiles refuses to delete distribution if some profiles are using it
Product: Red Hat Satellite 5 Reporter: Sayli Karmarkar <skarmark>
Component: APIAssignee: Brad Buckingham <bbuckingham>
Status: CLOSED CURRENTRELEASE QA Contact: Sayli Karmarkar <skarmark>
Severity: medium Docs Contact:
Priority: low    
Version: 530CC: cperry, jsefler
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: sat530 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-10 19:55:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 456996    

Description Sayli Karmarkar 2009-04-01 17:26:28 UTC
Description of problem:
deleteTreeAndProfiles is supposed to delete kickstart tree along with all the profiles associated with it, but it seems to be refusing to do that. 

Steps to Reproduce:
1. Create a kickstart distribution 
2. server.kickstart.tree.create(key, "foobar", "/var/satellite/rhn/kickstart/ks-rhel-i386-server-5", "rhel-i386-server-5", "rhel_5")
3. Create a profile "temp-profile" using this tree. 
4. server.kickstart.tree.delete(key, "foobar")
  
Actual results:
<Fault 2757: 'redstone.xmlrpc.XmlRpcFault: The Kickstart Distribution you have chosen to delete is in use.  Please delete or change the Distribution for Kickstart Profiles using this Distribution.'>

Expected results:
It should delete tree along with related profiles as per docs.

Comment 1 Brad Buckingham 2009-04-02 14:07:38 UTC
git commit: d5661f414a0229e685631906b596cfe24458fab3

Updated API to remove any profiles associated with the tree being deleted.

Comment 2 Brad Buckingham 2009-04-02 14:15:20 UTC
the commit in #1 is from the VADER branch...
the commit in to master is: ac1887d26123c8b430d26c82d4ff5dadcb6abd90

Comment 3 Sayli Karmarkar 2009-04-15 18:50:34 UTC
Verified manually and with automation test.

Comment 4 John Sefler 2009-08-31 15:08:37 UTC
Verified on staged (Satellite-5.3.0-RHEL5-re20090724.0) with updates from Aug 20, 2009

[jsefler@jsefler rpcapi]$ ant -Dnamespace=tree
...
invoke-tests-subsystem:
     [echo] 
     [echo] --------------------------------------------------------------------
     [echo] Running all tests in tree subsystem ...
     [echo] --------------------------------------------------------------------
     [echo]       
    [mkdir] Created dir: /home/jsefler/workspace/rpcapi/reports
    [junit] Running com.redhat.rhn.rpc.api.kickstart.tree.create
    [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 3.417 sec
    [junit] Running com.redhat.rhn.rpc.api.kickstart.tree.delete
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 1.337 sec
    [junit] Running com.redhat.rhn.rpc.api.kickstart.tree.deleteTreeAndProfiles
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 4.821 sec
    [junit] Running com.redhat.rhn.rpc.api.kickstart.tree.list
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 1.352 sec
    [junit] Running com.redhat.rhn.rpc.api.kickstart.tree.listInstallTypes
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.286 sec
    [junit] Running com.redhat.rhn.rpc.api.kickstart.tree.rename
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 2.498 sec
    [junit] Running com.redhat.rhn.rpc.api.kickstart.tree.update
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 2.289 sec


Also tested manually...
Manually attempting to delete a kickstart distro that is currently in use by a kickstart profile is blocked in the satellite GUI as follows:

Confirm Distribution Deletion

NOTE: The Kickstart Distribution you have chosen to delete is in use by the following Kickstart Profiles. You must change the Distribution used in the profiles below before deleting this Distribution. Click the label in the link to edit the profile's Distribution. 

moving to RELEASE_PENDING

Comment 5 Brandon Perkins 2009-09-10 19:55:19 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2009-1434.html