Sha256: d400db7148d74f82abc12f189a93a03ea65e61b4a8ff0346dffcad3a89d10266

Contents?: true

Size: 1.76 KB

Versions: 37

Compression:

Stored size: 1.76 KB

Contents

module Actions
  module Katello
    module Repository
      class Discover < Actions::Base
        include Dynflow::Action::Cancellable

        input_format do
          param :url, String
        end

        output_format do
          param :repo_urls, array_of(String)
        end

        def plan(url)
          plan_self(url: url)
        end

        def run(event = nil)
          output[:repo_urls] = output[:repo_urls] || []
          output[:crawled] = output[:crawled] || []
          output[:to_follow] = output[:to_follow] || [input[:url]]

          repo_discovery = ::Katello::RepoDiscovery.new(input[:url], proxy, output[:crawled], output[:repo_urls], output[:to_follow])

          match(event,
            (on nil do
              unless output[:to_follow].empty?
                repo_discovery.run(output[:to_follow].shift)
                suspend { |suspended_action| world.clock.ping suspended_action, 0.001 }
              end
            end),
            (on Dynflow::Action::Cancellable::Cancel do
              output[:repo_urls] = []
            end))
        end

        # @return <String> urls found by the action
        def task_input
          input[:url]
        end

        # @return [Array<String>] urls found by the action
        def task_output
          output[:repo_urls] || []
        end

        def proxy
          proxy = {}

          if (config = SETTINGS[:katello][:cdn_proxy])
            proxy[:proxy_host] = URI.parse(config[:host]).host if config.key?(:host)
            proxy[:proxy_port] = config[:port] if config.key?(:port)
            proxy[:proxy_user] = config[:user] if config.key?(:user)
            proxy[:proxy_password] = config[:password] if config.key?(:password)
          end

          proxy
        end
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
katello-3.1.0.rc1 app/lib/actions/katello/repository/discover.rb
katello-3.0.1 app/lib/actions/katello/repository/discover.rb
katello-2.4.4 app/lib/actions/katello/repository/discover.rb
katello-3.0.0 app/lib/actions/katello/repository/discover.rb
katello-2.4.3 app/lib/actions/katello/repository/discover.rb
katello-3.0.0.rc7 app/lib/actions/katello/repository/discover.rb
katello-3.0.0.rc5 app/lib/actions/katello/repository/discover.rb
katello-2.4.2 app/lib/actions/katello/repository/discover.rb
katello-3.0.0.rc4 app/lib/actions/katello/repository/discover.rb
katello-3.0.0.rc3 app/lib/actions/katello/repository/discover.rb
katello-3.0.0.rc2 app/lib/actions/katello/repository/discover.rb
katello-3.0.0.rc1 app/lib/actions/katello/repository/discover.rb
katello-2.4.1 app/lib/actions/katello/repository/discover.rb
katello-2.4.0 app/lib/actions/katello/repository/discover.rb
katello-2.4.0.rc3 app/lib/actions/katello/repository/discover.rb
katello-2.4.0.rc2 app/lib/actions/katello/repository/discover.rb
katello-2.4.0.rc1 app/lib/actions/katello/repository/discover.rb