Class: Actions::Katello::Repository::Discover

Inherits:
Base
  • Object
show all
Includes:
Dynflow::Action::Cancellable
Defined in:
app/lib/actions/katello/repository/discover.rb

Instance Method Summary collapse

Instance Method Details

#plan(url) ⇒ Object



15
16
17
# File 'app/lib/actions/katello/repository/discover.rb', line 15

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

#proxyObject



48
49
50
51
52
53
54
55
56
57
58
59
# File 'app/lib/actions/katello/repository/discover.rb', line 48

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

#run(event = nil) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/lib/actions/katello/repository/discover.rb', line 19

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

#task_inputString

Returns urls found by the action.

Returns:

  • (String)

    urls found by the action



39
40
41
# File 'app/lib/actions/katello/repository/discover.rb', line 39

def task_input
  input[:url]
end

#task_outputArray<String>

Returns urls found by the action.

Returns:

  • (Array<String>)

    urls found by the action



44
45
46
# File 'app/lib/actions/katello/repository/discover.rb', line 44

def task_output
  output[:repo_urls] || []
end