Bug 756955

Summary: Not able to add package group to a template when two or more products are present in the template
Product: Red Hat Satellite Reporter: Sachin Ghai <sghai>
Component: APIAssignee: Tomas Strachota <tstrachota>
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.0.0CC: bkearney, lzap
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-22 18:08:50 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: 747354    

Description Sachin Ghai 2011-11-25 09:48:20 UTC
Description of problem:
Getting validation error while adding the package group:

katello> template update --name urtemplate --org ACME_Corporation --add_package_group "Administration Tools"
Updating the template, please wait... Validation failed: Package group 'Administration Tools' not found in the Locker environment


Version-Release number of selected component (if applicable):
[root@dhcp201-152 ~]# rpm -qa | grep katello
katello-glue-pulp-0.1.113-1.git.0.5033839.fc15.x86_64
katello-common-0.1.113-1.git.0.5033839.fc15.noarch
katello-cli-common-0.1.13-1.git.57.d40f3ce.fc15.noarch
katello-glue-candlepin-0.1.113-1.git.0.5033839.fc15.x86_64
katello-configure-0.1.18-1.git.0.fc26262.fc15.noarch
katello-glue-foreman-0.1.113-1.git.0.5033839.fc15.x86_64
katello-all-0.1.113-1.git.0.5033839.fc15.x86_64
katello-cli-0.1.13-1.git.57.d40f3ce.fc15.noarch
katello-repos-0.1.3-1.git.1228.e56fa5b.fc15.noarch
katello-0.1.113-1.git.0.5033839.fc15.x86_64
[root@dhcp201-152 ~]# 


How reproducible:
always

Steps to Reproduce:
1. create two products say 1) pulp 2) rhel6 and create repos 
2. sync the products
3. create  template
4. add products like first pulp and then rhel6
5. the add Add_package_group
  
Actual results:
Updating the template, please wait... Validation failed: Package group 'Administration Tools' not found in the Locker environment

Expected results:
package group should be added successfully

Additional info:

production.log
==============

[root@dhcp201-152 ~]# tail -f /var/log/katello/production.log
ActiveRecord::RecordInvalid
base: Package group 'Administration Tools' not found in the Locker environment
Rendered text template (0.0ms)
Completed 400 Bad Request in 906ms (Views: 0.7ms | ActiveRecord: 5.6ms)

steps taken:
=============


katello> template create --name=urtemplate --org=ACME_Corporation Successfully created template [ urtemplate ]

katello> template update --name urtemplate --org ACME_Corporation --add_product pulp
Successfully updated template [ urtemplate ]

katello> template update --name urtemplate --org ACME_Corporation add_product rhel6
Successfully updated template [ urtemplate ]
katello> template update --name urtemplate --org ACME_Corporation add_distribution "ks-Red Hat Enterprise Linux-Server-6.1-x86_64"
Successfully updated template [ urtemplate ]
katello> template update --name urtemplate --org ACME_Corporation --add_package_group "Administration Tools"
Updating the template, please wait... Validation failed: Package group 'Administration Tools' not found in the Locker environment

Comment 1 Lukas Zapletal 2011-11-25 09:49:57 UTC
FYI I think we are missing one option in the 

katello template update --name lzap --org ACME_Corporation --add_anything xxx

command. And it is

-- product xxxx

because the CLI dont know from which product it should add the element (package, group, etc).

Comment 2 Tomas Strachota 2012-01-06 13:48:46 UTC
I believe that we don't want to require a product from which the packages should come from. In the template we only define what packages we want to be installed and don't care where they come from. Therefore no option --product is needed.

Comment 3 Tomas Strachota 2012-01-09 13:12:56 UTC
I tried the described scenario but didn't manage to make it fail. It either returns a correct error message when the package group is not in any of the repos or adds the group.

Tested with katello 0.1.170-1

Comment 4 Sachin Ghai 2012-01-18 11:57:16 UTC
Verified with following katello build:

[root@dhcp201-176 ~]# rpm -qa | grep katello
katello-glue-candlepin-0.1.178-1.el6.noarch
katello-trusted-ssl-cert-1.0-1.noarch
katello-common-0.1.178-1.el6.noarch
katello-httpd-ssl-key-pair-1.0-1.noarch
katello-repos-testing-0.1.5-1.el6.noarch
katello-cli-0.1.35-1.el6.noarch
katello-0.1.178-1.el6.noarch
katello-configure-0.1.53-1.el6.noarch
katello-glue-pulp-0.1.178-1.el6.noarch
katello-qpid-broker-key-pair-1.0-1.noarch
katello-cli-common-0.1.35-1.el6.noarch
katello-certs-tools-1.0.2-1.el6.noarch
katello-all-0.1.178-1.el6.noarch
katello-glue-foreman-0.1.178-1.el6.noarch
katello-repos-0.1.5-1.el6.noarch

I can add package group to a template when multiple products were present. Earlier I was using wrong package group name.

Verified with following steps:
========================

katello> template create --name urtemplate --org sghai_org
Successfully created template [ urtemplate ]

Added 'pulp' product first
============================
katello> template update --name urtemplate --org sghai_org --add_product pulp
Successfully updated template [ urtemplate ]

Added 'RHEL'
============
katello> template update --name urtemplate --org sghai_org --add_product "Red Hat Enterprise Linux Server"
Successfully updated template [ urtemplate ]

katello> template update --name urtemplate --org sghai_org --add_distribution "ks-Red Hat Enterprise Linux-Server-6.2-x86_64"
Successfully updated template [ urtemplate

katello> template update --name urtemplate --org sghai_org --add_package_group "Additional Development"
Successfully updated template [ urtemplate ]

katello> template update --name urtemplate --org sghai_org --add_package_group "Backup Client"
Successfully updated template [ urtemplate ]