katello 3.7.1 → 3.7.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of katello might be problematic. Click here for more details.
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 679620f4009df700650bbeb4bde990b172b24bf5
         | 
| 4 | 
            +
              data.tar.gz: bc3615c44ab394145f07e94b1ff48798833fd1c2
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: ddc49c94143661c4b2e189b28d80eca383306cf3d02e522d4f86b28059d72c274f3b4ff847f96f3a52531534197a21547d3da052f53df929ac23d065e632cd32
         | 
| 7 | 
            +
              data.tar.gz: 8d3bb8feb55d123355b9f4267d49513c06bf232b8eca55948a1c844891a8c76836f1b4ffa5955f1eebc86f537f3527ce6e126b608e73167acd40628d5dfcac0e
         | 
| @@ -13,86 +13,37 @@ module Actions | |
| 13 13 | 
             
                    end
         | 
| 14 14 |  | 
| 15 15 | 
             
                    def finalize
         | 
| 16 | 
            -
                       | 
| 17 | 
            -
                      return unless @hypervisors
         | 
| 16 | 
            +
                      hypervisors = input[:hypervisors]
         | 
| 18 17 |  | 
| 19 | 
            -
                       | 
| 20 | 
            -
                         | 
| 21 | 
            -
             | 
| 22 | 
            -
                        @hosts.each do |uuid, host|
         | 
| 23 | 
            -
                          update_subscription_facet(uuid, host)
         | 
| 18 | 
            +
                      if hypervisors
         | 
| 19 | 
            +
                        User.as_anonymous_admin do
         | 
| 20 | 
            +
                          hypervisors.each { |hypervisor| update_or_create_hypervisor(hypervisor) }
         | 
| 24 21 | 
             
                        end
         | 
| 25 22 | 
             
                      end
         | 
| 26 23 | 
             
                    end
         | 
| 27 24 |  | 
| 28 | 
            -
                     | 
| 29 | 
            -
             | 
| 30 | 
            -
                      @organizations = ::Organization.where(label: hypervisors_field(:organization_label)).map { |org| [org.label, org] }.to_h
         | 
| 31 | 
            -
                      @hosts = {}
         | 
| 32 | 
            -
             | 
| 33 | 
            -
                      load_hosts_by_uuid
         | 
| 34 | 
            -
                      load_hosts_by_duplicate_name
         | 
| 35 | 
            -
                      create_missing_hosts
         | 
| 36 | 
            -
             | 
| 37 | 
            -
                      candlepin_data = ::Katello::Resources::Candlepin::Consumer.get(uuid: @hosts.keys)
         | 
| 38 | 
            -
                      @candlepin_attributes = candlepin_data.map { |consumer| [consumer[:uuid], consumer] }.to_h
         | 
| 39 | 
            -
                    end
         | 
| 40 | 
            -
             | 
| 41 | 
            -
                    def load_hosts_by_uuid
         | 
| 42 | 
            -
                      hosts_by_uuid = ::Host.eager_load(:subscription_facet).where(katello_subscription_facets: { uuid: hypervisors_field(:uuid) })
         | 
| 43 | 
            -
                      @hosts.merge(hosts_by_uuid.map { |host| [host.subscription_facet.uuid, host] }.to_h)
         | 
| 44 | 
            -
                    end
         | 
| 45 | 
            -
             | 
| 46 | 
            -
                    def load_hosts_by_duplicate_name
         | 
| 47 | 
            -
                      duplicate_names, duplicate_name_orgs = generate_duplicates_list
         | 
| 48 | 
            -
             | 
| 49 | 
            -
                      hosts_by_dup_name = ::Host.preload(:subscription_facet).where(name: duplicate_names.keys)
         | 
| 50 | 
            -
             | 
| 51 | 
            -
                      hosts_by_dup_name.each do |host|
         | 
| 52 | 
            -
                        validate_host_organization(host, duplicate_name_orgs[host.name].try(:id))
         | 
| 53 | 
            -
                      end
         | 
| 54 | 
            -
             | 
