Bug 799486

Summary: Unable to add distribution to changeset - Validation failed: Repository of the distribution <foo> has not been promoted into the target environment
Product: Red Hat Satellite Reporter: James Laska <jlaska>
Component: APIAssignee: Ivan Necas <inecas>
Status: CLOSED CURRENTRELEASE QA Contact: Og Maciel <omaciel>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.0.1CC: bkearney, inecas, jturner, mmccune, omaciel
Target Milestone: UnspecifiedKeywords: Reopened, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-22 18:30:02 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: 798737    
Attachments:
Description Flags
katello-debug-20120302130651.tar.gz
none
bad distro promotion script
none
good distro promotion script none

Description James Laska 2012-03-02 18:13:26 UTC
Created attachment 567124 [details]
katello-debug-20120302130651.tar.gz

Description of problem:

Attempting to add a distribution to a changeset fails.  The failure message is similar to that in bug#798737, but the reproducer is different.

undefined method `errata_id' for #<ChangesetDistribution:0x7f0cc730ac70>

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

 * candlepin-0.5.23-1.el6.src.rpm
 * katello-0.1.301-2.el6.src.rpm
 * katello-candlepin-cert-key-pair-1.0-1.src.rpm
 * katello-certs-tools-1.0.3-1.el6.src.rpm
 * katello-cli-0.1.100-2.el6.src.rpm
 * katello-configure-0.1.101-1.el6.src.rpm
 * katello-qpid-broker-key-pair-1.0-1.src.rpm
 * katello-qpid-client-key-pair-1.0-1.src.rpm
 * katello-selinux-0.1.8-1.el6.src.rpm
 * pulp-1.0.0-4.el6.src.rpm

How reproducible:


Steps to Reproduce:

# katello -u admin -p admin changeset create --name "02 - rht repos"
Successfully created changeset [ 02 - rht repos ] for environment [ Stage ]

# katello -u admin -p admin changeset update --name "02 - rht repos" --add_product "Red Hat Enterprise Linux Server"
Successfully updated changeset [ 02 - rht repos ]

# katello -u admin -p admin changeset update --name "02 - rht repos" --add_product "Red Hat CloudForms"
Successfully updated changeset [ 02 - rht repos ]

# katello -u admin -p admin changeset update --name "02 - rht repos" --from_product "Red Hat Enterprise Linux Server" --add_distribution "ks-Red Hat Enterprise Linux-Server-6.2-i386"


Actual results:

undefined method `errata_id' for #<ChangesetDistribution:0x7f0cc730ac70>

Expected results:

Successfully updated changeset [ 02 - rht repos ]

Additional info:

Comment 1 James Laska 2012-03-02 18:24:08 UTC
After applying the commit used to fix bug#798737 ... this prevents adding a distribution to a changeset 

> # katello -u admin -p admin changeset update --name "02 - rht repos" --from_product "Red Hat Enterprise Linux Server" --add_distribution "ks-Red Hat Enterprise Linux-Server-6.2-i386"
> Validation failed: Repository of the distribution 'ks-Red Hat Enterprise Linux-Server-6.2-i386' has not been promoted into the target environment!

This error doesn't make sense.  I know the distribution hasn't been promoted, that's why I'm adding it to a changeset for promotion.

Comment 3 Ivan Necas 2012-03-05 08:58:15 UTC

*** This bug has been marked as a duplicate of bug 798737 ***

Comment 4 James Laska 2012-03-05 13:25:43 UTC
Re-opening to draw attention to the problem reported in comment#1

Comment 8 Ivan Necas 2012-03-08 16:41:32 UTC
I could not reproduce this issue. When trying this scenario (see also "good distro promotion" attached script):

1. create org, env, product, 2 repos
2. promote product
3. synchronized repos (to get new distros, that were not in promoted repo before)
4. promote only a distribution

Really, only the distribution (including image files) was promoted

The only case, when I got the message "{distro} has not been promoted into the target environment" was in this scenario (see also "bad distro promotion" attached script):

1. create org, env, product, 1 repo
2. promote product
3. create second repo, with distro, synchronize
4. create a changeset with that distro

Now you see the message, but it is correct, because the repository really was not promoted. And when you promote the whole repository, you get the distro with it. So I thing this is correct behavior as well

It seems like some inconsistency in Pulp db might cause this problem, but it's really hard to reproduce

Comment 9 Ivan Necas 2012-03-08 16:43:30 UTC
Created attachment 568694 [details]
bad distro promotion script

Comment 10 Ivan Necas 2012-03-08 16:43:56 UTC
Created attachment 568695 [details]
good distro promotion script

