Bug 1420652

Summary: hammer can delete CV in used CCV without warning
Product: Red Hat Satellite Reporter: Roman Bobek <rbobek>
Component: Content ViewsAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED WONTFIX QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: 6.2.7CC: bbuckingham, dhlavacd, jcallaha, mhulan, omaciel, tstrachota
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-09-04 18:04:47 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:

Description Roman Bobek 2017-02-09 07:55:11 UTC
Description of problem:
It is possible to delete CV in used CCV with hammer... without any warning.


How reproducible:
Always


Steps to Reproduce:

- create content view 
  # hammer content-view create --name rhtestinc_pup --label rhtestinc_pup 

- create composite content view
 # hammer content-view create --composite --name ccv_rhtestinc3 --name ccv_rhtestinc3

# hammer content-view list

CONTENT VIEW ID | NAME                      | LABEL                     | COMPOSITE | REPOSITORY I
----------------|---------------------------|---------------------------|-----------|-------------
29              | rhtestinc_pup             | rhtestinc_pup             |           |

32              | ccv_rhtestinc3            | ccv_rhtestinc3            | true      |

----------------|---------------------------|---------------------------|-----------|------------------


- Create version 1.0 of content view with 2 puppet modules 
# hammer puppet-module list  --repository-id 910
---|------|--------|---------|-------------------------------------
ID | NAME | AUTHOR | VERSION | UUID
---|------|--------|---------|-------------------------------------
88 | web1 | rhtest | 1.0.2   | e7cd75b6-35b7-47e5-93d0-07f2ac93c2aa
87 | app1 | rhtest | 1.0.3   | 8eb22528-4604-4cf6-9de4-b8dbff4ba366
86 | web1 | rhtest | 1.0.3   | 737c1bdb-64f7-4922-8082-e25fa4a871f4
85 | app1 | rhtest | 1.0.0   | 5ea24a76-b361-4430-8289-3baac50fc1bf
84 | web1 | rhtest | 1.0.0   | 142bbd0b-54ee-4560-b78c-89a347dbddf6
83 | app1 | rhtest | 1.0.2   | 02449387-7e84-4151-8d87-ca0343563417
---|------|--------|---------|-------------------------------------

# hammer content-view puppet-module add --uuid 5ea24a76-b361-4430-8289-3baac50fc1bf --content-view-id 29 
# hammer content-view puppet-module add --uuid 142bbd0b-54ee-4560-b78c-89a347dbddf6 --content-view-id 29 
# hammer content-view publish --id 29 
# hammer content-view version list --content-view-id 29
---|-------------------|---------|-----------------------
ID | NAME              | VERSION | LIFECYCLE ENVIRONMENTS
---|-------------------|---------|-----------------------
68 | rhtestinc_pup 1.0 | 1.0     | Library
---|-------------------|---------|-----------------------

- create version 1.0 of the composite content view containing v1.0 of rhtestinc_pup CV

# hammer content-view add-version --content-view-version-id 68 --id 32 
# hammer content-view publish --id 32 

# hammer content-view version list --content-view-id 32
---|--------------------|---------|-----------------------
ID | NAME               | VERSION | LIFECYCLE ENVIRONMENTS
---|--------------------|---------|-----------------------
70 | ccv_rhtestinc3 1.0 | 1.0     | Library
---|--------------------|---------|------------------

- Promote ccv_rhtestinc3 to all lifecycle environments (Library->dev->qa->prod)
# hammer content-view version promote --content-view-id 32 --from-lifecycle-environment Library --to-lifecycle-environment dev
# hammer content-view version promote --content-view-id 32 --from-lifecycle-environment dev --to-lifecycle-environment qa
# hammer content-view version promote --content-view-id 32 --from-lifecycle-environment qa --to-lifecycle-environment prod


