inprovise 0.2.12 → 0.2.13
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 +8 -8
- data/lib/inprovise/control.rb +1 -1
- data/lib/inprovise/execution_context.rb +7 -7
- data/lib/inprovise/trigger_runner.rb +19 -8
- data/lib/inprovise/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDM3NDQyMTI2YjQ3MTdmY2QzNzBiM2U4ZDY3ZGIyYmI0MDNkYTUyNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTViNDMwM2JmNDI4YWE4MmU3YmQ0OTlhYjQ0YWI2MGQ5YjFmZDVhMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZGRlY2FhYTA5ZmE1NWIwNzI2NzMyMDdhZjE1NWJlZmZmM2NkZGYyNzhmYWRi
|
10
|
+
YzExMTYwZmE2NTcwOGRlYjk1YWU5NGIzZTYxZWEwMTgxMmQyZTI0MDQxMDhm
|
11
|
+
Y2U4MDExNDZkYjZkNzYzZDRjMzIwZDMxODc3OTlmZTlmZThlZjg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTc5ZTUwNmRhN2UxYzIyZWFmOGM0NTEyNmMxYjQxNWVmNzE3OTE4YmQ2NDk0
|
14
|
+
Y2YyNzgyYjIzMDg0MjE2M2Q5MzdlYzVmMTAwZTIwZjYxZGNiNjQwOTNjODJk
|
15
|
+
MWM3OGM3N2FmODQ0ZTdjMjYzMjQ3NWJlZjc3MTc3N2NmMjVkYjM=
|
data/lib/inprovise/control.rb
CHANGED
@@ -168,7 +168,7 @@ class Inprovise::Controller
|
|
168
168
|
@targets << tgt
|
169
169
|
[
|
170
170
|
if command == :trigger
|
171
|
-
Inprovise::TriggerRunner.new(tgt, cmdtgt)
|
171
|
+
Inprovise::TriggerRunner.new(tgt, cmdtgt, Inprovise.skip_dependencies)
|
172
172
|
else
|
173
173
|
Inprovise::ScriptRunner.new(tgt, Inprovise::ScriptIndex.default.get(cmdtgt), Inprovise.skip_dependencies)
|
174
174
|
end,
|
@@ -217,15 +217,15 @@ class Inprovise::ExecutionContext
|
|
217
217
|
|
218
218
|
def resolve_action_ref(action_ref)
|
219
219
|
action_name, scr_name = *action_ref.split(':', 2).reverse
|
220
|
-
scr = @
|
221
|
-
scr
|
222
|
-
action = scr ? scr.actions[action_name] : nil
|
223
|
-
raise Inprovise::MissingActionError.new(action_ref) unless action
|
224
|
-
[scr, action]
|
220
|
+
scr = scr_name ? @index.get(scr_name) : nil
|
221
|
+
[scr, action_name]
|
225
222
|
end
|
226
223
|
|
227
|
-
def trigger(scr,
|
228
|
-
|
224
|
+
def trigger(scr, action_name, *args)
|
225
|
+
scr ||= @script
|
226
|
+
action = scr ? scr.actions[action_name] : nil
|
227
|
+
raise Inprovise::MissingActionError.new("#{scr ? scr.name+':' : ''}#{action_name}") unless action
|
228
|
+
curtask = @node.log.set_task("#{scr.name}:#{action_name}")
|
229
229
|
curscript = @script
|
230
230
|
@script = scr
|
231
231
|
begin
|
@@ -4,10 +4,11 @@
|
|
4
4
|
# License:: Distributes under the same license as Ruby
|
5
5
|
|
6
6
|
class Inprovise::TriggerRunner
|
7
|
-
def initialize(node, action_ref_with_args)
|
7
|
+
def initialize(node, action_ref_with_args, skip_dependencies=false)
|
8
8
|
@node = node
|
9
9
|
@action_ref, @args = *parse_action_ref(action_ref_with_args)
|
10
10
|
@log = Inprovise::Logger.new(@node, @action_ref)
|
11
|
+
@skip_dependencies = skip_dependencies
|
11
12
|
@index = Inprovise::ScriptIndex.default
|
12
13
|
end
|
13
14
|
|
@@ -19,7 +20,7 @@ class Inprovise::TriggerRunner
|
|
19
20
|
Inprovise.log.local("Triggering #{@action_ref} for #{@node.to_s}")
|
20
21
|
context = Inprovise::ExecutionContext.new(@node, @log, @index, config)
|
21
22
|
scr, action = context.resolve_action_ref(@action_ref)
|
22
|
-
setup_configuration(scr, context)
|
23
|
+
setup_configuration(scr, context) if scr
|
23
24
|
context.trigger(scr, action, *@args)
|
24
25
|
end
|
25
26
|
|
@@ -27,18 +28,28 @@ class Inprovise::TriggerRunner
|
|
27
28
|
Inprovise.log.local("Demonstrating trigger #{@action_ref} for #{@node.to_s}")
|
28
29
|
context = Inprovise::MockExecutionContext.new(@node, @log, @index, config)
|
29
30
|
scr, action = context.resolve_action_ref(@action_ref)
|
30
|
-
setup_configuration(scr, context)
|
31
|
+
setup_configuration(scr, context) if scr
|
31
32
|
context.trigger(scr, action, *@args)
|
32
33
|
end
|
33
34
|
|
34
35
|
private
|
35
36
|
|
37
|
+
def scripts(script)
|
38
|
+
return [script] if @skip_dependencies
|
39
|
+
resolver = Inprovise::Resolver.new(script, @index)
|
40
|
+
resolver.resolve
|
41
|
+
resolver.scripts
|
42
|
+
end
|
43
|
+
|
36
44
|
def setup_configuration(script, context)
|
37
|
-
script
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
45
|
+
script_list = scripts(script)
|
46
|
+
script_list.each { |scr| scr.update_configuration(context) }
|
47
|
+
script_list.each do |scr|
|
48
|
+
context.log.set_task(scr)
|
49
|
+
context.log.command(:configure)
|
50
|
+
context.script = scr
|
51
|
+
scr.command(:configure).each {|cmd| context.exec_config(cmd) }
|
52
|
+
end
|
42
53
|
end
|
43
54
|
|
44
55
|
def parse_action_ref(action_ref_with_args)
|
data/lib/inprovise/version.rb
CHANGED