| 55 | 
            -
                      @hosts.merge!(hosts_by_dup_name.map { |host| [duplicate_names[host.name], host] }.to_h)
         | 
| 56 | 
            -
                    end
         | 
| 57 | 
            -
             | 
| 58 | 
            -
                    def create_missing_hosts
         | 
| 59 | 
            -
                      # remaining hypervisors
         | 
| 60 | 
            -
                      @hypervisors.each do |hypervisor|
         | 
| 61 | 
            -
                        next if @hosts.key?(hypervisor[:uuid])
         | 
| 62 | 
            -
                        duplicate_name, org = duplicate_name(hypervisor)
         | 
| 63 | 
            -
                        @hosts[hypervisor[:uuid]] = create_host_for_hypervisor(duplicate_name, org)
         | 
| 64 | 
            -
                      end
         | 
| 65 | 
            -
                    end
         | 
| 66 | 
            -
             | 
| 67 | 
            -
                    def generate_duplicates_list
         | 
| 68 | 
            -
                      duplicate_names = {}
         | 
| 69 | 
            -
                      duplicate_name_orgs = {}
         | 
| 70 | 
            -
                      @hypervisors.each do |hypervisor|
         | 
| 71 | 
            -
                        next if @hosts.key?(hypervisor[:uuid])
         | 
| 72 | 
            -
             | 
| 73 | 
            -
                        duplicate_name, org = duplicate_name(hypervisor)
         | 
| 74 | 
            -
                        duplicate_names[duplicate_name] = hypervisor[:uuid]
         | 
| 75 | 
            -
                        duplicate_name_orgs[duplicate_name] = org
         | 
| 76 | 
            -
                      end
         | 
| 25 | 
            +
                    def update_or_create_hypervisor(hypervisor_json)
         | 
| 26 | 
            +
                      organization = ::Organization.find_by(:label => hypervisor_json[:organization_label])
         | 
| 77 27 |  | 
| 78 | 
            -
                       | 
| 79 | 
            -
             | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 82 | 
            -
                       | 
| 28 | 
            +
                      # Since host names must be unique yet hypervisors may have unique subscription
         | 
| 29 | 
            +
                      # facets in different orgs
         | 
| 30 | 
            +
                      sanitized_name = ::Katello::Host::SubscriptionFacet.sanitize_name(hypervisor_json[:name])
         | 
| 31 | 
            +
                      duplicate_name = "virt-who-#{sanitized_name}-#{organization.id}"
         | 
| 32 | 
            +
                      host = ::Katello::Host::SubscriptionFacet.find_by(:uuid => hypervisor_json[:uuid]).try(:host)
         | 
| 33 | 
            +
                      host ||= ::Host.find_by(:name => duplicate_name)
         | 
| 34 | 
            +
                      if host && host.organization.try(:id) != organization.id
         | 
| 83 35 | 
             
                        fail _("Host '%{name}' does not belong to an organization") % {:name => host.name} unless host.organization
         | 
| 36 | 
            +
                        host = nil
         | 
| 84 37 | 
             
                      end
         | 
| 85 | 
            -
                    end
         | 
| 86 38 |  | 
| 87 | 
            -
             | 
| 88 | 
            -
             | 
| 89 | 
            -
                       | 
| 90 | 
            -
             | 
| 91 | 
            -
             | 
| 92 | 
            -
             | 
| 93 | 
            -
                       | 
| 94 | 
            -
                       | 
| 95 | 
            -
                      ["virt-who-#{sanitized_name}-#{organization.id}", organization]
         | 
| 39 | 
            +
                      host ||= create_host_for_hypervisor(duplicate_name, organization)
         | 
| 40 | 
            +
                      host.subscription_facet ||= ::Katello::Host::SubscriptionFacet.new
         | 
| 41 | 
            +
                      host.subscription_facet.host_id = host.id
         | 
| 42 | 
            +
                      host.subscription_facet.uuid = hypervisor_json[:uuid]
         | 
| 43 | 
            +
                      host.subscription_facet.import_database_attributes(host.subscription_facet.candlepin_consumer.consumer_attributes)
         | 
