foreman-tasks 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -132,15 +132,21 @@ module ForemanTasks
|
|
132
132
|
raise 'unexpected method'
|
133
133
|
end
|
134
134
|
if action
|
135
|
-
|
136
|
-
raise "Executing dynflow action inside a transaction is not a good idea"
|
137
|
-
end
|
135
|
+
ensure_not_in_transaction!
|
138
136
|
yield.tap { |result| execute_planned_action if result }
|
139
137
|
else
|
140
138
|
yield
|
141
139
|
end
|
142
140
|
end
|
143
141
|
|
142
|
+
# we don't want to start executing the task calling to external services
|
143
|
+
# when inside some other transaction. Might lead to unexpected results
|
144
|
+
def ensure_not_in_transaction!
|
145
|
+
if self.class.connection.open_transactions > 0
|
146
|
+
raise "Executing dynflow action inside a transaction is not a good idea"
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
144
150
|
# Execute the prepared execution plan after the db transaction was commited
|
145
151
|
def execute_planned_action
|
146
152
|
if @execution_plan
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman-tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-03-
|
12
|
+
date: 2014-03-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|