orca 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/lib/orca.rb +1 -1
- data/lib/orca/extensions/apt.rb +1 -1
- data/lib/orca/extensions/file_sync.rb +1 -1
- data/lib/orca/group.rb +4 -0
- data/lib/orca/logger.rb +3 -3
- data/lib/orca/package.rb +4 -0
- data/lib/orca/suite.rb +11 -0
- data/lib/orca/trigger_runner.rb +15 -4
- data/orca.gemspec +1 -1
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -87,6 +87,7 @@ If you have a package with the same name as a group or node you can abreviate th
|
|
87
87
|
You can also directly trigger actions from the CLI like so...
|
88
88
|
|
89
89
|
orca trigger nginx:reload web-1
|
90
|
+
orca trigger firewall:add[allow,80] web-1
|
90
91
|
|
91
92
|
Options, all commands support the following optional parameters...
|
92
93
|
|
data/lib/orca.rb
CHANGED
data/lib/orca/extensions/apt.rb
CHANGED
data/lib/orca/group.rb
CHANGED
data/lib/orca/logger.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
class Orca::Logger
|
2
2
|
def initialize(node, package)
|
3
3
|
@node = node
|
4
|
-
|
4
|
+
set_package(package)
|
5
5
|
end
|
6
6
|
|
7
7
|
def set_package(package)
|
8
|
-
@package = package
|
8
|
+
@package = package.to_s
|
9
9
|
end
|
10
10
|
|
11
11
|
def command(msg)
|
@@ -47,7 +47,7 @@ class Orca::Logger
|
|
47
47
|
def say(msg, color=nil)
|
48
48
|
msg.to_s.split("\n").each do |line|
|
49
49
|
out = color ? line.send(color) : line
|
50
|
-
Thread.exclusive { puts "#{@node.to_s} [#{@package.
|
50
|
+
Thread.exclusive { puts "#{@node.to_s} [#{@package.bold}] #{out}" }
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
data/lib/orca/package.rb
CHANGED
data/lib/orca/suite.rb
CHANGED
@@ -13,6 +13,7 @@ class Orca::Suite
|
|
13
13
|
|
14
14
|
def run(group_name, pkg_name, command, sequential=false)
|
15
15
|
group = Orca::Group.find(group_name)
|
16
|
+
raise Orca::MissingGroupError.new(group_name) if group.nil?
|
16
17
|
runners = group.nodes.map do |node|
|
17
18
|
@nodes << node
|
18
19
|
if command == :trigger
|
@@ -43,4 +44,14 @@ class Orca::Suite
|
|
43
44
|
runner.execute(command)
|
44
45
|
end
|
45
46
|
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class Orca::MissingGroupError < StandardError
|
50
|
+
def initialize(group_name)
|
51
|
+
@group_name = group_name
|
52
|
+
end
|
53
|
+
|
54
|
+
def message
|
55
|
+
"No Group or Node exists with the name '#{@group_name}'. Try one of: #{Orca::Group.names.join(', ')}"
|
56
|
+
end
|
46
57
|
end
|
data/lib/orca/trigger_runner.rb
CHANGED
@@ -1,14 +1,25 @@
|
|
1
1
|
class Orca::TriggerRunner
|
2
|
-
def initialize(node,
|
2
|
+
def initialize(node, action_ref_with_args)
|
3
3
|
@node = node
|
4
|
-
@action_ref =
|
4
|
+
@action_ref, @args = *parse_action_ref(action_ref_with_args)
|
5
|
+
@log = Orca::Logger.new(@node, @action_ref)
|
5
6
|
end
|
6
7
|
|
7
8
|
def execute(_)
|
8
|
-
Orca::ExecutionContext.new(@node).trigger(@action_ref)
|
9
|
+
Orca::ExecutionContext.new(@node, @log).trigger(@action_ref, *@args)
|
9
10
|
end
|
10
11
|
|
11
12
|
def demonstrate(_)
|
12
|
-
Orca::MockExecutionContext.new(@node).trigger(@action_ref)
|
13
|
+
Orca::MockExecutionContext.new(@node, @log).trigger(@action_ref, *@args)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def parse_action_ref(action_ref_with_args)
|
19
|
+
matches = action_ref_with_args.match(/([\w\:]+?)(\[([\w\,]+?)\])/)
|
20
|
+
return [action_ref_with_args,[]] unless matches
|
21
|
+
action_ref = matches[1]
|
22
|
+
args = matches[3].split(',').map(&:strip)
|
23
|
+
[action_ref, args]
|
13
24
|
end
|
14
25
|
end
|
data/orca.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
11
11
|
gem.name = "orca"
|
12
12
|
gem.require_paths = ["lib"]
|
13
|
-
gem.version = '0.3.
|
13
|
+
gem.version = '0.3.6'
|
14
14
|
gem.add_dependency('colored')
|
15
15
|
gem.add_dependency('net-ssh')
|
16
16
|
gem.add_dependency('net-sftp')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orca
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
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: 2013-07-
|
12
|
+
date: 2013-07-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: colored
|
@@ -133,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
segments:
|
135
135
|
- 0
|
136
|
-
hash: -
|
136
|
+
hash: -796320942601903817
|
137
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
142
|
version: '0'
|
143
143
|
segments:
|
144
144
|
- 0
|
145
|
-
hash: -
|
145
|
+
hash: -796320942601903817
|
146
146
|
requirements: []
|
147
147
|
rubyforge_project:
|
148
148
|
rubygems_version: 1.8.23
|