SatelliteQE / nailgun

Why use a hammer when you can use a nailgun.
GNU General Public License v3.0
46 stars 83 forks source link

Puppet Modules Not Added To Content View #364

Open jbnance opened 7 years ago

jbnance commented 7 years ago

Neither ContentView.create() nor ContentView.update() successfully adds Puppet modules to a content view.

Array holding the module:

>>> pp.pprint(theModules)
[   nailgun.entities.PuppetModule(nailgun.config.ServerConfig(url='https://172.16.246.97', verify=False, auth=('admin', 'the-password')), author=u'yelp', summary=u'A collection of network functions and facts', version=u'0.0.1', id=4232, name=u'netstdlib'),
    nailgun.entities.PuppetModule(nailgun.config.ServerConfig(url='https://172.16.246.97', verify=False, auth=('admin', 'the-password')), author=u'puppetlabs', summary=u'Standard library of resources for Puppet modules.', version=u'4.15.0', id=20, name=u'stdlib'),
    nailgun.entities.PuppetModule(nailgun.config.ServerConfig(url='https://172.16.246.97', verify=False, auth=('admin', 'the-password')), author=u'paulche', summary=u'Concat module', version=u'1.0.0', id=1332, name=u'concat'),
    nailgun.entities.PuppetModule(nailgun.config.ServerConfig(url='https://172.16.246.97', verify=False, auth=('admin', 'the-password')), author=u'puppetlabs', summary=u'Puppet module providing a type to manage repositories from various version control systems', version=u'1.5.0', id=4478, name=u'vcsrepo')]

The current content view:

>>> pp.pprint(cvPuppetModules)
nailgun.entities.ContentView(nailgun.config.ServerConfig(url='https://172.16.246.97', verify=False, auth=('admin', 'the-password')), puppet_module=[], repository=[], composite=False, description=None, component=[], last_published=None, label=u'Puppet_Modules', version=[], organization=nailgun.entities.Organization(nailgun.config.ServerConfig(url='https://172.16.246.97', verify=False, auth=('admin', 'the-password')), id=1), id=24, next_version=1, name=u'Puppet Modules')

