Bug 1265665

Summary: Hammer content-view remove-version not working, always duplicate numbers
Product: Red Hat Satellite Reporter: Peter Vreman <peter.vreman>
Component: HammerAssignee: Katello Bug Bin <katello-bugs>
Status: CLOSED NOTABUG QA Contact: sthirugn <sthirugn>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.1.2CC: jsherril, peter.vreman, sthirugn
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-10-02 10:03:54 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:    
Bug Blocks: 1122832    
Attachments:
Description Flags
Hammer debug output of content-view remove-version none

Description Peter Vreman 2015-09-23 12:45:57 UTC
Created attachment 1076217 [details]
Hammer debug output of content-view remove-version

Description of problem:
Hammer content-view remove-version is not working, because it finds duplicate version numbers.

[ERROR 2015-09-23 12:40:59 Exception] Error: content_view_version found more than once
Could not remove version:
  Error: content_view_version found more than once
[ERROR 2015-09-23 12:40:59 Exception]


The reason is that hammer queries all content-view-versions having a value provided by --content-view-version without filtering on the provided --name parameter

See the attached output of hammer --debug for details

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


How reproducible:


Steps to Reproduce:
1. Create 4 ContentViews A,B,C and D
2. Publish the 4 ContentViews 3 times
3. Delete content view version 1 of Content View A using Hammer

Actual results:
Content view version is not removed


Expected results:
Content view version is removed

Additional info:

Comment 2 sthirugn@redhat.com 2015-09-29 16:56:51 UTC
hammer> content-view create --name=cv1 --repository-ids=690 --organization-id=1
Content view created
hammer> content-view create --name=cv2 --repository-ids=690 --organization-id=1
Content view created
hammer> content-view create --name=cv3 --repository-ids=690 --organization-id=1
Content view created
hammer> content-view create --name=cv4 --repository-ids=690 --organization-id=1
Content view created
hammer> content-view publish --name=cv1 --organization-id=1
[........................................................] [100%]

hammer> content-view publish --name=cv1 --organization-id=1
[........................................................] [100%]

hammer> content-view publish --name=cv1 --organization-id=1
[........................................................] [100%]

hammer> content-view publish --name=cv2 --organization-id=1
[........................................................] [100%]

hammer> content-view publish --name=cv2 --organization-id=1
[........................................................] [100%]

hammer> content-view publish --name=cv2 --organization-id=1
[........................................................] [100%]

hammer> content-view publish --name=cv3 --organization-id=1
[........................................................] [100%]

hammer> content-view publish --name=cv3 --organization-id=1
[........................................................] [100%]

hammer> content-view publish --name=cv3 --organization-id=1
[........................................................] [100%]

hammer> content-view publish --name=cv4 --organization-id=1
[........................................................] [100%]

hammer> content-view publish --name=cv4 --organization-id=1
[........................................................] [100%]

hammer> content-view publish --name=cv4 --organization-id=1
[........................................................] [100%]

hammer> content-view version delete --version=1.0 --organization-id=1
Could not delete the content view:
  Error: content_view_version found more than once

hammer> content-view version delete --version=1.0 --organization-id=1 --content-view=cv1
[........................................................] [100%]

hammer> content-view version delete --id=424
[........................................................] [100%]

Comment 3 sthirugn@redhat.com 2015-09-29 16:59:19 UTC
@Peter:
Can you please paste the hammer command which you used to get this error?

You can see from my Comment 2 that the delete works in two scenarios. It failed only when I passed the version and did not pass the content view name.

Comment 4 Peter Vreman 2015-10-02 07:06:55 UTC
The issue was that i tried to use the command 'remove-version' instead of 'version delete' to delete a single contentviewversion of the contentview

hammer --debug -c /opt/hoici/etc/sat6/hammer-hoici.yaml content-view remove-version  --organization-id=3 --name='product-HOIPRODUCTS-1.1.0-ci' --content-view-version=4

I have created BZ1265686 for this confusing naming of 'remove-version' vs. 'version delete'

This case can be closed