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

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

Instance Method Summary collapse

Instance Method Details

#plan(url, content_type, upstream_username, upstream_password, search) ⇒ Object



20
21
22
23
# File 'app/lib/actions/katello/repository/discover.rb', line 20

def plan(url, content_type, upstream_username, upstream_password, search)
  password = encrypt_field(upstream_password)
  plan_self(url: url, content_type: content_type, upstream_username: upstream_username, upstream_password: password, search: search)
end

#run(event = nil) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'app/lib/actions/katello/repository/discover.rb', line 25

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

  match(event,
    (on nil do
      unless output[:to_follow].empty?
        password = decrypt_field(input[:upstream_password])
        repo_discovery = ::Katello::RepoDiscovery.new(input[:url], input[:content_type],
                                                      input[:upstream_username], password,
                                                      input[:search],
                                                      output[:crawled], output[:repo_urls], output[:to_follow])

        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_outputArray<String>

Returns urls found by the action.

Returns:

  • (Array<String>)

    urls found by the action



49
50
51
# File 'app/lib/actions/katello/repository/discover.rb', line 49

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