smart_proxy_dynflow 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +11 -4
  3. data/bundler.d/dynflow.rb +2 -0
  4. data/lib/smart_proxy_dynflow/action/batch.rb +6 -1
  5. data/lib/smart_proxy_dynflow/action/batch_callback.rb +4 -0
  6. data/lib/smart_proxy_dynflow/action/batch_runner.rb +2 -0
  7. data/lib/smart_proxy_dynflow/action/external_polling.rb +2 -0
  8. data/lib/smart_proxy_dynflow/action/output_collector.rb +2 -0
  9. data/lib/smart_proxy_dynflow/action/runner.rb +3 -0
  10. data/lib/smart_proxy_dynflow/action/shareable.rb +2 -0
  11. data/lib/smart_proxy_dynflow/action/single_runner_batch.rb +4 -0
  12. data/lib/smart_proxy_dynflow/action.rb +2 -0
  13. data/lib/smart_proxy_dynflow/api.rb +4 -5
  14. data/lib/smart_proxy_dynflow/callback.rb +5 -0
  15. data/lib/smart_proxy_dynflow/continuous_output.rb +4 -0
  16. data/lib/smart_proxy_dynflow/core.rb +5 -2
  17. data/lib/smart_proxy_dynflow/helpers.rb +4 -2
  18. data/lib/smart_proxy_dynflow/http_config.ru +2 -0
  19. data/lib/smart_proxy_dynflow/io_buffer.rb +4 -2
  20. data/lib/smart_proxy_dynflow/log.rb +3 -1
  21. data/lib/smart_proxy_dynflow/middleware/keep_current_request_id.rb +4 -2
  22. data/lib/smart_proxy_dynflow/otp_manager.rb +5 -2
  23. data/lib/smart_proxy_dynflow/plugin.rb +2 -0
  24. data/lib/smart_proxy_dynflow/process_manager.rb +3 -0
  25. data/lib/smart_proxy_dynflow/proxy_adapter.rb +2 -0
  26. data/lib/smart_proxy_dynflow/runner/base.rb +4 -1
  27. data/lib/smart_proxy_dynflow/runner/command.rb +3 -0
  28. data/lib/smart_proxy_dynflow/runner/command_runner.rb +2 -0
  29. data/lib/smart_proxy_dynflow/runner/dispatcher.rb +12 -6
  30. data/lib/smart_proxy_dynflow/runner/parent.rb +2 -0
  31. data/lib/smart_proxy_dynflow/runner/process_manager_command.rb +3 -1
  32. data/lib/smart_proxy_dynflow/runner/update.rb +4 -0
  33. data/lib/smart_proxy_dynflow/runner.rb +2 -0
  34. data/lib/smart_proxy_dynflow/settings.rb +2 -0
  35. data/lib/smart_proxy_dynflow/settings_loader.rb +5 -0
  36. data/lib/smart_proxy_dynflow/task_launcher/abstract.rb +3 -0
  37. data/lib/smart_proxy_dynflow/task_launcher/batch.rb +2 -0
  38. data/lib/smart_proxy_dynflow/task_launcher/group.rb +2 -0
  39. data/lib/smart_proxy_dynflow/task_launcher/single.rb +2 -0
  40. data/lib/smart_proxy_dynflow/task_launcher.rb +2 -0
  41. data/lib/smart_proxy_dynflow/task_launcher_registry.rb +2 -0
  42. data/lib/smart_proxy_dynflow/testing.rb +2 -0
  43. data/lib/smart_proxy_dynflow/ticker.rb +2 -0
  44. data/lib/smart_proxy_dynflow/version.rb +3 -1
  45. data/lib/smart_proxy_dynflow.rb +2 -0
  46. metadata +19 -99
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86c46197119a24e70fc65afe7698d99473b5aaaae0eb2b32aed48523a03de021
4
- data.tar.gz: ea987bf5d6797680a8c37c9e03d4872ad714254624a98195749594febdaddb06
3
+ metadata.gz: 3dbe59b9e06226b0bf592d09dc4de26afbb750182e539f0c6c718cac2a3b03de
4
+ data.tar.gz: 963d6a3dbbe3614d679bbe35670690565017c641c291902a1d4ba28997b48897
5
5
  SHA512:
6
- metadata.gz: b1fdc2770779b35094098506a8178696708a8c207e083fd1c3cd1d148fc63eca35cefdad3698e86f2915919a935ae2c560f7c250251fb1eddf91dd27ebf7e339
7
- data.tar.gz: fb649ed0bf1c2d7a56f30ff29c5cc718b93832700d109a92740fd43813c0fa73be424eaa0b9d363696e9e4faae45f9bb4d1a5aa2efa5c43ca35032332f13f3eb
6
+ metadata.gz: 3cfcbeac72c226adc5cff8ac199651f1f3ca6ad1af498c0ea21109805e87513f41c94b6818e3dbeb9a6aa8ec7dda70ff80a991ba917198bb01f51d90125293cc
7
+ data.tar.gz: dfcc163c0b6e355a7fa73d1c5ad56cdf96c54633d30094f3de3bab64bce2b652d84bc8fc254d642e69fd251a02f4041c6beb7ec2dee00edc59847db2efb4aa32
data/Gemfile CHANGED
@@ -1,23 +1,30 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec :name => 'smart_proxy_dynflow'
4
6
 
7
+ group :rubocop do
8
+ gem 'rubocop', '~> 1.28.0'
9
+ gem 'rubocop-minitest'
10
+ gem 'rubocop-performance'
11
+ gem 'rubocop-rake'
12
+ end
13
+
5
14
  group :development do
6
15
  gem 'pry'
7
16
  end
8
17
 
9
18
  group :test do
10
- gem 'smart_proxy', :git => "https://github.com/theforeman/smart-proxy", :branch => "develop"
11
-
12
19
  gem 'minitest'
13
20
  gem 'mocha'
14
21
  gem 'public_suffix'
15
22
  gem 'rack-test'
16
23
  gem 'rake'
17
- gem 'rubocop', '~> 0.52.1'
24
+ gem 'smart_proxy', :git => "https://github.com/theforeman/smart-proxy", :branch => "develop"
25
+ gem 'webmock'
18
26
  end
19
27
 
20
- gem 'logging-journald', '~> 2.0', :platforms => [:ruby], :require => false
21
28
  gem 'rack', '>= 1.1'
22
29
  gem 'sinatra'
23
30
 
data/bundler.d/dynflow.rb CHANGED
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  gem 'smart_proxy_dynflow'
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Proxy::Dynflow::Action
2
4
  class Batch < ::Dynflow::Action
3
5
  include Dynflow::Action::WithSubPlans
4
- include Dynflow::Action::WithPollingSubPlans
5
6
 
6
7
  # { execution_plan_uuid => { :action_class => Klass, :input => input } }
7
8
  def plan(launcher, input_hash)
@@ -18,5 +19,9 @@ module Proxy::Dynflow::Action
18
19
  def rescue_strategy
19
20
  Dynflow::Action::Rescue::Fail
20
21
  end
22
+
23
+ def notify_on_finish(_plans)
24
+ # Do nothing
25
+ end
21
26
  end
22
27
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Proxy::Dynflow::Action
2
4
  class BatchCallback < ::Dynflow::Action
3
5
  def plan(input_hash, results)
@@ -12,6 +14,8 @@ module Proxy::Dynflow::Action
12
14
  def run
13
15
  payload = format_payload(input['targets'], input['results'])
14
16
  Proxy::Dynflow::Callback::Request.new.callback({ :callbacks => payload }.to_json)
17
+ ensure
18
+ input.delete(:results)
15
19
  end
16
20
 
17
21
  private
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'smart_proxy_dynflow/action/runner'
2
4
 
3
5
  module Proxy::Dynflow::Action
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Proxy::Dynflow::Action
2
4
  module WithExternalPolling