Comment 11 Og Maciel 2012-03-09 01:06:56 UTC
Validated:
* candlepin-0.5.24-1.el6.noarch
* candlepin-tomcat6-0.5.24-1.el6.noarch
* katello-0.1.303-1.el6.noarch
* katello-all-0.1.303-1.el6.noarch
* katello-candlepin-cert-key-pair-1.0-1.noarch
* katello-certs-tools-1.0.4-1.el6.noarch
* katello-cli-0.1.102-1.el6.noarch
* katello-cli-common-0.1.102-1.el6.noarch
* katello-common-0.1.303-1.el6.noarch
* katello-configure-0.1.104-1.el6.noarch
* katello-glue-candlepin-0.1.303-1.el6.noarch
* katello-glue-foreman-0.1.303-1.el6.noarch
* katello-glue-pulp-0.1.303-1.el6.noarch
* katello-qpid-broker-key-pair-1.0-1.noarch
* katello-qpid-client-key-pair-1.0-1.noarch
* katello-selinux-0.1.8-1.el6.noarch
* pulp-1.0.0-4.el6.noarch
* pulp-common-1.0.0-4.el6.noarch
* pulp-selinux-server-1.0.0-4.el6.noarch

Comment 12 James Laska 2012-03-20 11:31:39 UTC
After this fix, I'm unable to add a distribution to a changeset.  While I no longer see the originally reported failure ... I now am preventing from adding a distro to a changeset.

This makes the '--add_distribution' option to the 'changeset update' command not useful.

katello -u admin -p admin changeset create --name "02 - rht repos"
Successfully created changeset [ 02 - rht repos ] for environment [ Stage ]

katello -u admin -p admin changeset update --name "02 - rht repos" --add_product "Red Hat Enterprise Linux Server"
Successfully updated changeset [ 02 - rht repos ]

katello -u admin -p admin changeset update --name "02 - rht repos" --add_product "Red Hat CloudForms"
Successfully updated changeset [ 02 - rht repos ]

katello -u admin -p admin changeset update --name "02 - rht repos" --from_product "Red Hat Enterprise Linux Server" --add_distribution "ks-Red Hat Enterprise Linux-Server-6.2-i386"
Validation failed: Repository of the distribution 'ks-Red Hat Enterprise Linux-Server-6.2-i386' has not been promoted into the target environment!

katello -u admin -p admin changeset update --name "02 - rht repos" --from_product "Red Hat Enterprise Linux Server" --add_distribution "ks-Red Hat Enterprise Linux-Server-6.2-x86_64" 
Validation failed: Repository of the distribution 'ks-Red Hat Enterprise Linux-Server-6.2-x86_64' has not been promoted into the target environment!

katello -u admin -p admin changeset update --name "02 - rht repos" --from_product "Red Hat Enterprise Linux Server" --add_distribution "ks-Red Hat Enterprise Linux Server-None-5.8-i386" 
Validation failed: Repository of the distribution 'ks-Red Hat Enterprise Linux Server-None-5.8-i386' has not been promoted into the target environment!

katello -u admin -p admin changeset update --name "02 - rht repos" --from_product "Red Hat Enterprise Linux Server" --add_distribution "ks-Red Hat Enterprise Linux Server-None-5.8-x86_64" 
Validation failed: Repository of the distribution 'ks-Red Hat Enterprise Linux Server-None-5.8-x86_64' has not been promoted into the target environment!

Comment 13 James Laska 2012-03-20 11:32:11 UTC
Comment#12 was reproduced with the following versions ...
 * candlepin-0.5.26-1.el6.src.rpm
 * katello-0.1.304-1.el6.src.rpm
 * katello-candlepin-cert-key-pair-1.0-1.src.rpm
 * katello-certs-tools-1.0.4-1.el6.src.rpm
 * katello-cli-0.1.104-1.el6.src.rpm
 * katello-configure-0.1.104-1.el6.src.rpm
 * katello-qpid-broker-key-pair-1.0-1.src.rpm
 * katello-qpid-client-key-pair-1.0-1.src.rpm
 * katello-selinux-0.1.8-1.el6.src.rpm
 * pulp-1.0.0-4.el6.src.rpm

Comment 14 James Laska 2012-03-20 12:25:55 UTC
Discussed the issue from comment#12 with inecas on IRC.  I understand now that a distribution cannot be added to a changeset unless the associated repository is already promoted to the target environment.

However, seems there may be room for the 'changeset update --add_distribution' command to check whether the repository associated with the distribution is already included in the same changeset.

We'll track adjustments to that issue in bug#805002

Comment 16 Mike McCune 2013-08-16 17:55:34 UTC
getting rid of 6.0.0 version since that doesn't exist