foreman-tasks 0.7.17 → 0.7.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/foreman_tasks/task/dynflow_task.rb +5 -4
- data/app/models/foreman_tasks/triggering.rb +6 -6
- data/app/views/foreman_tasks/tasks/_details.html.erb +1 -1
- data/lib/foreman_tasks/dynflow.rb +1 -0
- data/lib/foreman_tasks/dynflow/configuration.rb +5 -3
- data/lib/foreman_tasks/dynflow/persistence.rb +3 -5
- data/lib/foreman_tasks/engine.rb +6 -8
- data/lib/foreman_tasks/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 09501ff6d55c7b3dd3433795384e07b36813b746
|
4
|
+
data.tar.gz: 1c38dfc4abcb803584cd88d5154ea66115840904
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bb4ca4e6a26e38604f4d5b4e6bb58296c2b07c676f3f615126de2a88e545d475453e5a10b5dc80aff3201deb1082a3b7cb7f37d2219808046f766bb4452fb63
|
7
|
+
data.tar.gz: 5fcbb29b5e8e1a33cb37a1d233f83be129c8377357d721cfe0793f18b723a1d6587b774ba21494fe6322c9e1749bb9342ce2813dff3d8aa21b31be9870728839
|
@@ -6,13 +6,14 @@ module ForemanTasks
|
|
6
6
|
scope :for_action, ->(action_class) { where(label: action_class.name) }
|
7
7
|
|
8
8
|
def update_from_dynflow(data)
|
9
|
+
utc_zone = ActiveSupport::TimeZone.new('UTC')
|
9
10
|
self.external_id = data[:id]
|
10
|
-
self.started_at = data[:started_at]
|
11
|
-
self.ended_at = data[:ended_at]
|
11
|
+
self.started_at = utc_zone.parse(data[:started_at]) unless data[:started_at].nil?
|
12
|
+
self.ended_at = utc_zone.parse(data[:ended_at]) unless data[:ended_at].nil?
|
12
13
|
self.state = data[:state].to_s
|
13
14
|
self.result = data[:result].to_s
|
14
|
-
self.start_at = data[:start_at] if data[:start_at]
|
15
|
-
self.start_before = data[:start_before] if data[:start_before]
|
15
|
+
self.start_at = utc_zone.parse(data[:start_at]) if data[:start_at]
|
16
|
+
self.start_before = utc_zone.parse(data[:start_before]) if data[:start_before]
|
16
17
|
self.parent_task_id ||= begin
|
17
18
|
if main_action.caller_execution_plan_id
|
18
19
|
DynflowTask.where(:external_id => main_action.caller_execution_plan_id).first!.id
|
@@ -11,7 +11,7 @@ module ForemanTasks
|
|
11
11
|
parse_start_at!
|
12
12
|
parse_start_before!
|
13
13
|
else
|
14
|
-
self.start_at ||= Time.now
|
14
|
+
self.start_at ||= Time.zone.now
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -43,7 +43,7 @@ module ForemanTasks
|
|
43
43
|
triggering.mode = params.fetch(:mode, :immediate).to_sym
|
44
44
|
triggering.input_type = params.fetch(:input_type, :daily).to_sym
|
45
45
|
triggering.end_time_limited = params[:end_time_limited] == "true"
|
46
|
-
triggering.start_at_raw ||= Time.now.strftime(TIME_FORMAT)
|
46
|
+
triggering.start_at_raw ||= Time.zone.now.strftime(TIME_FORMAT)
|
47
47
|
triggering.recurring_logic = ::ForemanTasks::RecurringLogic.new_from_triggering(triggering) if triggering.recurring?
|
48
48
|
end
|
49
49
|
end
|
@@ -75,8 +75,8 @@ module ForemanTasks
|
|
75
75
|
|
76
76
|
def delay_options
|
77
77
|
{
|
78
|
-
:start_at => start_at,
|
79
|
-
:start_before => start_before
|
78
|
+
:start_at => start_at.utc,
|
79
|
+
:start_before => start_before.try(:utc)
|
80
80
|
}
|
81
81
|
end
|
82
82
|
|
@@ -93,11 +93,11 @@ module ForemanTasks
|
|
93
93
|
end
|
94
94
|
|
95
95
|
def parse_start_at!
|
96
|
-
self.start_at ||= Time.
|
96
|
+
self.start_at ||= Time.zone.parse(start_at_raw)
|
97
97
|
end
|
98
98
|
|
99
99
|
def parse_start_before!
|
100
|
-
self.start_before ||= Time.
|
100
|
+
self.start_before ||= Time.zone.parse(start_before_raw) unless start_before_raw.blank?
|
101
101
|
end
|
102
102
|
|
103
103
|
private
|
@@ -184,7 +184,7 @@
|
|
184
184
|
<div>
|
185
185
|
<span class="param-name"><%= _("Errors") %>:</span>
|
186
186
|
<span class="param-value">
|
187
|
-
<pre><%=
|
187
|
+
<pre><%=Array(@task.humanized[:errors]).join("\n") %></pre>
|
188
188
|
</span>
|
189
189
|
</div>
|
190
190
|
<% end %>
|
@@ -43,6 +43,7 @@ module ForemanTasks
|
|
43
43
|
unless config.remote?
|
44
44
|
# don't try to do any rescuing until the tables are properly migrated
|
45
45
|
if !Foreman.in_rake?('db:migrate') && (ForemanTasks::Task.table_exists? rescue(false))
|
46
|
+
config.run_on_init_hooks(world)
|
46
47
|
world.auto_execute
|
47
48
|
ForemanTasks::Task::DynflowTask.consistency_check
|
48
49
|
end
|
@@ -54,10 +54,12 @@ module ForemanTasks
|
|
54
54
|
@on_init << block
|
55
55
|
end
|
56
56
|
|
57
|
+
def run_on_init_hooks(world)
|
58
|
+
@on_init.each { |init| init.call(world) }
|
59
|
+
end
|
60
|
+
|
57
61
|
def initialize_world(world_class = ::Dynflow::World)
|
58
|
-
world_class.new(world_config)
|
59
|
-
@on_init.each { |init| init.call(world) }
|
60
|
-
end
|
62
|
+
world_class.new(world_config)
|
61
63
|
end
|
62
64
|
|
63
65
|
# No matter what config.remote says, when the process is marked as executor,
|
@@ -31,11 +31,9 @@ module ForemanTasks
|
|
31
31
|
when :scheduled
|
32
32
|
delayed_plan = load_delayed_plan(execution_plan_id)
|
33
33
|
raise Foreman::Exception.new('Plan is delayed but the delay record is missing') if delayed_plan.nil?
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
task.update_from_dynflow(data.merge(:start_at => delayed_plan.start_at,
|
38
|
-
:start_before => delayed_plan.start_before))
|
34
|
+
task = ::ForemanTasks::Task::DynflowTask.find_by!(:external_id => execution_plan_id)
|
35
|
+
task.update_from_dynflow(data.merge(:start_at => delayed_plan[:start_at],
|
36
|
+
:start_before => delayed_plan[:start_before]))
|
39
37
|
when :planning
|
40
38
|
task = ::ForemanTasks::Task::DynflowTask.where(:external_id => execution_plan_id).first
|
41
39
|
task.update_from_dynflow(data)
|
data/lib/foreman_tasks/engine.rb
CHANGED
@@ -122,8 +122,13 @@ module ForemanTasks
|
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
125
|
-
|
125
|
+
config.to_prepare do
|
126
|
+
ForemanTasks.dynflow.eager_load_actions! if ForemanTasks.dynflow.initialized?
|
127
|
+
|
128
|
+
Authorizer.send(:include, AuthorizerExt)
|
129
|
+
end
|
126
130
|
|
131
|
+
config.after_initialize do
|
127
132
|
ForemanTasks.dynflow.eager_load_actions!
|
128
133
|
ForemanTasks.dynflow.config.increase_db_pool_size
|
129
134
|
|
@@ -140,13 +145,6 @@ module ForemanTasks
|
|
140
145
|
end
|
141
146
|
end
|
142
147
|
|
143
|
-
config.to_prepare do
|
144
|
-
ForemanTasks.dynflow.eager_load_actions!
|
145
|
-
|
146
|
-
Authorizer.send(:include, AuthorizerExt)
|
147
|
-
end
|
148
|
-
|
149
|
-
|
150
148
|
rake_tasks do
|
151
149
|
%w[dynflow.rake test.rake export_tasks.rake cleanup.rake].each do |rake_file|
|
152
150
|
full_path = File.expand_path("../tasks/#{rake_file}", __FILE__)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman-tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Nečas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dynflow
|