Class: Actions::Katello::Repository::Discover
- Inherits:
-
Base
- Object
- Base
- Actions::Katello::Repository::Discover
- Includes:
- Dynflow::Action::Cancellable
- Defined in:
- app/lib/actions/katello/repository/discover.rb
Instance Method Summary collapse
- #plan(url) ⇒ Object
- #proxy ⇒ Object
- #run(event = nil) ⇒ Object
-
#task_input ⇒ String
Urls found by the action.
-
#task_output ⇒ Array<String>
Urls found by the action.
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 |
#proxy ⇒ Object
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_input ⇒ String
Returns 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_output ⇒ Array<String>
Returns 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 |