Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1030584

Summary: Promoting a new Content View version with removed kickstart tree may fail when host(group) uses it
Product: Red Hat Satellite Reporter: Justin Sherrill <jsherril>
Component: ProvisioningAssignee: jmagen <jmagen>
Status: CLOSED CURRENTRELEASE QA Contact: Kedar Bidarkar <kbidarka>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.0.2CC: cwelton, dcleal, jmagen, jmontleo, kbidarka, mmccune, ohadlevy, tkolhar
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/3664
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-11 12:23:51 UTC Type: Bug
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: 1107327    
Bug Blocks:    
Attachments:
Description Flags
promotion of cv possible with ks repo removed. none

Description Justin Sherrill 2013-11-14 17:46:46 UTC
Description of problem:

When attempting to promote a content view that no longer has a kickstart tree (distribution) that is in use by a host or hostgroup, an error will occur:

422 Unprocessable Entity

Version-Release number of selected component (if applicable):
mdp2

How reproducible:
always

Steps to Reproduce:
1.  Create/sync a repo with a distribution
2.  Create a new content view definition
3.  add distribution repo to it
4.  Publish content view
5.  Promote it to a next environment (DEV)
6.  Assign a host or hostgroup to the new distribution/install media in foreman
6.  Remove repo with distribution from the content view definition
7.  Re-publish definition
8.  Promote the new view version to DEV


Actual results:
Error, operating system is not deleted.

Expected results:
Hosts and Host Groups are un-associated to the operating system and the operating system is deleted.

Additional info:

Current work around is to unassociate that install media from any host or host groups in foreman and re-try the promotion.


Error in foreman:

    Started DELETE "/foreman/api/media/14" for 127.0.0.1 at 2013-11-08 16:54:00 -0500
    Processing by Api::V1::MediaController#destroy as JSON
      Parameters: {"id"=>"14", "medium"=>{}}
    Authorized user admin(Admin User)
    You may not destroy Mosaic/Development/Desktop Fedora Fedora 19 x86_64 as it is in use!
    Unprocessable entity Medium (id: 14):
      Mosaic/Development/Desktop Fedora Fedora 19 x86_64 is used by Desktop
     
      Rendered api/v1/errors/unprocessable_entity.json.rabl (1.4ms)
    Completed 422 Unprocessable Entity in 54ms (Views: 2.6ms | ActiveRecord: 34.7ms)

Comment 1 Justin Sherrill 2013-11-14 17:47:59 UTC
ideally foreman would just drop those association and let us delete it when we try to.

Comment 3 Dominic Cleal 2013-11-15 10:02:22 UTC
(In reply to Justin Sherrill from comment #0)
> Actual results:
> Error, operating system is not deleted.
> 
> Expected results:
> Hosts and Host Groups are un-associated to the operating system and the
> operating system is deleted.
> 
> Additional info:
> 
> Current work around is to unassociate that install media from any host or
> host groups in foreman and re-try the promotion.

Can I clarify here whether Katello is also deleting the operating system resource as well as the installation media?

I can see the logic in deleting the install media (and that's what the error's about) but I don't think the OS should be deleted if there are hosts still using it - since we'd only recreate it, but without all of the useful associations the old one would have had.

Comment 4 Justin Sherrill 2013-11-15 13:15:57 UTC
Apologies, this is just about install media, not operating systems.  Agreed, OS shouldn't be deleted.  

Any line where i mention Operating system, i meant install media.

Comment 6 Mike McCune 2014-06-16 21:22:57 UTC
This depends on 1107327, move ON_QA when that one is testable

Comment 7 Bryan Kearney 2014-07-15 14:01:31 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/3664 has been closed
-------------
Dominic Cleal
https://github.com/theforeman/foreman/pull/1575
-------------
Joseph Magen
Applied in changeset commit:08d248fc303ec19f25fbf4f8d353ff09cd325697.

Comment 10 Kedar Bidarkar 2014-08-27 10:59:46 UTC
Created attachment 931392 [details]
promotion of cv possible with ks repo removed.

Comment 11 Kedar Bidarkar 2014-08-27 11:02:02 UTC
Tested with Sat6-GA-snap6-compose3


Installed Packages

    candlepin-0.9.23-1.el6_5.noarch
    candlepin-common-1.0.1-1.el6_5.noarch
    candlepin-scl-1-5.el6_4.noarch
    candlepin-scl-quartz-2.1.5-5.el6_4.noarch
    candlepin-scl-rhino-1.7R3-1.el6_4.noarch
    candlepin-scl-runtime-1-5.el6_4.noarch
    candlepin-selinux-0.9.23-1.el6_5.noarch
    candlepin-tomcat6-0.9.23-1.el6_5.noarch
    createrepo-0.9.9-21.2.pulp.el6sat.noarch
    elasticsearch-0.90.10-6.el6sat.noarch
    katello-1.5.0-29.el6sat.noarch
    katello-certs-tools-1.5.6-1.el6sat.noarch
    katello-default-ca-1.0-1.noarch
    katello-installer-0.0.61-1.el6sat.noarch
    katello-server-ca-1.0-1.noarch
    m2crypto-0.21.1.pulp-10.el6sat.x86_64
    mod_wsgi-3.4-1.pulp.el6sat.x86_64
    pulp-katello-0.3-3.el6sat.noarch
    pulp-nodes-common-2.4.0-0.30.beta.el6sat.noarch
    pulp-nodes-parent-2.4.0-0.30.beta.el6sat.noarch
    pulp-puppet-plugins-2.4.0-0.30.beta.el6sat.noarch
    pulp-puppet-tools-2.4.0-0.30.beta.el6sat.noarch
    pulp-rpm-plugins-2.4.0-0.30.beta.el6sat.noarch
    pulp-selinux-2.4.0-0.30.beta.el6sat.noarch
    pulp-server-2.4.0-0.30.beta.el6sat.noarch
    python-gofer-qpid-1.3.0-1.el6sat.noarch
    python-isodate-0.5.0-1.pulp.el6sat.noarch
    python-kombu-3.0.15-12.pulp.el6sat.noarch
    python-pulp-bindings-2.4.0-0.30.beta.el6sat.noarch
    python-pulp-common-2.4.0-0.30.beta.el6sat.noarch
    python-pulp-puppet-common-2.4.0-0.30.beta.el6sat.noarch
    python-pulp-rpm-common-2.4.0-0.30.beta.el6sat.noarch
    python-qpid-0.22-14.el6sat.noarch
    python-qpid-qmf-0.22-37.el6.x86_64
    qpid-cpp-client-0.22-42.el6.x86_64
    qpid-cpp-server-0.22-42.el6.x86_64
    qpid-cpp-server-linearstore-0.22-42.el6.x86_64
    qpid-java-client-0.22-6.el6.noarch
    qpid-java-common-0.22-6.el6.noarch
    qpid-proton-c-0.7-1.el6.x86_64
    qpid-qmf-0.22-37.el6.x86_64
    qpid-tools-0.22-12.el6.noarch
    ruby193-rubygem-katello-1.5.0-85.el6sat.noarch
    rubygem-hammer_cli_katello-0.0.4-14.el6sat.noarch
    rubygem-smart_proxy_pulp-1.0.1-1.1.el6sat.noarch

Comment 12 Bryan Kearney 2014-09-11 12:23:51 UTC
This was delivered with Satellite 6.0 which was released on 10 September 2014.