Bug 1343006

Summary: content view filter cannot be created
Product: Red Hat Satellite Reporter: Oleksandr Shtaier <oshtaier>
Component: HammerAssignee: Zach Huntington-Meath <zhunting>
Status: CLOSED ERRATA QA Contact: Roman Plevka <rplevka>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: bbuckingham, rplevka
Target Milestone: UnspecifiedKeywords: Regression, TestBlocker, Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
URL: http://projects.theforeman.org/issues/15395
Whiteboard:
Fixed In Version: rubygem-hammer_cli_katello-0.0.22.18-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:01:02 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: 1353471    
Bug Blocks: 1228890    

Description Oleksandr Shtaier 2016-06-06 10:22:10 UTC
Description of problem:
When I try to create new content view filter I am getting:
Could not create the filter:
  One of parameters [ organization_id ] required but not specified.

But organization-id was actually specified. For example:
>hammer -v -u user -p pass --output=csv content-view filter create --name="my_name" --inclusion="false" --repositories="zAlZrFsZGeQJvvK" --content-view-id="1748" --organization-id="1730" --type="rpm"

Just in case, chosen organization is a valid one:
>hammer -u user -p pass organization info --id 1730
Id:                     1730
Name:                   bHLGgI
Users:                  

Smart proxies:          
    liJQg0FLPr
Subnets:
...

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

How reproducible:
Always

Steps to Reproduce:
1. Create new organization
2. Create new product for that organization
3. Create yum repository for that product
4. Sync that repo
5. Create new content view for that organization
6. Add repository to content view
7. Try to use command that was used in example above

Actual results:
Unexpected error is raised

Expected results:
Content view filter is created successfully

Additional info:

Comment 1 Oleksandr Shtaier 2016-06-06 11:01:56 UTC
It seems that it is more related to all content view sub-commands

hammer -v -u user -p admin --output=csv content-view add-repository --organization-id="1731" --product="dxtZjHsVVJTsFOjCkvBY" --name="cSbGOWdXXf" --repository="xKQRUAyqdpgawck"

Comment 2 Oleksandr Shtaier 2016-06-06 11:03:05 UTC
Gives next error:

[ERROR 2016-06-06 06:49:28 Exception] One of parameters [ organization_id ] required but not specified.
Could not add repository:
  One of parameters [ organization_id ] required but not specified.

Comment 5 Roman Plevka 2016-06-07 08:14:31 UTC
WORKAROUND:

use --repository-ids or --product-id instead of --repositories and --product.
The error is actually related to these as the names of the ARs are not necessary unique across the orgs so it requires org-id to specify and this option is missing.
using the *-id[s] parameter uniquely specifies the AR.

Comment 6 Roman Plevka 2016-06-07 08:16:46 UTC
There are occurrences of this error in other subcommands too:
BZ #1309107
Setting it as related.

Comment 7 Oleksandr Shtaier 2016-06-07 09:37:10 UTC
Yes, it seems these defects are related. Of course, mentioned BZ #1309107 showed its behavior a long time ago, but current one only week ago. There is a chance that it was probably blocked by other defects and was unblocked recently.

Comment 8 Oleksandr Shtaier 2016-06-07 10:00:06 UTC
However, not exactly:

hammer -v -u admin -p changeme --output=csv content-view add-repository --organization="lpxKT2" --product="hDcByfFuRzICPjBkcjyR" --name="fDLiyTuHAP" --repository="agJQoVHXmGNCLaB"

[ERROR 2016-06-07 05:56:27 Exception] One of parameters [ organization_id ] required but not specified.
Could not add repository:
  One of parameters [ organization_id ] required but not specified.
[ERROR 2016-06-07 05:56:27 Exception] 
RestClient::ResourceNotFound (404 Resource Not Found)

Providing organization instead organization-id doesn't resolve the issue

Comment 9 Oleksandr Shtaier 2016-06-07 10:12:19 UTC
Same for upload content:
hammer -v -u admin -p changeme --output=csv repository upload-content --organization="L4e1n3" --product-id="784" --name="FeLSCgiipuJArpt" --path="/tmp/which-2.19-6.el6.x86_64.rpm"

[ERROR 2016-06-07 06:10:52 Exception] One of parameters [ organization_id ] required but not specified.
Could not upload the content:
  One of parameters [ organization_id ] required but not specified.

Comment 10 Zach Huntington-Meath 2016-06-13 20:37:11 UTC
Created redmine issue http://projects.theforeman.org/issues/15395 from this bug

Comment 11 Bryan Kearney 2016-06-27 18:15:33 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/15395 has been closed

Comment 12 Roman Plevka 2016-07-11 12:34:18 UTC
VERIFIED
on sat6.2 snap19.1

The organization-id is correctly being picked up

# hammer --csv -u admin -p changeme content-view filter create --name="foo_filter_1" --inclusion="false" --repositories="foo_repo_1" --content-view-id 4 --organization foo_org_2 --type="rpm"
Message,Id,Name
Filter created,1,foo_filter_1

Comment 13 Bryan Kearney 2016-07-27 11:01:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1501