- Create a new version of rhtestinc_pup CV with one updated puppet module (app1 1.0.0 -> app1 1.0.2) . Publish that .
# hammer content-view puppet-module remove --uuid 5ea24a76-b361-4430-8289-3baac50fc1bf --content-view-id 29 
# hammer content-view puppet-module add --uuid 02449387-7e84-4151-8d87-ca0343563417 --content-view-id 29 
# hammer content-view publish --id 29 
# hammer content-view version list --content-view-id 29
---|-------------------|---------|-----------------------
ID | NAME              | VERSION | LIFECYCLE ENVIRONMENTS
---|-------------------|---------|-----------------------
71 | rhtestinc_pup 2.0 | 2.0     | Library
68 | rhtestinc_pup 1.0 | 1.0     |
---|-------------------|---------|-----------------------


- Create a new version of the ccv_rhtestinc3 which contains rhtestinc_pup 2.0 . Publish that and promote it to dev and qa.
# hammer content-view remove-version --content-view-version-id 68 --id 32 
# hammer content-view add-version --content-view-version-id 71 --id 32 
# hammer content-view publish --id 32 
# hammer content-view version promote --content-view-id 32 --from-lifecycle-environment Library --to-lifecycle-environment dev 
# hammer content-view version promote --content-view-id 32 --from-lifecycle-environment dev --to-lifecycle-environment qa 

So now the setup is the following:
Library:   ccv_rhtestinc3 2.0   (consists of  rhtestinc_pup 2.0)
dev:   ccv_rhtestinc3 2.0   (consists of  rhtestinc_pup 2.0)
qa:     ccv_rhtestinc3 2.0   (consists of  rhtestinc_pup 2.0)
prod: ccv_rhtestinc3 1.0   (consists of  rhtestinc_pup 1.0)

- Push a incremental update , the web1 puppet module must be updated everywhere.

# hammer content-view version incremental-update --puppet-module-ids e7cd75b6-35b7-47e5-93d0-07f2ac93c2aa --content-view-version-id 71 --lifecycle-environment-ids=1 -
-propagate-all-composites yes
[....................................................................................................................................................................................] [100%]
Content View: rhtestinc_pup version 2.1
Added Content:
  Puppet Modules:
        rhtest-web1-1.0.2

Content View: ccv_rhtestinc3 version 2.1
Added Content:
  Puppet Modules:
        rhtest-web1-1.0.2

# hammer content-view version incremental-update --puppet-module-ids e7cd75b6-35b7-47e5-93d0-07f2ac93c2aa --content-view-version-id 68 --propagate-all-composites yes
[..................................................................................................................................................................................
..] [100%]
Content View: rhtestinc_pup version 1.1
Added Content:
  Puppet Modules:
        rhtest-web1-1.0.2

Content View: ccv_rhtestinc3 version 1.1
Added Content:
  Puppet Modules:
        rhtest-web1-1.0.2

# hammer content-view version list --content-view-id 29
---|-------------------|---------|-----------------------
ID | NAME              | VERSION | LIFECYCLE ENVIRONMENTS
---|-------------------|---------|-----------------------
73 | rhtestinc_pup 2.1 | 2.1     | Library
71 | rhtestinc_pup 2.0 | 2.0     |
75 | rhtestinc_pup 1.1 | 1.1     |
68 | rhtestinc_pup 1.0 | 1.0     |
---|-------------------|---------|-----------------------
# hammer content-view version list --content-view-id 32
---|--------------------|---------|-----------------------
ID | NAME               | VERSION | LIFECYCLE ENVIRONMENTS
---|--------------------|---------|-----------------------
74 | ccv_rhtestinc3 2.1 | 2.1     | Library, dev, qa
72 | ccv_rhtestinc3 2.0 | 2.0     |
77 | ccv_rhtestinc3 1.1 | 1.1     | prod
70 | ccv_rhtestinc3 1.0 | 1.0     |
---|--------------------|---------|-----------------------

- At this time I can remove rhtestinc_pup 1.1 without any warning.

# hammer content-view version delete --content-view-id 29 --id 75 
[....................................................................................................................................................................................] [100%]


Actual results:
The CV is removed without warning.


Expected results:
Hammer should give at least warning, that the CV is used in CCV.

Comment 3 Bryan Kearney 2018-09-04 18:04:47 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and we do not expect this to be implemented in the product in the foreseeable future. We are therefore closing this out as WONTFIX. If you have any concerns about this, please feel free to contact Rich Jerrido or Bryan Kearney. Thank you.