3
5
  Poll = Algebrick.atom
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Proxy::Dynflow::Action
2
4
  class OutputCollector < ::Proxy::Dynflow::Action::Runner
3
5
  def init_run
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'smart_proxy_dynflow/action/shareable'
2
4
  require 'smart_proxy_dynflow/action/external_polling'
3
5
  module Proxy::Dynflow
@@ -58,6 +60,7 @@ module Proxy::Dynflow
58
60
  def finish_run(update)
59
61
  output[:exit_status] = update.exit_status
60
62
  output[:result] = output_result
63
+ drop_output_chunks!
61
64
  end
62
65
 
63
66
  def process_external_event(event)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Proxy::Dynflow::Action
2
4
  class Shareable < ::Dynflow::Action
3
5
  def plan(input)
@@ -1,5 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Proxy::Dynflow::Action
2
4
  class SingleRunnerBatch < Batch
5
+ include Dynflow::Action::WithPollingSubPlans
6
+
3
7
  def plan(launcher, input_hash)
4
8
  results = super
5
9
  plan_action BatchCallback, input_hash, results.output[:results]
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Proxy::Dynflow
2
4
  module Action
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'sinatra/base'
2
4
  require 'proxy/helpers'
3
5
  require 'sinatra/authorization'
@@ -11,7 +13,7 @@ module Proxy
11
13
 
12
14
  include ::Sinatra::Authorization::Helpers
13
15
 
14
- TASK_UPDATE_REGEXP_PATH = %r{/tasks/(\S+)/(update|done)}
16
+ TASK_UPDATE_REGEXP_PATH = %r{/tasks/(\S+)/(update|done)}.freeze
15
17
 
16
18
  before do
17
19
  if match = request.path_info.match(TASK_UPDATE_REGEXP_PATH)
@@ -27,10 +29,7 @@ module Proxy
27
29
  post "/tasks/status" do
28
30
  params = MultiJson.load(request.body.read)
29
31
  ids = params.fetch('task_ids', [])
30
- result = world.persistence
31
- .find_execution_plans(:filters => { :uuid => ids }).reduce({}) do |acc, plan|
32
- acc.update(plan.id => { 'state' => plan.state, 'result' => plan.result })
33
- end
32
+ result = world.persistence.find_execution_plan_statuses(:filters => { :uuid => ids })
34
33
  MultiJson.dump(result)
35
34
  end
36
35
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rest-client'
2
4
 
3
5
  module Proxy::Dynflow
@@ -15,6 +17,7 @@ module Proxy::Dynflow
15
17
  if response.code.to_s != "200"
16
18
  raise "Failed performing callback to Foreman server: #{response.code} #{response.body}"
17
19
  end
20
+
18
21
  response
19
22
  end
20
23
  end
@@ -26,6 +29,8 @@ module Proxy::Dynflow
26
29
 
27
30
  def run
28
31
  Callback::Request.send_to_foreman_tasks(input[:callback], input[:data])
32
+ ensure
33
+ input.delete(:data)
29
34
  end
30
35
  end
31
36
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Proxy::Dynflow
2
4
  class ContinuousOutput
3
5
  attr_accessor :raw_outputs
@@ -12,6 +14,7 @@ module Proxy::Dynflow
12
14
  unless missing_args.empty?
13
15
  raise ArgumentError, "Missing args for raw output: #{missing_args.inspect}"
14
16
  end
17
+
15
18
  @raw_outputs << raw_output
16
19
  end
17
20
 
@@ -21,6 +24,7 @@ module Proxy::Dynflow
21
24
 
22
25
  def last_timestamp
23
26
  return if @raw_outputs.empty?
27
+
24
28
  @raw_outputs.last.fetch('timestamp')
25
29
  end
26
30
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'fileutils'
2
4
 
3
5
  module Proxy::Dynflow
@@ -24,6 +26,7 @@ module Proxy::Dynflow
24
26
 
25
27
  def persistence_conn_string
