Bug 799486 - Unable to add distribution to changeset - Validation failed: Repository of the distribution <foo> has not been promoted into the target environment
Unable to add distribution to changeset - Validation failed: Repository of th...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Satellite 6
Classification: Red Hat
Component: API (Show other bugs)
6.0.1
Unspecified Unspecified
unspecified Severity high (vote)
: Unspecified
: --
Assigned To: Ivan Necas
Og Maciel
: Reopened, Triaged
Depends On:
Blocks: 798737
  Show dependency treegraph
 
Reported: 2012-03-02 13:13 EST by James Laska
Modified: 2014-09-18 11:32 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-08-22 14:30:02 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
katello-debug-20120302130651.tar.gz (1.35 MB, application/x-gzip)
2012-03-02 13:13 EST, James Laska
no flags Details
bad distro promotion script (1.06 KB, application/x-shellscript)
2012-03-08 11:43 EST, Ivan Necas
no flags Details
good distro promotion script (1.06 KB, application/x-shellscript)
2012-03-08 11:43 EST, Ivan Necas
no flags Details

  None (edit)
Description James Laska 2012-03-02 13:13:26 EST
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 13:24:08 EST
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 03:58:15 EST

*** This bug has been marked as a duplicate of bug 798737 ***
Comment 4 James Laska 2012-03-05 08:25:43 EST
Re-opening to draw attention to the problem reported in comment#1
Comment 8 Ivan Necas 2012-03-08 11:41:32 EST
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 11:43:30 EST
Created attachment 568694 [details]
bad distro promotion script
Comment 10 Ivan Necas 2012-03-08 11:43:56 EST
Created attachment 568695 [details]
good distro promotion script
Comment 11 Og Maciel 2012-03-08 20:06:56 EST
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 07:31:39 EDT
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 07:32:11 EDT
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 08:25:55 EDT
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 13:55:34 EDT
getting rid of 6.0.0 version since that doesn't exist

Note You need to log in before you can comment on or make changes to this bug.