| 44 | 
            +
                      host.subscription_facet.save!
         | 
| 45 | 
            +
                      host.subscription_facet.update_subscription_status
         | 
| 46 | 
            +
                      host.save!
         | 
| 96 47 | 
             
                    end
         | 
| 97 48 |  | 
| 98 49 | 
             
                    def create_host_for_hypervisor(name, organization, location = nil)
         | 
| @@ -103,17 +54,6 @@ module Actions | |
| 103 54 | 
             
                      host
         | 
| 104 55 | 
             
                    end
         | 
| 105 56 |  | 
| 106 | 
            -
                    def update_subscription_facet(uuid, host)
         | 
| 107 | 
            -
                      host.subscription_facet ||= host.build_subscription_facet(uuid: uuid)
         | 
| 108 | 
            -
                      if @candlepin_attributes.key?(uuid)
         | 
| 109 | 
            -
                        host.subscription_facet.candlepin_consumer.consumer_attributes = @candlepin_attributes[uuid]
         | 
| 110 | 
            -
                        host.subscription_facet.import_database_attributes
         | 
| 111 | 
            -
                        host.subscription_facet.save!
         | 
| 112 | 
            -
                        host.subscription_facet.update_subscription_status(@candlepin_attributes[uuid].try(:[], :entitlementStatus))
         | 
| 113 | 
            -
                      end
         | 
| 114 | 
            -
                      host.save!
         | 
| 115 | 
            -
                    end
         | 
| 116 | 
            -
             | 
| 117 57 | 
             
                    def rescue_strategy
         | 
| 118 58 | 
             
                      Dynflow::Action::Rescue::Skip
         | 
| 119 59 | 
             
                    end
         | 
| @@ -38,7 +38,7 @@ module Katello | |
| 38 38 |  | 
| 39 39 | 
             
                def to_status(options = {})
         | 
| 40 40 | 
             
                  return UNKNOWN unless host.subscription_facet.try(:uuid)
         | 
| 41 | 
            -
                  status_override = 'unsubscribed_hypervisor' if host.subscription_facet.hypervisor &&  | 
| 41 | 
            +
                  status_override = 'unsubscribed_hypervisor' if host.subscription_facet.hypervisor && host.subscription_facet.candlepin_consumer.entitlements.empty?
         | 
| 42 42 | 
             
                  status_override ||= options.fetch(:status_override, nil)
         | 
| 43 43 | 
             
                  status = status_override || Katello::Candlepin::Consumer.new(host.subscription_facet.uuid, host.organization.label).entitlement_status
         | 
| 44 44 |  | 
| @@ -120,14 +120,6 @@ module Katello | |
| 120 120 | 
             
                    self.class.friendly_compliance_reasons(Resources::Candlepin::Consumer.compliance(uuid)['reasons'])
         | 
| 121 121 | 
             
                  end
         | 
| 122 122 |  | 
| 123 | 
            -
                  def entitlements?
         | 
| 124 | 
            -
                    # use cahced consumer_attributes if possible
         | 
| 125 | 
            -
                    count = @consumer_attributes.try(:[], 'entitlementCount')
         | 
| 126 | 
            -
                    return count > 0 if count
         | 
| 127 | 
            -
             | 
| 128 | 
            -
                    !entitlements.empty?
         | 
| 129 | 
            -
                  end
         | 
| 130 | 
            -
             | 
| 131 123 | 
             
                  def self.friendly_compliance_reasons(candlepin_reasons)
         | 
| 132 124 | 
             
                    candlepin_reasons.map do |reason|
         | 
| 133 125 | 
             
                      product_name = reason['productName'] || reason['attributes']['name']
         | 
    
        data/config/katello.yml
    ADDED
    
    | @@ -0,0 +1,59 @@ | |
| 1 | 
            +
            #
         | 
| 2 | 
            +
            # WARNING: THIS CONFIGURATION WAS GENERATED BY KATELLO-CONFIGURE TOOL,
         | 
| 3 | 
            +
            # CHANGES WILL LIKELY BE OVERWRITTEN. IF YOU WISH TO PRESERVE ANY CHANGES
         | 
