Bug 1288148 - Satellite fails to propagate incremental updates to Composite Content views
Satellite fails to propagate incremental updates to Composite Content views
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: API (Show other bugs)
6.1.4
Unspecified Unspecified
unspecified Severity high (vote)
: Beta
: --
Assigned To: Brad Buckingham
Corey Welton
http://projects.theforeman.org/issues...
: PrioBumpQA, Regression, Triaged
Depends On:
Blocks: 1316897
  Show dependency treegraph
 
Reported: 2015-12-03 11:38 EST by Stuart Auchterlonie
Modified: 2016-07-27 05:00 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-07-27 05:00:12 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
production.log (13.62 KB, text/plain)
2016-02-04 17:24 EST, sthirugn@redhat.com
no flags Details

  None (edit)
Description Stuart Auchterlonie 2015-12-03 11:38:54 EST
Description of problem:

Customer is using the API to update puppet modules within a content view.

When attempting to update a composite content view with "propagate_all_composites":true set the API throws the error

{"displayMessage":"undefined local variable or method `version' for #<Katello::Api::V2::ContentViewVersionsController:0x0000000f0097b8>","errors":["undefined local variable or method `version' for #<Katello::Api::V2::ContentViewVersionsController:0x0000000f0097b8>"]}[root@nyclxrndsat6 tmp]#

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

6.1.4

How reproducible:

100%

Steps to Reproduce:
1. Using curl, fire an update request at the API

curl -k -H "Content-Type: application/json" -X POST -d  '{"description":"Testing incrementel update", "add_content":{"puppet_module_ids":["ae9a384e-e17b-458b-ac54-9868eee69d7a"]}, "propagate_all_composites":true, "content_view_version_environments":[{"environment_ids":["2","3","4"],"content_view_version_id":70}]}' -u 'admin:password' https://satellite.example.com/katello/api/content_view_versions/incremental_update


Actual results:

For a simple content view this work.
For a composite content view this throws the error

{"displayMessage":"undefined local variable or method `version' for #<Katello::Api::V2::ContentViewVersionsController:0x0000000f0097b8>","errors":["undefined local variable or method `version' for #<Katello::Api::V2::ContentViewVersionsController:0x0000000f0097b8>"]}[root@nyclxrndsat6 tmp]#


Expected results:

CCV is updated with the new puppet module.

Additional info:
Comment 3 David Caplan 2015-12-07 12:53:05 EST
According to my read of this feature, this BZ is a regression and should be treated as a higher priority
Comment 6 sthirugn@redhat.com 2016-02-04 16:54:15 EST
I see this same error when doing the same scenario using cli in Sat 6.1.7 build:

hammer > content-view version incremental-update --propagate-all-composites=true --content-view-version-id=6 --errata-ids=332520ff-2ba6-4503-83e6-eb5df4255f25 --environment--ids=2

