Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1337515 - unable to sync puppet module to capsule: ActionController::RoutingError (No route matches [GET] "/pulp/puppet/Default_Organization-Library-test2/PULP_MANIFEST")
Summary: unable to sync puppet module to capsule: ActionController::RoutingError (No r...
Keywords:
Status: CLOSED DUPLICATE of bug 1338009
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Foreman Proxy
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: Unspecified
Assignee: John Mitsch
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-05-19 11:29 UTC by Jan Hutař
Modified: 2019-04-01 20:27 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-05-25 17:46:33 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jan Hutař 2016-05-19 11:29:37 UTC
Description of problem:
I'm unable to sync puppet module to capsule. Although webUI reports content was synced (will report this as a different bug), it is not. In the logs on Satellite I can see:


2016-05-19 06:30:29 [app] [I] Started GET "/pulp/puppet/Default_Organization-Library-test/PULP_MANIFEST" for 172.17.50.10 at 2016-05-19 06:30:29 -0400
2016-05-19 06:30:29 [app] [F] 
 | ActionController::RoutingError (No route matches [GET] "/pulp/puppet/Default_Organization-Library-test/PULP_MANIFEST"):
 |   actionpack (4.1.5) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
 |   actionpack (4.1.5) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
 |   railties (4.1.5) lib/rails/rack/logger.rb:38:in `call_app'
 |   railties (4.1.5) lib/rails/rack/logger.rb:22:in `call'
 |   actionpack (4.1.5) lib/action_dispatch/middleware/request_id.rb:21:in `call'
 |   rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
 |   rack (1.5.2) lib/rack/runtime.rb:17:in `call'
 |   activesupport (4.1.5) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
 |   actionpack (4.1.5) lib/action_dispatch/middleware/static.rb:64:in `call'
 |   actionpack (4.1.5) lib/action_dispatch/middleware/static.rb:64:in `call'
 |   rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
 |   railties (4.1.5) lib/rails/engine.rb:514:in `call'
 |   railties (4.1.5) lib/rails/application.rb:144:in `call'
 |   railties (4.1.5) lib/rails/railtie.rb:194:in `public_send'
 |   railties (4.1.5) lib/rails/railtie.rb:194:in `method_missing'
 |   rack (1.5.2) lib/rack/builder.rb:138:in `call'
 |   rack (1.5.2) lib/rack/urlmap.rb:65:in `block in call'
 |   rack (1.5.2) lib/rack/urlmap.rb:50:in `each'
 |   rack (1.5.2) lib/rack/urlmap.rb:50:in `call'
 |   /usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/rack/thread_handler_extension.rb:77:in `process_request'
 |   /usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:140:in `accept_and_process_next_request'
 |   /usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:108:in `main_loop'
 |   /usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler.rb:441:in `block (3 levels) in start_threads'
 |   logging (1.8.2) lib/logging/diagnostic_context.rb:323:in `call'
 |   logging (1.8.2) lib/logging/diagnostic_context.rb:323:in `block in create_with_logging_context'
 | 
 | 
2016-05-19 06:30:30 [app] [I] Started POST "/foreman_tasks/api/tasks/bulk_search" for 10.34.131.208 at 2016-05-19 06:30:30 -0400


Version-Release number of selected component (if applicable):
Sat: satellite-6.2.0-12.0.el7sat.noarch
Capsule: satellite-capsule-6.2.0-12.0.el7sat.noarch


How reproducible:
always


Steps to Reproduce:
1. Create puppet product, repo and module:
   # PUPPET_MODULE=puppet-qaredhattest
   # PUPPET_MODULE_FILE=/tmp/puppet-qaredhattest.txt
   # PUPPET_MODULE_FILE_CONTENT="Some important sentence."
   # puppet module generate "$PUPPET_MODULE" --skip-interview
   # cat <<EOF > $PUPPET_MODULE/manifests/init.pp
   # class qaredhattest {
   #   file { "$PUPPET_MODULE_FILE":
   #     ensure => file,
   #     mode   => 755,
   #     owner  => root,
   #     group  => root,
   #     content => "$PUPPET_MODULE_FILE_CONTENT",
   #   }
   # }
   # EOF
   # puppet module build $PUPPET_MODULE
   # PUPPET_PRODUCT='MyPuppetProduct'
   # PUPPET_REPO='MyPuppetRepo'
   # hammer --username <user> --password <pass> product create --label $PUPPET_PRODUCT --name $PUPPET_PRODUCT --organization-id 1
   # hammer --username <user> --password <pass> repository create --content-type puppet --label $PUPPET_REPO --name $PUPPET_REPO --organization-id 1 --product $PUPPET_PRODUCT
   # hammer --username <user> --password <pass> repository upload-content --name $PUPPET_REPO --path $PUPPET_MODULE/pkg/$PUPPET_MODULE-0.1.0.tar.gz --product $PUPPET_PRODUCT --organization-id 1
2. Create content view (called "test" in my case) and add the module there.
3. Publish/promote that content view into Library
4. Have capsule which is consuming "Library"
5. Click "Synchronize Now" on capsule's detail page and once it finishes,
   check module synchronized


Actual results:
Synchronization finishes correctly, but:

 * in Infrastructure -> Capsules -> <capsule> -> Puppet -> Environments ->
   -> KT_Default_Organization_Library_test_2 it says number of classes: 0
 * in ... -> <capsule> -> Content -> Library it says puppet modules: 0 (except for 1 in "Default Organization View", but that is redhat_insights I guess)
 * on Capsule, there is nothing in /etc/puppet/environments/KT_Default_Organization_Library_test_2/modules/
 * there is an error in logs complaining about PULP_MANIFEST (see above)
 * client complain with:
Warning: Unable to fetch my node definition, but the agent run will continue:
Warning: Error 400 on SERVER: Failed to find docker12container174.example.com via exec: Execution of '/etc/puppet/node.rb docker12container174.example.com' returned 1: 
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class qaredhattest for docker12container174.example.com on node docker12container174.example.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run


Expected results:
Should work

Comment 1 Jan Hutař 2016-05-19 12:32:02 UTC
Note: I have manually applied patch from bug 1337306 comment #1 on the system before I have observed this.

# diff -u /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.31/app/lib/actions/middleware/backend_services_check.rb{.ORIG,}
--- /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.31/app/lib/actions/middleware/backend_services_check.rb.ORIG	2016-05-19 05:19:02.113026376 -0400
+++ /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.31/app/lib/actions/middleware/backend_services_check.rb	2016-05-19 05:20:02.139022921 -0400
@@ -9,7 +9,7 @@
           to_check = services - parent.input[:services_checked]
 
           if to_check.any?
-            result = User.as_anonymous_admin { ::Katello::Ping.ping(to_check)[:services] }
+            result = User.as_anonymous_admin { ::Katello::Ping.ping(services: to_check, capsule_id: capsule_id(args))[:services] }
 
             to_check.each do |service|
               if result[service][:status] != ::Katello::Ping::OK_RETURN_CODE
@@ -24,6 +24,11 @@
 
       protected
 
+      def capsule_id(args)
+        capsule_hash = args.select { |x| x[:capsule_id] if x.is_a? Hash }
+        capsule_hash[0] ? capsule_hash[0][:capsule_id] : nil
+      end
+
       def source_action
         parent = self.action
         until parent.trigger.nil?
# diff -u /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.31/app/models/katello/ping.rb{.ORIG,}
--- /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.31/app/models/katello/ping.rb.ORIG	2016-05-19 05:20:29.488021347 -0400
+++ /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.31/app/models/katello/ping.rb	2016-05-19 05:22:00.997016080 -0400
@@ -16,14 +16,14 @@
       #
       # TODO: break up this method
       # rubocop:disable MethodLength
-      def ping(services = SERVICES)
+      def ping(services: SERVICES, capsule_id: nil)
         result = { :status => OK_RETURN_CODE, :services => {}}
         services.each { |service| result[:services][service] = {} }
 
         # pulp - ping without oauth
         if services.include?(:pulp)
           exception_watch(result[:services][:pulp]) do
-            Ping.pulp_without_oauth
+            Ping.pulp_without_auth(pulp_url(capsule_id))
           end
         end
 
@@ -98,12 +98,22 @@
         packages.split("\n").sort
       end
 
+      def pulp_url(capsule_id)
+        if capsule_id
+          capsule_content = ::Katello::CapsuleContent.new(SmartProxy.find(capsule_id))
+          uri = URI.parse(capsule_content.pulp_url)
+          "#{uri.scheme}://#{uri.host.downcase}/pulp/api/v2"
+        else
+          SETTINGS[:katello][:pulp][:url]
+        end
+      end
+
       # this checks Pulp is running and responding without need
       # for authentication. We don't use RestClient.options here
       # because it returns empty string, which is not enough to say
       # pulp is the one that responded
-      def pulp_without_oauth
-        body = RestClient.get("#{SETTINGS[:katello][:pulp][:url]}/status/")
+      def pulp_without_auth(url)
+        body = RestClient.get("#{url}/status/")
         fail _("Pulp does not appear to be running.") if body.empty?
         json = JSON.parse(body)

Comment 4 Mike McCune 2016-05-25 17:46:33 UTC

*** This bug has been marked as a duplicate of bug 1338009 ***


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