foreman-tasks 12.1.0 → 12.1.1
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 51404155da98c410758c31a9dcb5648d4fc6144823baf0f1e9917df7ecf72777
|
|
4
|
+
data.tar.gz: 37a731595c5e39dd3492fc51f8405bf96806f127f8c7606efe6c327c9e7a0321
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2b5563312efffad6871f30a4adb94c5579d5208205e6733ed35fe52b409e1fdcb0b8d1526a71ffe3ac57d852742eabe015a21e5d4a5b1fe2f359b3f5a3915950
|
|
7
|
+
data.tar.gz: 60e82330e3f9eedac8729b2c5060c1597d142081287616f4ff3d284c71b5d5d39644de6072f2c825069b9d6d972d564723700dce10baa43cdaf20504208c3910
|
|
@@ -13,12 +13,6 @@ module Actions
|
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
# @see Lock.lock!
|
|
17
|
-
def lock!(resource, *_lock_names)
|
|
18
|
-
Foreman::Deprecation.deprecation_warning('2.4', 'locking in foreman-tasks was reworked, please use a combination of exclusive_lock! and link! instead.')
|
|
19
|
-
exclusive_lock!(resource)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
16
|
# @see Lock.link!
|
|
23
17
|
def link!(resource)
|
|
24
18
|
phase! Dynflow::Action::Plan
|
|
@@ -12,26 +12,20 @@ module Actions
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def run(*args)
|
|
15
|
-
|
|
15
|
+
restore_current_user { pass(*args) }
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def finalize
|
|
19
|
-
|
|
20
|
-
saved_id = action.input[:current_user_id]
|
|
21
|
-
if User.current && saved_id && current_id != saved_id
|
|
22
|
-
Foreman::Deprecation.deprecation_warning('2.5', 'relying on per-step setting of current user in finalize phase')
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
restore_curent_user { pass }
|
|
19
|
+
restore_current_user { pass }
|
|
26
20
|
end
|
|
27
21
|
|
|
28
22
|
def finalize_phase(execution_plan, *args)
|
|
29
|
-
|
|
23
|
+
restore_current_user(execution_plan.entry_action) { pass(execution_plan, *args) }
|
|
30
24
|
end
|
|
31
25
|
|
|
32
26
|
# Run all execution plan lifecycle hooks as the original user
|
|
33
27
|
def hook(*args)
|
|
34
|
-
|
|
28
|
+
restore_current_user { pass(*args) }
|
|
35
29
|
end
|
|
36
30
|
|
|
37
31
|
private
|
|
@@ -40,7 +34,7 @@ module Actions
|
|
|
40
34
|
if User.current || action.input[:current_user_id].nil?
|
|
41
35
|
yield
|
|
42
36
|
else
|
|
43
|
-
|
|
37
|
+
restore_current_user { yield }
|
|
44
38
|
end
|
|
45
39
|
end
|
|
46
40
|
|
|
@@ -48,7 +42,7 @@ module Actions
|
|
|
48
42
|
action.input[:current_user_id] = User.current.try(:id)
|
|
49
43
|
end
|
|
50
44
|
|
|
51
|
-
def
|
|
45
|
+
def restore_current_user(action = self.action)
|
|
52
46
|
old_user = User.current
|
|
53
47
|
User.current = User.unscoped.find(action.input[:current_user_id]) if action.input[:current_user_id].present?
|
|
54
48
|
yield
|