26
28
  return ENV['DYNFLOW_DB_CONN_STRING'] if ENV.key? 'DYNFLOW_DB_CONN_STRING'
29
+
27
30
  db_conn_string = 'sqlite:/'
28
31
 
29
32
  db_file = Settings.instance.database
@@ -72,6 +75,7 @@ module Proxy::Dynflow
72
75
 
73
76
  def ensure_initialized
74
77
  return @instance if @instance
78
+
75
79
  @instance = Core.new
76
80
  after_initialize_blocks.each { |block| block.call(@instance) }
77
81
  @instance
@@ -87,7 +91,7 @@ module Proxy::Dynflow
87
91
 
88
92
  def web_console
89
93
  require 'dynflow/web'
90
- dynflow_console = ::Dynflow::Web.setup do
94
+ ::Dynflow::Web.setup do
91
95
  # we can't use the proxy's after_activation hook, as
92
96
  # it happens before the Daemon forks the process (including
93
97
  # closing opened file descriptors)
@@ -103,7 +107,6 @@ module Proxy::Dynflow
103
107
  Core.ensure_initialized
104
108
  set :world, Core.world
105
109
  end
106
- dynflow_console
107
110
  end
108
111
 
109
112
  def world
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'smart_proxy_dynflow/action/external_polling'
2
4
  require 'smart_proxy_dynflow/action/runner'
3
5
 
@@ -54,8 +56,8 @@ module Proxy
54
56
  def tasks_count(state)
55
57
  state ||= 'all'
56
58
  filter = state != 'all' ? { :filters => { :state => [state] } } : {}
57
- tasks = world.persistence.find_execution_plans(filter)
58
- { :count => tasks.count, :state => state }
59
+ count = world.persistence.find_execution_plan_counts(filter)
60
+ { :count => count, :state => state }
59
61
  end
60
62
 
61
63
  def dispatch_external_event(task_id, params)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'smart_proxy_dynflow/api'
2
4
 
3
5
  map "/dynflow" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Proxy
2
4
  module Dynflow
3
5
  # A buffer around an IO object providing buffering and convenience methods
@@ -71,7 +73,7 @@ module Proxy
71
73
  def read_available!
72
74
  data = ''
73
75
  loop { data += @io.read_nonblock(4096) }
74
- rescue IO::WaitReadable # rubocop:disable Lint/HandleExceptions
76
+ rescue IO::WaitReadable # rubocop:disable Lint/SuppressedException
75
77
  rescue EOFError
76
78
  close
77
79
  ensure
@@ -88,7 +90,7 @@ module Proxy
88
90
  n = @io.write_nonblock(@buffer)
89
91
  @buffer = @buffer[n..-1]
90
92
  end
91
- rescue IO::WaitWritable # rubocop:disable Lint/HandleExceptions
93
+ rescue IO::WaitWritable # rubocop:disable Lint/SuppressedException
92
94
  rescue EOFError
93
95
  close
94
96
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'logging'
2
4
 
3
5
  module Proxy::Dynflow
4
6
  class Log
5
- LOGGER_NAME = 'dynflow-core'.freeze
7
+ LOGGER_NAME = 'dynflow-core'
6
8
 
7
9
  begin
8
10
  require 'syslog/logger'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Actions
2
4
  module Middleware
3
5
  class KeepCurrentRequestID < Dynflow::Middleware
@@ -26,11 +28,11 @@ module Actions
26
28
 
27
29
  private
28
30
 
29
- def with_current_request_id
31
+ def with_current_request_id(&block)
30
32
  if action.input[:current_request_id].nil?
31
33
  yield
32
34
  else
33
- restore_current_request_id { yield }
35
+ restore_current_request_id(&block)
34
36
  end
35
37
  end
36
38
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'base64'
2
4
  require 'securerandom'
3
5
 
@@ -20,9 +22,10 @@ module Proxy::Dynflow
20
22
  def authenticate(hash, expected_user: nil, clear: true)