An error occurred incrementally updating the content view:
  undefined local variable or method `version' for #<Katello::Api::V2::ContentViewVersionsController:0x007fdec9a97720>
Comment 9 sthirugn@redhat.com 2016-02-04 17:24 EST
Created attachment 1121227 [details]
production.log
Comment 11 Brad Buckingham 2016-03-18 16:42:49 EDT
Created redmine issue http://projects.theforeman.org/issues/14280 from this bug
Comment 12 Brad Buckingham 2016-03-18 16:51:08 EDT
Upstream katello PR: https://github.com/Katello/katello/pull/5900
Comment 16 Tazim Kolhar 2016-04-03 09:50:10 EDT
FAILEDQA:
# rpm -qa foreman
foreman-1.11.0.9-1.el7sat.noarch

Steps:


  # hammer -u admin -p changeme lifecycle-environment list --organization-id 1
    ---|---------|------
    ID | NAME    | PRIOR
    ---|---------|------
    1  | Library |      
    ---|---------|------


  # hammer -u admin -p changeme puppet-module list --organization-id=1
  ---|------|--------|---------|-------------------------------------
  ID | NAME | AUTHOR | VERSION | UUID                                
  ---|------|--------|---------|-------------------------------------
  1  | motd | saz    | 2.3.1   | e7bf24a3-cb2b-4156-a784-d5ad3556bb24
  ---|------|--------|---------|-------------------------------------

   # hammer -u admin -p changeme content-view version list
    ---|-------------------------------|---------|-----------------------
    ID | NAME                          | VERSION | LIFECYCLE ENVIRONMENTS
    ---|-------------------------------|---------|-----------------------
    5  | con_view 1.0                  | 1.0     | Library              
    4  | con_view_composite 1.0        | 1.0     | Library              
    3  | con_sub_view 1.0              | 1.0     | Library              
    1  | Default Organization View 1.0 | 1.0     | Library              
    ---|-------------------------------|---------|-----------------------
 
    # hammer -u admin -p changeme content-view version list --content-view con_sub_view --organization-id 1
     ---|------------------|---------|-----------------------
     ID | NAME             | VERSION | LIFECYCLE ENVIRONMENTS
     ---|------------------|---------|-----------------------
     3  | con_sub_view 1.0 | 1.0     | Library              
     ---|------------------|---------|-----------------------

    # hammer -u admin -p changeme content-view update --name con_view_composite --component-ids 3 --organization-id 1
    Content view updated

# curl -k -H "Content-Type: application/json" -X POST -d  '{"description":"Testing incrementel update", "add_content":{"puppet_module_ids":["e7bf24a3-cb2b-4156-a784-d5ad3556bb24"]}, "propagate_all_composites":true, "content_view_version_environments":[{"environment_ids":["1"],"content_view_version_id":3}]}' -u 'admin:changeme' https://hp-dl360g7-01.lab.eng.brq.redhat.com/katello/api/content_view_versions/incremental_update
  {"id":"1296bd73-abe9-41a9-b40b-6fbc9942a011","label":"Actions::Katello::ContentView::IncrementalUpdates","pending":true,"username":"admin","started_at":"2016-04-03 13:21:26 UTC","ended_at":null,"state":"planned","result":"pending","progress":0.0,"input":{"services_checked":["pulp","pulp_auth","candlepin","candlepin_auth"],"version_outputs":[{"version_id":9,"output":{"class":"Dynflow::ExecutionPlan::OutputReference","execution_plan_id":"c58f5fc3-1804-4239-aa5a-07b35bc4dc38","step_id":17,"action_id":2,"subkeys":[]}},{"version_id":10,"output":{"class":"Dynflow::ExecutionPlan::OutputReference","execution_plan_id":"c58f5fc3-1804-4239-aa5a-07b35bc4dc38","step_id":59,"action_id":25,"subkeys":[]}}],"locale":"en"},"output":{},"humanized":{"action":"Incremental Update","input":[],"output":"Incremental Update incomplete.","errors":[]},"cli_example":null}


The info command should show whether puppet module is updated to
composite view.

# hammer -u admin -p changeme content-view info --name con_view_composite --organization-id 1
ID:                     4
Name:                   con_view_composite
Label:                  con_view_composite
Composite:              true
Description:            
Content Host Count:     0
Organization:           Default Organization
Yum Repositories:       

Docker Repositories:    

OSTree Repositories:    

Puppet Modules:         

Lifecycle Environments: 
 1) ID:   1
    Name: Library
Versions:               
 1) ID:        4
    Version:   1.0
    Published: 2016/04/03 03:39:52
 2) ID:        10
    Version:   1.1
    Published: 2016/04/03 13:21:27
Components:             
 1) ID:   3
    Name: con_sub_view 1.0
Activation Keys:

As, we see puppet module is not listed in the info command 
this BZ is failing 

production.log details for updating the puppet module to composite view:
2016-04-03 15:21:26 [app] [I] Started POST "/katello/api/content_view_versions/incremental_update" for 2620:52:0:2220:3e4a:92ff:fef4:4314 at 2016-04-03 15:21:26 +0200
2016-04-03 15:21:26 [app] [I] Processing by Katello::Api::V2::ContentViewVersionsController#incremental_update as */*
2016-04-03 15:21:26 [app] [I]   Parameters: {"description"=>"Testing incrementel update", "add_content"=>{"puppet_module_ids"=>["e7bf24a3-cb2b-4156-a784-d5ad3556bb24"]}, "propagate_all_composites"=>true, "content_view_version_environments"=>[{"environment_ids"=>["1"], "content_view_version_id"=>3}], "api_version"=>"v2", "content_view_version"=>{"description"=>"Testing incrementel update"}}
2016-04-03 15:21:26 [app] [I] Authorized user admin(Admin User)
2016-04-03 15:21:27 [app] [I] Started POST "/foreman_tasks/api/tasks/bulk_search" for 10.10.62.185 at 2016-04-03 15:21:27 +0200
2016-04-03 15:21:27 [app] [I] Processing by ForemanTasks::Api::TasksController#bulk_search as JSON
2016-04-03 15:21:27 [app] [I]   Parameters: {"searches"=>[{"type"=>"task", "task_id"=>"6662bb04-41ff-4402-990b-83c091d37ec6", "search_id"=>"3"}], "task"=>{}}
2016-04-03 15:21:27 [app] [I] Completed 200 OK in 141ms (Views: 1.0ms | ActiveRecord: 2.5ms)
2016-04-03 15:21:27 [app] [I]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.12/app/views/katello/api/v2/common/async.json.rabl within katello/api/v2/layouts/resource (83.0ms)
2016-04-03 15:21:27 [app] [I] Completed 202 Accepted in 988ms (Views: 83.7ms | ActiveRecord: 59.4ms)
2016-04-03 15:21:29 [app] [I] Started POST "/foreman_tasks/api/tasks/bulk_search" for 10.10.62.185 at 2016-04-03 15:21:29 +0200
2016-04-03 15:21:29 [app] [I] Processing by ForemanTasks::Api::TasksController#bulk_search as JSON
2016-04-03 15:21:29 [app] [I]   Parameters: {"searches"=>[{"type"=>"task", "task_id"=>"6662bb04-41ff-4402-990b-83c091d37ec6", "search_id"=>"3"}], "task"=>{}}
2016-04-03 15:21:29 [app] [I] Completed 200 OK in 116ms (Views: 0.6ms | ActiveRecord: 1.3ms)
2016-04-03 15:21:31 [app] [I] Started POST "/foreman_tasks/api/tasks/bulk_search" for 10.10.62.185 at 2016-04-03 15:21:31 +0200
2016-04-03 15:21:31 [app] [I] Processing by ForemanTasks::Api::TasksController#bulk_search as JSON
2016-04-03 15:21:31 [app] [I]   Parameters: {"searches"=>[{"type"=>"task", "task_id"=>"6662bb04-41ff-4402-990b-83c091d37ec6", "search_id"=>"3"}], "task"=>{}}
2016-04-03 15:21:31 [app] [I] Completed 200 OK in 111ms (Views: 0.6ms | ActiveRecord: 1.0ms)
2016-04-03 15:21:33 [app] [I] Started POST "/foreman_tasks/api/tasks/bulk_search" for 10.10.62.185 at 2016-04-03 15:21:33 +0200
2016-04-03 15:21:33 [app] [I] Processing by ForemanTasks::Api::TasksController#bulk_search as JSON
2016-04-03 15:21:33 [app] [I]   Parameters: {"searches"=>[{"type"=>"task", "task_id"=>"6662bb04-41ff-4402-990b-83c091d37ec6", "search_id"=>"3"}], "task"=>{}}
2016-04-03 15:21:33 [app] [I] Completed 200 OK in 151ms (Views: 0.9ms | ActiveRecord: 1.0ms)
2016-04-03 15:21:35 [app] [I] Started POST "/foreman_tasks/api/tasks/bulk_search" for 10.10.62.185 at 2016-04-03 15:21:35 +0200
2016-04-03 15:21:35 [app] [I] Processing by ForemanTasks::Api::TasksController#bulk_search as JSON
2016-04-03 15:21:35 [app] [I]   Parameters: {"searches"=>[{"type"=>"task", "task_id"=>"6662bb04-41ff-4402-990b-83c091d37ec6", "search_id"=>"3"}], "task"=>{}}
2016-04-03 15:21:35 [app] [I] Completed 200 OK in 130ms (Views: 1.0ms | ActiveRecord: 1.4ms)
2016-04-03 15:21:37 [app] [I] Started POST "/foreman_tasks/api/tasks/bulk_search" for 10.10.62.185 at 2016-04-03 15:21:37 +0200
2016-04-03 15:21:37 [app] [I] Processing by ForemanTasks::Api::TasksController#bulk_search as JSON
2016-04-03 15:21:37 [app] [I]   Parameters: {"searches"=>[{"type"=>"task", "task_id"=>"6662bb04-41ff-4402-990b-83c091d37ec6", "search_id"=>"3"}], "task"=>{}}
2016-04-03 15:21:38 [app] [I] Completed 200 OK in 150ms (Views: 0.9ms | ActiveRecord: 1.9ms)
2016-04-03 15:21:39 [app] [I] Started GET "/katello/api/v2/content_view_versions/8" for 10.10.62.185 at 2016-04-03 15:21:39 +0200
2016-04-03 15:21:39 [app] [I] Processing by Katello::Api::V2::ContentViewVersionsController#show as JSON
2016-04-03 15:21:39 [app] [I]   Parameters: {"api_version"=>"v2", "id"=>"8"}
2016-04-03 15:21:39 [app] [I]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.12/app/views/katello/api/v2/content_view_versions/show.json.rabl within katello/api/v2/layouts/resource (181.0ms)
2016-04-03 15:21:39 [app] [I] Completed 200 OK in 189ms (Views: 167.7ms | ActiveRecord: 17.3ms)
Comment 17 Brad Buckingham 2016-04-04 16:45:54 EDT
Hi Tazim,

I just tested a similar scenario on my configuration and it works correctly.  I think the step where you are confirming the result using 'content-view info' may be incorrect, instead try with 'content-view version info'.  Can you take one more look to make sure that I am not missing something.  Thanks!

The following is an example from my config:

#
# Observe some initial data on lifecycle-environment, puppet-module and content-view version
#
hammer> lifecycle-environment list --organization-id 1
---|---------|--------
ID | NAME    | PRIOR  
---|---------|--------
3  | test    | dev    
4  | prod    | test   
1  | Library |        
2  | dev     | Library
---|---------|--------

hammer> puppet-module list --organization-id 1 --environment Library
---|------|------------|---------|-------------------------------------
ID | NAME | AUTHOR     | VERSION | UUID                                
---|------|------------|---------|-------------------------------------
4  | dns  | theforeman | 1.3.0   | fbca4c9d-9367-4648-9dad-990b65759e3d
3  | dhcp | theforeman | 1.3.0   | 86f9345e-7133-4b2a-8842-6be62ecd8eee
2  | dhcp | theforeman | 1.3.1   | 853a20c2-7927-46e8-9251-0cfcfe76ba23
1  | dns  | theforeman | 1.4.0   | 7ef59d64-7a91-4a28-98b3-7a3fcc318a0d
---|------|------------|---------|-------------------------------------

hammer> content-view version list --organization-id 1 --environment Library
---|-------------------------------|---------|-----------------------
ID | NAME                          | VERSION | LIFECYCLE ENVIRONMENTS
---|-------------------------------|---------|-----------------------
15 | composite 2.0                 | 2.0     | Library, dev          
13 | zoo view 1.0                  | 1.0     | Library               
12 | puppet view 1.0               | 1.0     | Library, dev          
3  | tools view 1.0                | 1.0     | Library               
1  | Default Organization View 1.0 | 1.0     | Library               
---|-------------------------------|---------|-----------------------

#
# Observe that puppet view 1.0 has module dns 1.3.0
#
hammer> content-view version info --organization-id 1 --environment Library --id 12
ID:                     12
Name:                   puppet view 1.0
Version:                1.0
Description:            
Content View ID:        8
Content View Name:      puppet view
Content View Label:     puppet_view
Lifecycle Environments: 
 1) ID:    1
    Name:  Library
    Label: Library
 2) ID:    2
    Name:  dev
    Label: dev
Repositories:           

Puppet Modules:         
 1) ID:      3
    Name:    dhcp
    Author:  theforeman
    Version: 1.3.0
 2) ID:      4
    Name:    dns
    Author:  theforeman
    Version: 1.3.0

#
# Observe that composite 2.0 has module dns 1.3.0
#
hammer> content-view version info --organization-id 1 --environment dev --id 15
ID:                     15
Name:                   composite 2.0
Version:                2.0
Description:            
Content View ID:        10
Content View Name:      composite
Content View Label:     composite
Lifecycle Environments: 
 1) ID:    1
    Name:  Library
    Label: Library
 2) ID:    2
    Name:  dev
    Label: dev
Repositories:           
 1) ID:    44
    Name:  zoo
    Label: zoo
Puppet Modules:         
 1) ID:      3
    Name:    dhcp
    Author:  theforeman
    Version: 1.3.0
 2) ID:      4
    Name:    dns
    Author:  theforeman
    Version: 1.3.0

#
# Perform an incremental update to move to puppet module 'dns version 1.4.0'
#
hammer> content-view version incremental-update --lifecycle-environment-ids 2 --content-view-version-id 12 --propagate-all-composites true --puppet-module-ids 1
[.........................................................................................................................................] [100%]
Content View: puppet view version 1.1
Added Content:
  Puppet Modules:
        theforeman-dns-1.4.0

Content View: composite version 2.1
Added Content:
  Puppet Modules:
        theforeman-dns-1.4.0

#
# Observe that the composite view when from 2.0 to 2.1 and puppet view went from 1.0 to 1.1
#
hammer> content-view version list --organization-id 1 --environment dev
---|-----------------|---------|-----------------------
ID | NAME            | VERSION | LIFECYCLE ENVIRONMENTS
---|-----------------|---------|-----------------------
17 | composite 2.1   | 2.1     | Library, dev          
16 | puppet view 1.1 | 1.1     | dev                   
---|-----------------|---------|-----------------------

#
# Observe that puppet view 1.1 includes dns 1.4.0
#
hammer> content-view version info --organization-id 1 --environment dev --id 16
ID:                     16
Name:                   puppet view 1.1
Version:                1.1
Description:            
Content View ID:        8
Content View Name:      puppet view
Content View Label:     puppet_view
Lifecycle Environments: 
 1) ID:    2
    Name:  dev
    Label: dev
Repositories:           

Puppet Modules:         
 1) ID:      3
    Name:    dhcp
    Author:  theforeman
    Version: 1.3.0
 2) ID:      1
    Name:    dns
    Author:  theforeman
    Version: 1.4.0

#
# Observe that composite 2.1 includes dns 1.4.0
#
hammer> content-view version info --organization-id 1 --environment dev --id 17
ID:                     17
Name:                   composite 2.1
Version:                2.1
Description:            
Content View ID:        10
Content View Name:      composite
Content View Label:     composite
Lifecycle Environments: 
 1) ID:    1
    Name:  Library
    Label: Library
 2) ID:    2
    Name:  dev
    Label: dev
Repositories:           
 1) ID:    47
    Name:  zoo
    Label: zoo
Puppet Modules:         
 1) ID:      3
    Name:    dhcp
    Author:  theforeman
    Version: 1.3.0
 2) ID:      1
    Name:    dns
    Author:  theforeman
    Version: 1.4.0
Comment 18 Mike McCune 2016-04-05 00:55:26 EDT
moving back ON_QA with updated test scenario
Comment 19 Tazim Kolhar 2016-04-13 05:20:11 EDT
VERIFIED:
# rpm -qa foreman
foreman-1.11.0.11-1.el7sat.noarch


Steps:
hammer> lifecycle-environment list --organization-id 1
---|---------|--------
ID | NAME    | PRIOR  
---|---------|--------
5  | TEST    | DEV    
6  | PROD    | TEST   
1  | Library |        
2  | DEV     | Library
---|---------|--------
hammer> puppet-module list --organization-id 1 --environment Library
---|------|--------|---------|-------------------------------------
ID | NAME | AUTHOR | VERSION | UUID                                
---|------|--------|---------|-------------------------------------
2  | motd | saz    | 2.3.0   | 1f3b3ab2-3a6a-44d2-a4fe-0d3ffddc5aef
1  | motd | saz    | 2.3.1   | 5f6aad86-88a3-4f19-bbe8-7eead8068a00
---|------|--------|---------|-------------------------------------
hammer> content-view version list --organization-id 1 --environment Library
---|-------------------------------|---------|-----------------------
ID | NAME                          | VERSION | LIFECYCLE ENVIRONMENTS
---|-------------------------------|---------|-----------------------
9  | con_view_composite 2.0        | 2.0     | Library, DEV          
7  | con_view 1.0                  | 1.0     | Library, DEV          
1  | Default Organization View 1.0 | 1.0     | Library               
---|-------------------------------|---------|-----------------------
hammer> content-view version info --organization-id 1 --environment Library --id 7
ID:                     7
Name:                   con_view 1.0
Version:                1.0
Description:            
Content View ID:        4
Content View Name:      con_view
Content View Label:     con_view
Lifecycle Environments: 
 1) ID:    1
    Name:  Library
    Label: Library
 2) ID:    2
    Name:  DEV
    Label: DEV
Repositories:           

Puppet Modules:         
 1) ID:      2
    Name:    motd
    Author:  saz
    Version: 2.3.0

hammer> content-view version info --organization-id 1 --environment Library --id 9
ID:                     9
Name:                   con_view_composite 2.0
Version:                2.0
Description:            
Content View ID:        5
Content View Name:      con_view_composite
Content View Label:     con_view_composite
Lifecycle Environments: 
 1) ID:    1
    Name:  Library
    Label: Library
 2) ID:    2
    Name:  DEV
    Label: DEV
Repositories:           

Puppet Modules:         
 1) ID:      2
    Name:    motd
    Author:  saz
    Version: 2.3.0

hammer> content-view version incremental-update --lifecycle-environment-ids 2 --content-view-version-id 7 --propagate-all-composites true --puppet-module-ids 1
[.....................................................................] [100%]
Content View: con_view version 1.1
Added Content:
  Puppet Modules:
        saz-motd-2.3.1

Content View: con_view_composite version 2.1
Added Content:
  Puppet Modules:
        saz-motd-2.3.1

hammer> content-view version list --organization-id 1 --environment DEV
---|------------------------|---------|-----------------------
ID | NAME                   | VERSION | LIFECYCLE ENVIRONMENTS
---|------------------------|---------|-----------------------
11 | con_view_composite 2.1 | 2.1     | Library, DEV          
10 | con_view 1.1           | 1.1     | DEV                   
---|------------------------|---------|-----------------------
hammer> content-view version info --organization-id 1 --environment DEV --id 10 
ID:                     10
Name:                   con_view 1.1
Version:                1.1
Description:            
Content View ID:        4
Content View Name:      con_view
Content View Label:     con_view
Lifecycle Environments: 
 1) ID:    2
    Name:  DEV
    Label: DEV
Repositories:           

Puppet Modules:         
 1) ID:      1
    Name:    motd
    Author:  saz
    Version: 2.3.1

hammer> content-view version info --organization-id 1 --environment DEV --id 11
ID:                     11
Name:                   con_view_composite 2.1
Version:                2.1
Description:            
Content View ID:        5
Content View Name:      con_view_composite
Content View Label:     con_view_composite
Lifecycle Environments: 
 1) ID:    1
    Name:  Library
    Label: Library
 2) ID:    2
    Name:  DEV
    Label: DEV
Repositories:           

Puppet Modules:         
 1) ID:      1
    Name:    motd
    Author:  saz
    Version: 2.3.1
Comment 22 errata-xmlrpc 2016-07-27 05:00:12 EDT
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:1500

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