Sha256: a4d34d2596519ad96f847822c137ac7433d384331aa341960303187ffc06aaa5

Contents?: true

Size: 1.32 KB

Versions: 35

Compression:

Stored size: 1.32 KB

Contents

module Actions
  module ForemanVirtWhoConfigure
    module Config
      class Report < Actions::EntryAction
        middleware.use Actions::Middleware::KeepCurrentUser

        def self.subscribe
          Actions::Katello::Host::HypervisorsUpdate
        end

        def plan(hypervisors)
          plan_self(:hypervisors => hypervisors) if User.current.try(:id)
        end

        def run
          # this is how we could do mapping to hypervisor hosts based on UUID provided by candelpin
          # input['hypervisors'].each do |hv_attrs|
          #   # should always exist, Actions::Katello::Host::HypervisorsUpdate should create it
          #   # but we should be careful anyway
          #   hypervisor = ::Host.joins(:subscription_facet).where(:'katello_subscription_facets.uuid' => hv_attrs['uuid']).first
          # end

          config = ::ForemanVirtWhoConfigure::ServiceUser.find_by_user_id(User.current.id).try(:config)
          if config.present?
            config.virt_who_touch!
          end

          # if config was not found, the report is coming from unknown virt-who reporter, we could create a notification
          # that this plugin can be used for configuration

          # this could be used for mapping to existing compute resource
          # config.hypervisor_server
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
foreman_virt_who_configure-0.5.19 app/lib/actions/foreman_virt_who_configure/config/report.rb
foreman_virt_who_configure-0.5.18 app/lib/actions/foreman_virt_who_configure/config/report.rb
foreman_virt_who_configure-0.5.17 app/lib/actions/foreman_virt_who_configure/config/report.rb
foreman_virt_who_configure-0.5.16 app/lib/actions/foreman_virt_who_configure/config/report.rb
foreman_virt_who_configure-0.5.15 app/lib/actions/foreman_virt_who_configure/config/report.rb
foreman_virt_who_configure-0.5.14 app/lib/actions/foreman_virt_who_configure/config/report.rb
foreman_virt_who_configure-0.5.13 app/lib/actions/foreman_virt_who_configure/config/report.rb
foreman_virt_who_configure-0.5.12 app/lib/actions/foreman_virt_who_configure/config/report.rb
foreman_virt_who_configure-0.5.11 app/lib/actions/foreman_virt_who_configure/config/report.rb
foreman_virt_who_configure-0.5.10 app/lib/actions/foreman_virt_who_configure/config/report.rb
foreman_virt_who_configure-0.5.9 app/lib/actions/foreman_virt_who_configure/config/report.rb
foreman_virt_who_configure-0.5.8 app/lib/actions/foreman_virt_who_configure/config/report.rb
foreman_virt_who_configure-0.5.7 app/lib/actions/foreman_virt_who_configure/config/report.rb
foreman_virt_who_configure-0.5.6 app/lib/actions/foreman_virt_who_configure/config/report.rb
foreman_virt_who_configure-0.5.5 app/lib/actions/foreman_virt_who_configure/config/report.rb
foreman_virt_who_configure-0.5.4 app/lib/actions/foreman_virt_who_configure/config/report.rb
foreman_virt_who_configure-0.5.3 app/lib/actions/foreman_virt_who_configure/config/report.rb
foreman_virt_who_configure-0.5.2 app/lib/actions/foreman_virt_who_configure/config/report.rb
foreman_virt_who_configure-0.5.1 app/lib/actions/foreman_virt_who_configure/config/report.rb
foreman_virt_who_configure-0.5.0 app/lib/actions/foreman_virt_who_configure/config/report.rb