21
23
  plain = Base64.decode64(hash)
22
24
  username, otp = plain.split(':', 2)
23
- if expected_user
24
- return false unless expected_user == username
25
+ if expected_user && expected_user != username
26
+ return false
25
27
  end
28
+
26
29
  password_matches = passwords[username] == otp
27
30
  passwords.delete(username) if clear && password_matches
28
31
  password_matches
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'proxy/log'
2
4
  require 'proxy/pluggable'
3
5
  require 'proxy/plugin'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'smart_proxy_dynflow/io_buffer'
2
4
 
3
5
  module Proxy
@@ -117,6 +119,7 @@ module Proxy
117
119
  # @return [void]
118
120
  def process(timeout: nil)
119
121
  raise 'Cannot process until the manager is started' unless started?
122
+
120
123
  writers = [@stdin].reject { |buf| buf.empty? || buf.closed? }
121
124
  readers = [@stdout, @stderr].reject(&:closed?)
122
125
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Proxy
2
4
  module Dynflow
3
5
  class ProxyAdapter < ::Dynflow::LoggerAdapters::Simple
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Proxy::Dynflow
2
4
  module Runner
3
5
  # Runner is an object that is able to initiate some action and
@@ -13,7 +15,7 @@ module Proxy::Dynflow
13
15
  end
14
16
 
15
17
  def logger
16
- @logger ||= Logger.new(STDERR)
18
+ @logger ||= Logger.new($stderr)
17
19
  end
18
20
 
19
21
  def run_refresh
@@ -77,6 +79,7 @@ module Proxy::Dynflow
77
79
 
78
80
  def generate_updates
79
81
  return no_update if @continuous_output.empty? && @exit_status.nil?
82
+
80
83
  new_data = @continuous_output
81
84
  @continuous_output = Proxy::Dynflow::ContinuousOutput.new
82
85
  new_update(new_data, @exit_status)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Proxy::Dynflow
2
4
  module Runner
3
5
  # This module expects to be included into a Runner action, where it can be
@@ -22,6 +24,7 @@ module Proxy::Dynflow
22
24
 
23
25
  def refresh
24
26
  return if @command_out.nil?
27
+
25
28
  ready_outputs, * = IO.select([@command_out], nil, nil, 0.1)
26
29
  if ready_outputs
27
30
  if @command_out.nread.positive?
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'io/wait'
2
4
  require 'pty'
3
5
  require 'smart_proxy_dynflow/runner/command'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'smart_proxy_dynflow/ticker'
2
4
 
3
5
  module Proxy::Dynflow
@@ -5,6 +7,7 @@ module Proxy::Dynflow
5
7
  class Dispatcher
6
8
  def self.instance
7
9
  return @instance if @instance
10
+
8
11
  @instance = new(Proxy::Dynflow::Core.world.clock,
9
12
  Proxy::Dynflow::Core.world.logger)
10
13
  end
@@ -110,6 +113,7 @@ module Proxy::Dynflow
110
113
  end
111
114
 
112
115
  attr_reader :ticker
116
+
113
117
  def initialize(clock, logger)
114
118
  @mutex = Mutex.new
115
119
  @clock = clock
@@ -126,14 +130,15 @@ module Proxy::Dynflow
126
130
  def start(suspended_action, runner)
127
131
  synchronize do
128
132
  raise "Actor with runner id #{runner.id} already exists" if @runner_actors[runner.id]
133
+
129
134
  runner.logger = @logger
130
135
  runner_actor = RunnerActor.spawn("runner-actor-#{runner.id}", self, suspended_action, runner, @clock, @logger)
131
136
  @runner_actors[runner.id] = runner_actor
132
137
  @runner_suspended_actions[runner.id] = suspended_action
133
138
  runner_actor.tell(:start_runner)
134
139
  return runner.id
135
- rescue => exception
136
- _handle_command_exception(runner.id, exception)
140
+ rescue => e
141
+ _handle_command_exception(runner.id, e)
137
142
  return nil