| 4 | 
            +
            # TO THIS FILE PLEASE EDIT /usr/share/katello/install/default-answer-file
         | 
| 5 | 
            +
            # FOR THE CORRESPONDING OPTION AND RERUN katello-configure.
         | 
| 6 | 
            +
            #
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            # Katello configuration
         | 
| 9 | 
            +
            #
         | 
| 10 | 
            +
            # :vim:sw=2:ts=2:et:
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            # see /usr/share/katello/config.katello_defaults.yml for available options
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            :katello:
         | 
| 15 | 
            +
              :force_manifest_import: true
         | 
| 16 | 
            +
              :content_types:
         | 
| 17 | 
            +
                :yum: true
         | 
| 18 | 
            +
                :file: true
         | 
| 19 | 
            +
                :deb: true
         | 
| 20 | 
            +
                :puppet: true
         | 
| 21 | 
            +
                :docker: true
         | 
| 22 | 
            +
                :ostree: true
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              :rest_client_timeout: 120
         | 
| 25 | 
            +
             | 
| 26 | 
            +
              :post_sync_url: https://robot.example.com/katello/api/v2/repositories/sync_complete?token=test
         | 
| 27 | 
            +
             | 
| 28 | 
            +
              :candlepin:
         | 
| 29 | 
            +
                :ca_cert_file: /etc/pki/katello/certs/katello-default-ca.crt
         | 
| 30 | 
            +
                :url: https://robot.example.com:8443/candlepin
         | 
| 31 | 
            +
                :oauth_key: katello
         | 
| 32 | 
            +
                :oauth_secret: katello
         | 
| 33 | 
            +
             | 
| 34 | 
            +
              :pulp:
         | 
| 35 | 
            +
                :url: https://robot.example.com/pulp/api/v2/
         | 
| 36 | 
            +
                :ca_cert_file: /etc/pki/katello/certs/katello-default-ca.crt
         | 
| 37 | 
            +
                :oauth_key: katello
         | 
| 38 | 
            +
                :oauth_secret: katello
         | 
| 39 | 
            +
             | 
| 40 | 
            +
              :qpid:
         | 
| 41 | 
            +
                :url: amqp:ssl:robot.example.com:5671
         | 
| 42 | 
            +
                :subscriptions_queue_address: katello_event_queue
         | 
| 43 | 
            +
             | 
| 44 | 
            +
              :loggers:
         | 
| 45 | 
            +
                :glue:
         | 
| 46 | 
            +
                  :enabled: false
         | 
| 47 | 
            +
                :pulp_rest:
         | 
| 48 | 
            +
                  :enabled: false
         | 
| 49 | 
            +
                :cp_rest:
         | 
| 50 | 
            +
                  :enabled: false
         | 
| 51 | 
            +
                :cp_proxy:
         | 
| 52 | 
            +
                  :enabled: false
         | 
| 53 | 
            +
                :action:
         | 
| 54 | 
            +
                  :enabled: false
         | 
| 55 | 
            +
                :tire_rest:
         | 
| 56 | 
            +
                  :enabled: false
         | 
| 57 | 
            +
                :manifest_import_logger:
         | 
| 58 | 
            +
                  :enabled: false
         | 
| 59 | 
            +
             | 
    
        data/lib/katello/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: katello
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 3.7.1
         | 
| 4 | 
            +
              version: 3.7.1.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - N/A
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2018-10- | 
| 11 | 
            +
            date: 2018-10-11 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rails
         | 
| @@ -1341,6 +1341,7 @@ files: | |
| 1341 1341 | 
             
            - config/initializers/rabl_init.rb
         | 
| 1342 1342 | 
             
            - config/initializers/runcible.rb
         | 
| 1343 1343 | 
             
            - config/katello.yaml.example
         | 
| 1344 | 
            +
            - config/katello.yml
         | 
| 1344 1345 | 
             
            - config/locales/README
         | 
| 1345 1346 | 
             
            - config/locales/bn.yml
         | 
| 1346 1347 | 
             
            - config/locales/compare_upstream.sh
         |