Add the modules (they don't actually add):

>>> cvPuppetModules.puppet_module = theModules
>>> cvPuppetModules.update()
nailgun.entities.ContentView(nailgun.config.ServerConfig(url='https://172.16.246.97', verify=False, auth=('admin', 'the-password')), puppet_module=[], repository=[], composite=False, name=u'Puppet Modules', description=None, component=[], label=u'Puppet_Modules', version=[], organization=nailgun.entities.Organization(nailgun.config.ServerConfig(url='https://172.16.246.97', verify=False, auth=('admin', 'the-password')), id=1), id=24, next_version=1, last_published=None)

(note that puppet_module is an empty array, and if you look in the web UI the modules aren't there)

Foreman logs:

==> /var/log/httpd/foreman-ssl_error_ssl.log <==
[Mon Jan 23 15:18:31.581828 2017] [ssl:warn] [pid 1595] [client 172.16.246.242:33698] AH02227: Failed to set r->user to 'SSL_CLIENT_S_DN_CN'

==> /var/log/foreman/production.log <==
2017-01-23 15:18:31 59c3b1c9 [app] [I] Started PUT "/katello/api/v2/content_views/24" for 172.16.246.242 at 2017-01-23 15:18:31 -0600
2017-01-23 15:18:31 59c3b1c9 [app] [I] Processing by Katello::Api::V2::ContentViewsController#update as */*
2017-01-23 15:18:31 59c3b1c9 [app] [I]   Parameters: {"composite"=>false, "description"=>nil, "last_published"=>nil, "component_ids"=>nil, "label"=>"Puppet_Modules", "organization_id"=>1, "version_ids"=>nil, "repository_ids"=>nil, "puppet_module_ids"=>[4232, 20, 1332, 4478], "id"=>"24", "next_version"=>1, "name"=>"Puppet Modules", "api_version"=>"v2", "content_view"=>{"id"=>"24", "name"=>"Puppet Modules", "label"=>"Puppet_Modules", "description"=>nil, "organization_id"=>1, "composite"=>false, "next_version"=>1, "repository_ids"=>nil, "component_ids"=>nil}}
2017-01-23 15:18:31 59c3b1c9 [app] [I] Authorized user admin(Admin User)

==> /var/log/httpd/foreman-ssl_access_ssl.log <==
172.16.246.242 - - [23/Jan/2017:15:18:31 -0600] "PUT /katello/api/v2/content_views/24 HTTP/1.1" 200 323 "-" "python-requests/2.10.0"

==> /var/log/foreman/production.log <==
2017-01-23 15:18:32 59c3b1c9 [app] [I]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.2.1.1/app/views/katello/api/v2/common/update.json.rabl within katello/api/v2/layouts/resource (31.6ms)
2017-01-23 15:18:32 59c3b1c9 [app] [I] Completed 200 OK in 1115ms (Views: 30.0ms | ActiveRecord: 14.9ms)

Same results if you include the modules during create().

jbnance commented 7 years ago

Here are the logs when adding a single module to a CV using the web UI:

==> /var/log/httpd/foreman-ssl_access_ssl.log <==
172.16.246.242 - - [23/Jan/2017:15:31:19 -0600] "POST /katello/api/v2/content_views/24/content_view_puppet_modules?organization_id=1 HTTP/1.1" 403 261 "https://localhost:4443/content_views/24/puppet_modules/stdlib/versions" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"
172.16.246.242 - - [23/Jan/2017:15:31:19 -0600] "POST /katello/api/v2/content_views/24/content_view_puppet_modules?organization_id=1 HTTP/1.1" 200 61 "https://localhost:4443/content_views/24/puppet_modules/stdlib/versions" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"
172.16.246.242 - - [23/Jan/2017:15:31:19 -0600] "GET /katello/api/v2/content_views/24/content_view_puppet_modules?organization_id=1&page=1&search= HTTP/1.1" 200 195 "https://localhost:4443/content_views/24/puppet_modules" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"

==> /var/log/httpd/foreman-ssl_error_ssl.log <==
[Mon Jan 23 15:31:19.014026 2017] [ssl:error] [pid 1592] [client 172.16.246.242:33770] AH02261: Re-negotiation handshake failed: Not accepted by client!?, referer: https://localhost:4443/content_views/24/puppet_modules/stdlib/versions
[Mon Jan 23 15:31:19.032694 2017] [ssl:warn] [pid 2490] [client 172.16.246.242:33772] AH02227: Failed to set r->user to 'SSL_CLIENT_S_DN_CN', referer: https://localhost:4443/content_views/24/puppet_modules/stdlib/versions
[Mon Jan 23 15:31:19.232183 2017] [ssl:warn] [pid 2490] [client 172.16.246.242:33772] AH02227: Failed to set r->user to 'SSL_CLIENT_S_DN_CN', referer: https://localhost:4443/content_views/24/puppet_modules

==> /var/log/foreman/production.log <==
2017-01-23 15:31:19 c617ae9d [app] [I] Started POST "/katello/api/v2/content_views/24/content_view_puppet_modules?organization_id=1" for 172.16.246.242 at 2017-01-23 15:31:19 -0600
2017-01-23 15:31:19 c617ae9d [app] [I] Processing by Katello::Api::V2::ContentViewPuppetModulesController#create as JSON
2017-01-23 15:31:19 c617ae9d [app] [I]   Parameters: {"contentViewId"=>"24", "uuid"=>nil, "author"=>"puppetlabs", "name"=>"stdlib", "organization_id"=>"1", "api_version"=>"v2", "content_view_id"=>"24", "content_view_puppet_module"=>{"name"=>"stdlib", "author"=>"puppetlabs", "uuid"=>nil}}
2017-01-23 15:31:19 c617ae9d [app] [I]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.2.1.1/app/views/katello/api/v2/content_view_puppet_modules/create.json.rabl within katello/api/v2/layouts/resource (1.6ms)
2017-01-23 15:31:19 c617ae9d [app] [I] Completed 200 OK in 100ms (Views: 11.2ms | ActiveRecord: 51.3ms)
2017-01-23 15:31:19 c617ae9d [app] [I] Started GET "/katello/api/v2/content_views/24/content_view_puppet_modules?organization_id=1&page=1&search=" for 172.16.246.242 at 2017-01-23 15:31:19 -0600
2017-01-23 15:31:19 c617ae9d [app] [I] Processing by Katello::Api::V2::ContentViewPuppetModulesController#index as JSON
2017-01-23 15:31:19 c617ae9d [app] [I]   Parameters: {"organization_id"=>"1", "page"=>"1", "search"=>"", "api_version"=>"v2", "content_view_id"=>"24"}
2017-01-23 15:31:19 c617ae9d [app] [I]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.2.1.1/app/views/katello/api/v2/content_view_puppet_modules/index.json.rabl within katello/api/v2/layouts/collection (23.5ms)
2017-01-23 15:31:19 c617ae9d [app] [I] Completed 200 OK in 35ms (Views: 22.1ms | ActiveRecord: 4.1ms)