138
143
  end
139
144
  end
@@ -142,16 +147,16 @@ module Proxy::Dynflow
142
147
  synchronize do
143
148
  runner_actor = @runner_actors[runner_id]
144
149
  runner_actor&.tell(:kill)
145
- rescue => exception
146
- _handle_command_exception(runner_id, exception, false)
150
+ rescue => e
151
+ _handle_command_exception(runner_id, e, false)
147
152
  end
148
153
  end
149
154
 
150
155
  def finish(runner_id)
151
156
  synchronize do
152
157
  _finish(runner_id)
153
- rescue => exception
154
- _handle_command_exception(runner_id, exception, false)
158
+ rescue => e
159
+ _handle_command_exception(runner_id, e, false)
155
160
  end
156
161
  end
157
162
 
@@ -181,6 +186,7 @@ module Proxy::Dynflow
181
186
  def _finish(runner_id)
182
187
  runner_actor = @runner_actors.delete(runner_id)
183
188
  return unless runner_actor
189
+
184
190
  @logger.debug("closing session for command [#{runner_id}]," \
185
191
  "#{@runner_actors.size} actors left ")
186
192
  runner_actor.tell([:start_termination, Concurrent::Promises.resolvable_future])
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Proxy::Dynflow
2
4
  module Runner
3
5
  class Parent < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'smart_proxy_dynflow/process_manager'
2
4
 
3
5
  module Proxy::Dynflow
@@ -20,7 +22,7 @@ module Proxy::Dynflow
20
22
  end
21
23
  end
22
24
 
23
- def set_process_manager_callbacks(pm)
25
+ def set_process_manager_callbacks(pm) # rubocop:disable Naming/MethodParameterName
24
26
  pm.on_stdout do |data|
25
27
  publish_data(data, 'stdout')
26
28
  ''
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'smart_proxy_dynflow/continuous_output'
2
4
 
3
5
  module Proxy::Dynflow
@@ -6,6 +8,7 @@ module Proxy::Dynflow
6
8
  # can be consumed by other components, such as RunnerAction
7
9
  class Update
8
10
  attr_reader :continuous_output, :exit_status
11
+
9
12
  def initialize(continuous_output, exit_status)
10
13
  @continuous_output = continuous_output
11
14
  @exit_status = exit_status
@@ -20,6 +23,7 @@ module Proxy::Dynflow
20
23
 
21
24
  class ExternalEvent
22
25
  attr_reader :data
26
+
23
27
  def initialize(data = {})
24
28
  @data = data
25
29
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Proxy::Dynflow
2
4
  module Runner
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # require 'ostruct'
2
4
 
3
5
  module Proxy::Dynflow
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Proxy::Dynflow
2
4
  module SettingsLoader
3
5
  def self.settings_registry
@@ -21,6 +23,7 @@ module Proxy::Dynflow
21
23
  names.each do |name|
22
24
  raise 'settings name has to be a symbol' unless name.is_a? Symbol
23
25
  raise "settings #{name} already registered" if SettingsLoader.settings_registered?(name)
26
+
24
27
  name_to_settings[name] = object
25
28
  end
26
29
  settings_registry[names] = object
@@ -28,6 +31,7 @@ module Proxy::Dynflow
28
31
 
29
32
  def self.setup_settings(name, settings)
30
33
  raise "Settings for #{name} were not registered" unless settings_registered?(name)
34
+
31
35
  name_to_settings[name].initialize_settings(settings)
32
36
  end
33
37
 
@@ -43,6 +47,7 @@ module Proxy::Dynflow
43
47
 
44
48
  def settings
45
49
  raise "Settings for #{self} not initalized" unless @settings
50
+
46
51
  @settings
47
52
  end
48
53
 
@@ -1,7 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Proxy::Dynflow
2
4
  module TaskLauncher
3
5
  class Abstract
4
6
  attr_reader :callback, :options, :results, :world
7
+
5
8
  def initialize(world, callback, options = {})
