automateit 0.71101 → 0.71101.1
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGES.txt +5 -0
- data/lib/automateit/interpreter.rb +2 -2
- data/lib/automateit/root.rb +1 -1
- data/lib/automateit/tag_manager/struct.rb +4 -5
- data/spec/integration/cli_spec.rb +18 -0
- data/spec/unit/tag_manager_spec.rb +17 -2
- data/spec/unit/tag_manager_spec.rb.orig +215 -0
- metadata +3 -1
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGES.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
0.71101.1:
|
2
|
+
Date: Thu, 01 Nov 2007 18:52:01 -0700
|
3
|
+
Desc:
|
4
|
+
- (%) Fixed bug in Interpreter, which only set optional run-time tags specified on the command-line AFTER it loaded the fields/tags files. Thanks for the report, David Brewer.
|
5
|
+
|
1
6
|
0.71101:
|
2
7
|
Date: Thu, 01 Nov 2007 17:07:51 -0700
|
3
8
|
Desc:
|
@@ -176,6 +176,8 @@ module AutomateIt
|
|
176
176
|
# Instantiate core plugins so they're available to the project
|
177
177
|
_instantiate_plugins
|
178
178
|
|
179
|
+
tags.merge(opts[:tags]) if opts[:tags]
|
180
|
+
|
179
181
|
if project_path = opts[:project] || ENV["AUTOMATEIT_PROJECT"] || ENV["AIP"]
|
180
182
|
# Only load a project if we find its env file
|
181
183
|
env_file = File.join(project_path, "config", "automateit_env.rb")
|
@@ -212,8 +214,6 @@ module AutomateIt
|
|
212
214
|
raise ArgumentError.new("Couldn't find project at: #{project_path}")
|
213
215
|
end
|
214
216
|
end
|
215
|
-
|
216
|
-
tags.merge(opts[:tags]) if opts[:tags]
|
217
217
|
end
|
218
218
|
|
219
219
|
# Hash of plugin tokens to plugin instances for this Interpreter.
|
data/lib/automateit/root.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# See AutomateIt::Interpreter for usage information.
|
2
2
|
module AutomateIt # :nodoc:
|
3
3
|
# AutomateIt version
|
4
|
-
VERSION=Gem::Version.new("0.71101")
|
4
|
+
VERSION=Gem::Version.new("0.71101.1")
|
5
5
|
|
6
6
|
# Instantiates a new Interpreter. See documentation for
|
7
7
|
# Interpreter#setup.
|
@@ -14,12 +14,11 @@ class AutomateIt::TagManager::Struct < AutomateIt::TagManager::BaseDriver
|
|
14
14
|
def setup(opts={})
|
15
15
|
super(opts)
|
16
16
|
|
17
|
+
@struct ||= {}
|
18
|
+
@tags ||= Set.new
|
19
|
+
|
17
20
|
if opts[:struct]
|
18
|
-
@struct
|
19
|
-
@tags = Set.new
|
20
|
-
else
|
21
|
-
@struct ||= {}
|
22
|
-
@tags ||= Set.new
|
21
|
+
@struct.merge!(AutomateIt::TagManager::TagParser.expand(opts[:struct]))
|
23
22
|
end
|
24
23
|
end
|
25
24
|
|
@@ -140,6 +140,24 @@ describe AutomateIt::CLI, " with a project" do# {{{
|
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
|
+
it "should add run-time tags to a project" do
|
144
|
+
with_project do
|
145
|
+
recipe = "recipes/recipe.rb"
|
146
|
+
tags_yml = "config/tags.yml"
|
147
|
+
|
148
|
+
write_to(tags_yml, <<-HERE)
|
149
|
+
all_servers:
|
150
|
+
- localhost
|
151
|
+
HERE
|
152
|
+
|
153
|
+
write_to(recipe, <<-HERE)
|
154
|
+
tagged?("tsukai")
|
155
|
+
HERE
|
156
|
+
|
157
|
+
AutomateIt::CLI.run(:recipe => recipe, :tags => %w(tsukai)).should be_true
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
143
161
|
it "should load fields in a project" do
|
144
162
|
with_project do
|
145
163
|
recipe = "recipes/recipe.rb"
|
@@ -174,8 +174,8 @@ end
|
|
174
174
|
describe "AutomateIt::TagManager::YAML" do
|
175
175
|
it_should_behave_like "AutomateIt::TagManager"
|
176
176
|
|
177
|
-
|
178
|
-
@m[:yaml].should_receive(:_read).with("demo.yml").and_return(<<-EOB)
|
177
|
+
def setup_yaml_tags
|
178
|
+
@m[:yaml].should_receive(:_read).any_number_of_times.with("demo.yml").and_return(<<-EOB)
|
179
179
|
<%="apache_servers"%>:
|
180
180
|
- kurou
|
181
181
|
- shirou
|
@@ -196,4 +196,19 @@ describe "AutomateIt::TagManager::YAML" do
|
|
196
196
|
:file => "demo.yml"
|
197
197
|
)
|
198
198
|
end
|
199
|
+
|
200
|
+
before(:all) do
|
201
|
+
setup_yaml_tags
|
202
|
+
end
|
203
|
+
|
204
|
+
it "should not clear tags if re-loaded" do
|
205
|
+
setup_yaml_tags
|
206
|
+
tag = "al-azif"
|
207
|
+
|
208
|
+
@a.tags << tag
|
209
|
+
@a.should be_tagged(tag)
|
210
|
+
|
211
|
+
setup_yaml_tags
|
212
|
+
@a.should be_tagged(tag)
|
213
|
+
end
|
199
214
|
end
|
@@ -0,0 +1,215 @@
|
|
1
|
+
require File.join(File.dirname(File.expand_path(__FILE__)), "/../spec_helper.rb")
|
2
|
+
|
3
|
+
describe "AutomateIt::TagManager", :shared => true do
|
4
|
+
before(:all) do
|
5
|
+
@a = AutomateIt.new
|
6
|
+
@a.platform_manager.setup(
|
7
|
+
:default => :struct,
|
8
|
+
:struct => {
|
9
|
+
:os => "mizrahi",
|
10
|
+
:arch => "realian",
|
11
|
+
:distro => "momo",
|
12
|
+
:version => "s100",
|
13
|
+
}
|
14
|
+
)
|
15
|
+
@a.address_manager.should_receive(:hostnames).any_number_of_times.and_return(["kurou", "kurou.foo"])
|
16
|
+
|
17
|
+
@m = @a.tag_manager
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should have tags" do
|
21
|
+
@a.tags.should be_a_kind_of(Enumerable)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should have tags that include tag for hostname" do
|
25
|
+
@a.tags.should include("kurou")
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should have tag for short hostname" do
|
29
|
+
@a.tagged?("kurou").should be_true
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should have tag for long hostname" do
|
33
|
+
@a.tagged?("kurou.foo").should be_true
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should have tag for OS" do
|
37
|
+
@a.tagged?("mizrahi").should be_true
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should have tag for OS/arch" do
|
41
|
+
@a.tagged?("mizrahi_realian").should be_true
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should have tag for distro/release" do
|
45
|
+
@a.tagged?("momo_s100").should be_true
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should have tag for a role" do
|
49
|
+
@a.tagged?("apache_servers").should be_true
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should match a symbol query" do
|
53
|
+
@a.tagged?(:apache_servers).should be_true
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should match a string query" do
|
57
|
+
@a.tagged?("apache_servers").should be_true
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should not match unknown symbol keys" do
|
61
|
+
@a.tagged?(:foo).should be_false
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should not match unknown string keys" do
|
65
|
+
@a.tagged?("foo").should be_false
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should match an AND query" do
|
69
|
+
@a.tagged?("kurou && apache_servers").should be_true
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should match an OR query" do
|
73
|
+
@a.tagged?("kurou || apache_servers").should be_true
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should match a grouped AND and OR query" do
|
77
|
+
@a.tagged?("(kurou || apache_servers) && momo_s100").should be_true
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should not match AND with unknown keys" do
|
81
|
+
@a.tagged?("kurou && foo").should be_false
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should not match OR with unknown keys" do
|
85
|
+
@a.tagged?("foo && bar").should be_false
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should query tags for a specific host" do
|
89
|
+
@a.tagged?("proxy_servers", "kurou").should be_false
|
90
|
+
@a.tagged?("proxy_servers", "akane.foo").should be_true
|
91
|
+
@a.tagged?("proxy_servers", "akane").should be_true
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should append tags" do
|
95
|
+
@a.tagged?("magic").should be_false
|
96
|
+
@a.tags << "magic"
|
97
|
+
@a.tagged?("magic").should be_true
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should find tags with dashes in the name" do
|
101
|
+
tag_with_dash = "pawafuru-mirakuru"
|
102
|
+
tag_without_dash = "wandafuru"
|
103
|
+
|
104
|
+
@a.tags << tag_with_dash << tag_without_dash
|
105
|
+
|
106
|
+
@a.tagged?(tag_with_dash).should be_true
|
107
|
+
@a.tagged?(tag_without_dash).should be_true
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should find tags for a host" do
|
111
|
+
@a.tags_for("akane.foo.bar").should include("proxy_servers")
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should find tags for an array of hosts" do
|
115
|
+
@a.tags_for(["kurou"]).should include("apache_servers")
|
116
|
+
end
|
117
|
+
|
118
|
+
it "should find hosts with a tag" do
|
119
|
+
hosts = @a.hosts_tagged_with("apache_servers")
|
120
|
+
hosts.should include("kurou")
|
121
|
+
hosts.should include("shirou")
|
122
|
+
hosts.should_not include("akane")
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should find matching negative queries" do
|
126
|
+
@a.tagged?("akane").should be_false
|
127
|
+
@a.tagged?("!akane").should be_true
|
128
|
+
@a.tagged?("!akane && !proxy_servers").should be_true
|
129
|
+
end
|
130
|
+
|
131
|
+
it "should include group aliases" do
|
132
|
+
@a.hosts_tagged_with("all_servers").sort.should == ["kurou", "shirou", "akane.foo"].sort
|
133
|
+
end
|
134
|
+
|
135
|
+
it "should exclude hosts from groups" do
|
136
|
+
@a.hosts_tagged_with("apache_servers_except_kurou").should == ["shirou"]
|
137
|
+
end
|
138
|
+
|
139
|
+
it "should exclude groups from groups" do
|
140
|
+
@a.hosts_tagged_with("all_servers_except_proxy_servers").sort.should == ["kurou", "shirou"].sort
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
describe "AutomateIt::TagManager::Struct" do
|
145
|
+
it_should_behave_like "AutomateIt::TagManager"
|
146
|
+
|
147
|
+
before(:all) do
|
148
|
+
@m.setup(
|
149
|
+
:default => :struct,
|
150
|
+
:struct => {
|
151
|
+
"apache_servers" => [
|
152
|
+
"kurou",
|
153
|
+
"shirou",
|
154
|
+
],
|
155
|
+
"proxy_servers" => [
|
156
|
+
"akane.foo",
|
157
|
+
],
|
158
|
+
"all_servers" => [
|
159
|
+
"@apache_servers",
|
160
|
+
"@proxy_servers",
|
161
|
+
],
|
162
|
+
"apache_servers_except_kurou" => [
|
163
|
+
"@apache_servers",
|
164
|
+
"!kurou",
|
165
|
+
],
|
166
|
+
"all_servers_except_proxy_servers" => [
|
167
|
+
"@all_servers",
|
168
|
+
"!@proxy_servers",
|
169
|
+
],
|
170
|
+
}
|
171
|
+
)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
describe "AutomateIt::TagManager::YAML" do
|
176
|
+
it_should_behave_like "AutomateIt::TagManager"
|
177
|
+
|
178
|
+
def setup_yaml_tags
|
179
|
+
@m[:yaml].should_receive(:_read).any_number_of_times.with("demo.yml").and_return(<<-EOB)
|
180
|
+
<%="apache_servers"%>:
|
181
|
+
- kurou
|
182
|
+
- shirou
|
183
|
+
proxy_servers:
|
184
|
+
- akane.foo
|
185
|
+
all_servers:
|
186
|
+
- @apache_servers
|
187
|
+
- @proxy_servers
|
188
|
+
apache_servers_except_kurou:
|
189
|
+
- @apache_servers
|
190
|
+
- !kurou
|
191
|
+
all_servers_except_proxy_servers:
|
192
|
+
- @all_servers
|
193
|
+
- !@proxy_servers
|
194
|
+
EOB
|
195
|
+
@m.setup(
|
196
|
+
:default => :yaml,
|
197
|
+
:file => "demo.yml"
|
198
|
+
)
|
199
|
+
end
|
200
|
+
|
201
|
+
before(:all) do
|
202
|
+
setup_yaml_tags
|
203
|
+
end
|
204
|
+
|
205
|
+
it "should not clear tags if re-loaded" do
|
206
|
+
setup_yaml_tags
|
207
|
+
tag = "ivemell"
|
208
|
+
|
209
|
+
@a.tags << tag
|
210
|
+
@a.should be_tagged(tag)
|
211
|
+
|
212
|
+
setup_yaml_tags
|
213
|
+
@a.should be_tagged(tag)
|
214
|
+
end
|
215
|
+
end
|
metadata
CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: automateit
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version:
|
6
|
+
version: 0.71101.1
|
7
7
|
date: 2007-11-01 00:00:00 -07:00
|
8
8
|
summary: AutomateIt is an open source tool for automating the setup and maintenance of servers, applications and their dependencies.
|
9
9
|
require_paths:
|
@@ -168,6 +168,7 @@ files:
|
|
168
168
|
- spec/unit/interpreter_spec.rb
|
169
169
|
- spec/unit/platform_manager_spec.rb
|
170
170
|
- spec/unit/edit_manager_spec.rb
|
171
|
+
- spec/unit/tag_manager_spec.rb.orig
|
171
172
|
- spec/integration/service_manager_sysv_spec.rb
|
172
173
|
- spec/integration/template_manager_erb_spec.rb
|
173
174
|
- spec/integration/package_manager_spec.rb
|
@@ -199,6 +200,7 @@ test_files:
|
|
199
200
|
- spec/unit/interpreter_spec.rb
|
200
201
|
- spec/unit/platform_manager_spec.rb
|
201
202
|
- spec/unit/edit_manager_spec.rb
|
203
|
+
- spec/unit/tag_manager_spec.rb.orig
|
202
204
|
- spec/integration/service_manager_sysv_spec.rb
|
203
205
|
- spec/integration/template_manager_erb_spec.rb
|
204
206
|
- spec/integration/package_manager_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|