6
9
  @world = world
7
10
  @callback = callback
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Proxy::Dynflow
2
4
  module TaskLauncher
3
5
  class Batch < Abstract
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'smart_proxy_dynflow/runner'
2
4
 
3
5
  module Proxy::Dynflow
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Proxy::Dynflow
2
4
  module TaskLauncher
3
5
  class Single < Abstract
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Proxy::Dynflow
2
4
  module TaskLauncher
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Proxy::Dynflow
2
4
  class TaskLauncherRegistry
3
5
  class << self
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dynflow/testing'
2
4
 
3
5
  unless defined? DYNFLOW_TESTING_LOG_LEVEL
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dynflow'
2
4
 
3
5
  module Proxy::Dynflow
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Proxy
2
4
  module Dynflow
3
- VERSION = '0.9.0'.freeze
5
+ VERSION = '0.9.1'
4
6
  end
5
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dynflow'
2
4
 
3
5
  require 'smart_proxy_dynflow/task_launcher_registry'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_proxy_dynflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-11 00:00:00.000000000 Z
11
+ date: 2023-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dynflow
@@ -26,116 +26,32 @@ dependencies:
26
26
  version: '1.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rest-client
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: sqlite3
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: bundler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '1.7'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '1.7'
69
- - !ruby/object:Gem::Dependency
70
- name: minitest
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: mocha
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '1'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '1'
97
- - !ruby/object:Gem::Dependency
98
- name: rack-test
99
29
  requirement: !ruby/object:Gem::Requirement
100
30
  requirements:
101
31
  - - "~>"
102
32
  - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: rake
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '10.0'
118
- type: :development
33
+ version: '2.0'
34
+ type: :runtime
119
35
  prerelease: false
120
36
  version_requirements: !ruby/object:Gem::Requirement
121
37
  requirements:
122
38
  - - "~>"
123
39
  - !ruby/object:Gem::Version
124
- version: '10.0'
40
+ version: '2.0'
125
41
  - !ruby/object:Gem::Dependency
126
- name: webmock
42
+ name: sqlite3
127
43
  requirement: !ruby/object:Gem::Requirement
128
44
  requirements:
129
45
  - - "~>"
130
46
  - !ruby/object:Gem::Version
131
- version: '1'
132
- type: :development
47
+ version: '1.0'
48
+ type: :runtime
133
49
  prerelease: false
134
50
  version_requirements: !ruby/object:Gem::Requirement
135
51
  requirements:
136
52
  - - "~>"
137
53
  - !ruby/object:Gem::Version
138
- version: '1'
54
+ version: '1.0'
139
55
  description: " Use the Dynflow inside Foreman smart proxy\n"
140
56
  email:
141
57
  - inecas@redhat.com
@@ -192,8 +108,9 @@ files:
192
108
  homepage: https://github.com/theforeman/smart_proxy_dynflow
193
109
  licenses:
194
110
  - GPL-3.0
195
- metadata: {}
196
- post_install_message:
111
+ metadata:
112
+ rubygems_mfa_required: 'true'
113
+ post_install_message:
197
114
  rdoc_options: []
198
115
  require_paths:
199
116
  - lib
@@ -201,15 +118,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
201
118
  requirements:
202
119
  - - ">="
203
120
  - !ruby/object:Gem::Version
204
- version: '2.5'
121
+ version: '2.7'
122
+ - - "<"
123
+ - !ruby/object:Gem::Version
124
+ version: '4'
205
125
  required_rubygems_version: !ruby/object:Gem::Requirement
206
126
  requirements:
207
127
  - - ">="
208
128
  - !ruby/object:Gem::Version
209
129
  version: '0'
210
130
  requirements: []
211
- rubygems_version: 3.3.20
212
- signing_key:
131
+ rubygems_version: 3.1.6
132
+ signing_key:
213
133
  specification_version: 4
214
134
  summary: Dynflow runtime for Foreman smart proxy
215
135
  test_files: []