testlab 0.5.4 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/tl +80 -2
- data/lib/testlab/container/lifecycle.rb +2 -2
- data/lib/testlab/container/status.rb +1 -1
- data/lib/testlab/container.rb +3 -3
- data/lib/testlab/network/lifecycle.rb +12 -2
- data/lib/testlab/node/lifecycle.rb +5 -39
- data/lib/testlab/node/ssh.rb +2 -2
- data/lib/testlab/node.rb +7 -9
- data/lib/testlab/providers/local.rb +74 -2
- data/lib/testlab/provisioner.rb +4 -0
- data/lib/testlab/provisioners/apt.rb +39 -0
- data/lib/testlab/provisioners/apt_cacher_ng.rb +33 -35
- data/lib/testlab/{node → provisioners}/bind.rb +51 -24
- data/lib/testlab/provisioners/chef_gem.rb +3 -81
- data/lib/testlab/provisioners/raring.rb +37 -0
- data/lib/testlab/provisioners/resolv.rb +61 -0
- data/lib/testlab/provisioners/shell.rb +0 -11
- data/lib/testlab/provisioners/templates/apt/bootstrap.erb +11 -0
- data/lib/testlab/provisioners/templates/apt_cacher_ng/00proxy.erb +4 -0
- data/lib/testlab/provisioners/templates/apt_cacher_ng/bootstrap.erb +7 -0
- data/lib/testlab/{node/templates → provisioners/templates/bind}/bind-db.erb +0 -0
- data/lib/testlab/{node/templates → provisioners/templates/bind}/bind-zone.erb +0 -0
- data/lib/testlab/{node/templates → provisioners/templates/bind}/bind.erb +0 -0
- data/lib/testlab/provisioners/templates/chef/omnibus.erb +2 -0
- data/lib/testlab/provisioners/templates/chef/omnitruck.erb +1 -1
- data/lib/testlab/provisioners/templates/chef/rubygem.erb +0 -0
- data/lib/testlab/{node/templates/node-setup.erb → provisioners/templates/raring/bootstrap.erb} +2 -0
- data/lib/testlab/provisioners/templates/resolv/resolv.conf.erb +9 -0
- data/lib/testlab/version.rb +1 -1
- data/lib/testlab.rb +58 -2
- data/spec/node_spec.rb +4 -19
- data/spec/provisioners/shell_spec.rb +3 -9
- data/spec/support/Labfile +29 -10
- metadata +17 -11
- data/lib/testlab/node/resolv.rb +0 -29
- data/lib/testlab/node/templates/resolv.erb +0 -4
@@ -15,10 +15,6 @@ class TestLab
|
|
15
15
|
@config = (config || Hash.new)
|
16
16
|
@ui = (ui || TestLab.ui)
|
17
17
|
|
18
|
-
@config[:version] ||= "latest"
|
19
|
-
@config[:prereleases] ||= false
|
20
|
-
@config[:nightlies] ||= false
|
21
|
-
|
22
18
|
@ui.logger.debug { "config(#{@config.inspect})" }
|
23
19
|
end
|
24
20
|
|
@@ -31,21 +27,9 @@ class TestLab
|
|
31
27
|
# provision.
|
32
28
|
# @return [Boolean] True if successful.
|
33
29
|
def setup(container)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
:chef_pre_11 => chef_pre_11?,
|
38
|
-
:chef_solo_attributes => build_chef_solo_attributes(container),
|
39
|
-
:chef_validator => (chef_pre_11? ? '/etc/chef/validation.pem' : '/etc/chef-server/chef-validator.pem'),
|
40
|
-
:chef_webui => (chef_pre_11? ? '/etc/chef/webui.pem' : '/etc/chef-server/chef-webui.pem'),
|
41
|
-
:chef_admin => (chef_pre_11? ? '/etc/chef/admin.pem' : '/etc/chef-server/admin.pem'),
|
42
|
-
:default_password => "p@ssw01d",
|
43
|
-
:user => ENV['USER'],
|
44
|
-
:hostname_short => container.id,
|
45
|
-
:hostname_full => container.fqdn,
|
46
|
-
:omnibus_version => omnibus_version
|
47
|
-
}).merge!(@config)
|
48
|
-
container.bootstrap(ZTK::Template.render(omnibus_template, config))
|
30
|
+
# NOOP
|
31
|
+
|
32
|
+
true
|
49
33
|
end
|
50
34
|
|
51
35
|
# ChefGem Provisioner Container Teardown
|
@@ -59,68 +43,6 @@ class TestLab
|
|
59
43
|
true
|
60
44
|
end
|
61
45
|
|
62
|
-
private
|
63
|
-
|
64
|
-
def build_chef_solo_10_attributes(container)
|
65
|
-
{
|
66
|
-
"chef_server" => {
|
67
|
-
"url" => "https://#{container.fqdn}",
|
68
|
-
"webui_enabled" => true
|
69
|
-
},
|
70
|
-
"run_list" => %w(recipe[chef-server::rubygems-install] recipe[chef-server::apache-proxy])
|
71
|
-
}
|
72
|
-
end
|
73
|
-
|
74
|
-
def build_chef_solo_11_attributes(container)
|
75
|
-
{
|
76
|
-
"chef-server" => {
|
77
|
-
"api_fqdn" => container.fqdn,
|
78
|
-
"nginx" => {
|
79
|
-
"enable_non_ssl" => true,
|
80
|
-
"server_name" => container.fqdn,
|
81
|
-
"url" => "https://#{container.fqdn}"
|
82
|
-
},
|
83
|
-
"lb" => {
|
84
|
-
"fqdn" => container.fqdn
|
85
|
-
},
|
86
|
-
"bookshelf" => {
|
87
|
-
"vip" => container.fqdn
|
88
|
-
},
|
89
|
-
"chef_server_webui" => {
|
90
|
-
"enable" => true
|
91
|
-
},
|
92
|
-
"version" => @config[:version],
|
93
|
-
"prereleases" => @config[:prereleases],
|
94
|
-
"nightlies" => @config[:nightlies]
|
95
|
-
},
|
96
|
-
"run_list" => %w(recipe[chef-server::default])
|
97
|
-
}
|
98
|
-
end
|
99
|
-
|
100
|
-
def build_chef_solo_attributes(container)
|
101
|
-
if chef_pre_11?
|
102
|
-
build_chef_solo_10_attributes(container)
|
103
|
-
else
|
104
|
-
build_chef_solo_11_attributes(container)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
def chef_pre_11?
|
109
|
-
if (@config[:version].to_s.downcase != "latest") && (@config[:version].to_f < 11.0)
|
110
|
-
true
|
111
|
-
else
|
112
|
-
false
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
def omnibus_version
|
117
|
-
if (@config[:version].to_f == 0.1)
|
118
|
-
"10.12.0"
|
119
|
-
else
|
120
|
-
@config[:version]
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
46
|
end
|
125
47
|
|
126
48
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
class TestLab
|
2
|
+
|
3
|
+
class Provisioner
|
4
|
+
|
5
|
+
# Ubuntu Raring Provisioner Error Class
|
6
|
+
class RaringError < ProvisionerError; end
|
7
|
+
|
8
|
+
# Ubuntu Raring Provisioner Class
|
9
|
+
#
|
10
|
+
# @author Zachary Patten <zachary AT jovelabs DOT com>
|
11
|
+
class Raring
|
12
|
+
|
13
|
+
def initialize(config={}, ui=nil)
|
14
|
+
@config = (config || Hash.new)
|
15
|
+
@ui = (ui || TestLab.ui)
|
16
|
+
|
17
|
+
@config[:raring] ||= Hash.new
|
18
|
+
|
19
|
+
@ui.logger.debug { "config(#{@config.inspect})" }
|
20
|
+
end
|
21
|
+
|
22
|
+
# Ubuntu Raring Provisioner Node Setup
|
23
|
+
#
|
24
|
+
# @param [TestLab::Node] node The node which we want to
|
25
|
+
# provision.
|
26
|
+
# @return [Boolean] True if successful.
|
27
|
+
def node(node)
|
28
|
+
@ui.logger.debug { "Ubuntu Raring Provisioner: Node #{node.id}" }
|
29
|
+
|
30
|
+
bootstrap_template = File.join(TestLab::Provisioner.template_dir, "raring", "bootstrap.erb")
|
31
|
+
node.ssh.bootstrap(ZTK::Template.render(bootstrap_template, @config))
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
class TestLab
|
2
|
+
|
3
|
+
class Provisioner
|
4
|
+
|
5
|
+
# Resolv Provisioner Error Class
|
6
|
+
class ResolvError < ProvisionerError; end
|
7
|
+
|
8
|
+
# Resolv Provisioner Class
|
9
|
+
#
|
10
|
+
# @author Zachary Patten <zachary AT jovelabs DOT com>
|
11
|
+
class Resolv
|
12
|
+
|
13
|
+
def initialize(config={}, ui=nil)
|
14
|
+
@config = (config || Hash.new)
|
15
|
+
@ui = (ui || TestLab.ui)
|
16
|
+
|
17
|
+
@config[:resolv] ||= Hash.new
|
18
|
+
@config[:resolv][:servers] ||= [TestLab::Network.ips, "8.8.8.8", "8.8.4.4" ].flatten.compact.uniq
|
19
|
+
@config[:resolv][:search] ||= TestLab::Container.domains.join(' ')
|
20
|
+
|
21
|
+
@ui.logger.debug { "config(#{@config.inspect})" }
|
22
|
+
end
|
23
|
+
|
24
|
+
# Resolv Provisioner Node Setup
|
25
|
+
#
|
26
|
+
# @param [TestLab::Node] node The node which we want to provision.
|
27
|
+
# @return [Boolean] True if successful.
|
28
|
+
def node(node)
|
29
|
+
@ui.logger.debug { "RESOLV Provisioner: Node #{node.id}" }
|
30
|
+
|
31
|
+
render_resolv_conf(node)
|
32
|
+
|
33
|
+
true
|
34
|
+
end
|
35
|
+
|
36
|
+
# Resolv Provisioner Container Setup
|
37
|
+
#
|
38
|
+
# @param [TestLab::Container] container The container which we want to
|
39
|
+
# provision.
|
40
|
+
# @return [Boolean] True if successful.
|
41
|
+
def setup(container)
|
42
|
+
@ui.logger.debug { "RESOLV Provisioner: Container #{container.id}" }
|
43
|
+
|
44
|
+
render_resolv_conf(container)
|
45
|
+
|
46
|
+
true
|
47
|
+
end
|
48
|
+
|
49
|
+
def render_resolv_conf(object)
|
50
|
+
resolv_conf_template = File.join(TestLab::Provisioner.template_dir, "resolv", "resolv.conf.erb")
|
51
|
+
|
52
|
+
object.ssh.file(:target => File.join("/etc/resolv.conf"), :chown => "root:root") do |file|
|
53
|
+
file.puts(ZTK::Template.do_not_edit_notice(:message => "TestLab v#{TestLab::VERSION} RESOLVER Configuration"))
|
54
|
+
file.puts(ZTK::Template.render(resolv_conf_template, @config))
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
set -x
|
2
|
+
|
3
|
+
export DEBIAN_FRONTEND="noninteractive"
|
4
|
+
|
5
|
+
apt-get -y --force-yes update
|
6
|
+
<% if !@apt[:install].nil? -%>
|
7
|
+
apt-get -y install <%= @apt[:install].flatten.compact.join(' ') %>
|
8
|
+
<% end -%>
|
9
|
+
<% if !@apt[:remove].nil? -%>
|
10
|
+
apt-get -y remove <%= @apt[:remove].flatten.compact.join(' ') %>
|
11
|
+
<% end -%>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
set -x
|
2
|
+
|
3
|
+
export DEBIAN_FRONTEND="noninteractive"
|
4
|
+
|
5
|
+
apt-get -y install apt-cacher-ng
|
6
|
+
service apt-cacher-ng restart || service apt-cacher-ng start
|
7
|
+
grep "^MIRROR" /etc/default/lxc || echo 'MIRROR="http://127.0.0.1:3142/archive.ubuntu.com/ubuntu"' | tee -a /etc/default/lxc && service lxc restart || service lxc start
|
File without changes
|
File without changes
|
File without changes
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<%= ZTK::Template.do_not_edit_notice(:message => "OmniTruck Bootstrap") %>
|
3
3
|
set -x
|
4
4
|
|
5
|
-
DEBIAN_FRONTEND="noninteractive"
|
5
|
+
export DEBIAN_FRONTEND="noninteractive"
|
6
6
|
CHEF_SOLO_ROOT="/tmp/chef-solo"
|
7
7
|
KNIFE_CONFIG_EXP_FILE="/tmp/knife-config.exp"
|
8
8
|
export DEBIAN_FRONTEND CHEF_SOLO_ROOT KNIFE_CONFIG_EXP_FILE
|
File without changes
|
data/lib/testlab/version.rb
CHANGED
data/lib/testlab.rb
CHANGED
@@ -162,6 +162,46 @@ class TestLab
|
|
162
162
|
!alive?
|
163
163
|
end
|
164
164
|
|
165
|
+
# Test Lab Up
|
166
|
+
#
|
167
|
+
# Attempts to up our lab topology. This calls the up method on all of
|
168
|
+
# our nodes.
|
169
|
+
#
|
170
|
+
# @return [Boolean] True if successful.
|
171
|
+
def up
|
172
|
+
@labfile.nodes.map do |node|
|
173
|
+
node.up
|
174
|
+
node.networks.map do |network|
|
175
|
+
network.up
|
176
|
+
end
|
177
|
+
node.containers.map do |container|
|
178
|
+
container.up
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
true
|
183
|
+
end
|
184
|
+
|
185
|
+
# Test Lab Down
|
186
|
+
#
|
187
|
+
# Attempts to down our lab topology. This calls the down method on all of
|
188
|
+
# our nodes.
|
189
|
+
#
|
190
|
+
# @return [Boolean] True if successful.
|
191
|
+
def down
|
192
|
+
@labfile.nodes.map do |node|
|
193
|
+
node.containers.map do |container|
|
194
|
+
container.down
|
195
|
+
end
|
196
|
+
node.networks.map do |network|
|
197
|
+
network.down
|
198
|
+
end
|
199
|
+
node.down
|
200
|
+
end
|
201
|
+
|
202
|
+
true
|
203
|
+
end
|
204
|
+
|
165
205
|
# Test Lab Setup
|
166
206
|
#
|
167
207
|
# Attempts to setup our lab topology. This calls the setup method on all of
|
@@ -169,7 +209,15 @@ class TestLab
|
|
169
209
|
#
|
170
210
|
# @return [Boolean] True if successful.
|
171
211
|
def setup
|
172
|
-
|
212
|
+
@labfile.nodes.map do |node|
|
213
|
+
node.setup
|
214
|
+
node.networks.map do |network|
|
215
|
+
network.setup
|
216
|
+
end
|
217
|
+
node.containers.map do |container|
|
218
|
+
container.setup
|
219
|
+
end
|
220
|
+
end
|
173
221
|
|
174
222
|
true
|
175
223
|
end
|
@@ -181,7 +229,15 @@ class TestLab
|
|
181
229
|
#
|
182
230
|
# @return [Boolean] True if successful.
|
183
231
|
def teardown
|
184
|
-
|
232
|
+
@labfile.nodes.map do |node|
|
233
|
+
node.containers.map do |container|
|
234
|
+
container.teardown
|
235
|
+
end
|
236
|
+
node.networks.map do |network|
|
237
|
+
network.teardown
|
238
|
+
end
|
239
|
+
node.teardown
|
240
|
+
end
|
185
241
|
|
186
242
|
true
|
187
243
|
end
|
data/spec/node_spec.rb
CHANGED
@@ -43,22 +43,6 @@ describe TestLab::Node do
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
describe "#bind_setup" do
|
47
|
-
it "should setup bind" do
|
48
|
-
subject.ssh.stub(:exec) { true }
|
49
|
-
subject.ssh.stub(:file).and_yield(StringIO.new)
|
50
|
-
subject.bind_setup
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
describe "#build_resolv_conf" do
|
55
|
-
it "should build resolv.conf" do
|
56
|
-
subject.ssh.stub(:exec) { true }
|
57
|
-
subject.ssh.stub(:file).and_yield(StringIO.new)
|
58
|
-
subject.build_resolv_conf
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
46
|
describe "#status" do
|
63
47
|
it "should return a hash of status information about the node" do
|
64
48
|
subject.instance_variable_get(:@provider).stub(:state) { :not_created }
|
@@ -112,11 +96,10 @@ describe TestLab::Node do
|
|
112
96
|
|
113
97
|
describe "setup" do
|
114
98
|
it "should setup the node" do
|
99
|
+
subject.provisioners = Array.new
|
100
|
+
subject.containers.each { |c| c.provisioners = Array.new }
|
115
101
|
subject.ssh.stub(:bootstrap) { true }
|
116
102
|
subject.stub(:route_setup) { true }
|
117
|
-
subject.stub(:build_resolv_conf) { true }
|
118
|
-
subject.stub(:bind_setup) { true }
|
119
|
-
subject.stub(:bind_reload) { true }
|
120
103
|
subject.stub(:create) { true }
|
121
104
|
subject.stub(:up) { true }
|
122
105
|
subject.containers.each do |container|
|
@@ -131,6 +114,8 @@ describe TestLab::Node do
|
|
131
114
|
|
132
115
|
describe "teardown" do
|
133
116
|
it "should teardown the node" do
|
117
|
+
subject.provisioners = Array.new
|
118
|
+
subject.containers.each { |c| c.provisioners = Array.new }
|
134
119
|
subject.stub(:route_setup) { true }
|
135
120
|
subject.stub(:down) { true }
|
136
121
|
subject.stub(:destroy) { true }
|
@@ -30,7 +30,7 @@ describe TestLab::Provisioner::Shell do
|
|
30
30
|
describe "class" do
|
31
31
|
|
32
32
|
it "should be an instance of TestLab::Provisioner::Shell" do
|
33
|
-
subject.provisioners.
|
33
|
+
subject.provisioners.last.new(subject.config, @ui).should be_an_instance_of TestLab::Provisioner::Shell
|
34
34
|
end
|
35
35
|
|
36
36
|
end
|
@@ -42,7 +42,7 @@ describe TestLab::Provisioner::Shell do
|
|
42
42
|
it "should provision the container" do
|
43
43
|
subject.node.ssh.stub(:file).and_yield(StringIO.new)
|
44
44
|
subject.lxc.stub(:attach) { "" }
|
45
|
-
subject.provisioners.
|
45
|
+
subject.provisioners.last.new(subject.config, @ui).setup(subject)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -50,17 +50,11 @@ describe TestLab::Provisioner::Shell do
|
|
50
50
|
it "should raise an exception" do
|
51
51
|
subject.node.ssh.stub(:file).and_yield(StringIO.new)
|
52
52
|
subject.lxc.stub(:attach) { "No such file or directory" }
|
53
|
-
lambda{ subject.provisioners.
|
53
|
+
lambda{ subject.provisioners.last.new(subject.config, @ui).setup(subject) }.should raise_error TestLab::ContainerError
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
describe "teardown" do
|
59
|
-
it "should decomission the container" do
|
60
|
-
subject.provisioners.first.new(subject.config, @ui).teardown(subject)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
58
|
end
|
65
59
|
|
66
60
|
end
|
data/spec/support/Labfile
CHANGED
@@ -9,17 +9,18 @@ EOF
|
|
9
9
|
|
10
10
|
REPO = File.dirname(__FILE__)
|
11
11
|
|
12
|
-
config
|
12
|
+
config ({
|
13
13
|
:domain => "default.zone",
|
14
14
|
:repo => REPO
|
15
|
-
|
15
|
+
})
|
16
16
|
|
17
17
|
node :localhost do
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
provider TestLab::Provider::Vagrant
|
20
|
+
provisioners [
|
21
|
+
TestLab::Provisioner::Bind
|
22
|
+
]
|
23
|
+
config ({
|
23
24
|
:vagrant => {
|
24
25
|
:id => "mytestlab-#{ENV['USER']}".downcase,
|
25
26
|
:ip => "192.168.255.1",
|
@@ -29,7 +30,7 @@ node :localhost do
|
|
29
30
|
:memory => 512,
|
30
31
|
:file => REPO
|
31
32
|
}
|
32
|
-
|
33
|
+
})
|
33
34
|
|
34
35
|
network 'testnet' do
|
35
36
|
address '192.168.255.254/16'
|
@@ -42,6 +43,12 @@ node :localhost do
|
|
42
43
|
distro "ubuntu"
|
43
44
|
release "precise"
|
44
45
|
|
46
|
+
provisioners [
|
47
|
+
TestLab::Provisioner::Resolv,
|
48
|
+
TestLab::Provisioner::AptCacherNG,
|
49
|
+
TestLab::Provisioner::Apt
|
50
|
+
]
|
51
|
+
|
45
52
|
interface do
|
46
53
|
name :eth0
|
47
54
|
network_id 'testnet'
|
@@ -61,6 +68,12 @@ node :localhost do
|
|
61
68
|
distro "ubuntu"
|
62
69
|
release "precise"
|
63
70
|
|
71
|
+
provisioners [
|
72
|
+
TestLab::Provisioner::Resolv,
|
73
|
+
TestLab::Provisioner::AptCacherNG,
|
74
|
+
TestLab::Provisioner::Apt
|
75
|
+
]
|
76
|
+
|
64
77
|
interface do
|
65
78
|
name :eth0
|
66
79
|
network_id 'testnet'
|
@@ -73,11 +86,17 @@ node :localhost do
|
|
73
86
|
distro "ubuntu"
|
74
87
|
release "precise"
|
75
88
|
|
76
|
-
provisioners [
|
77
|
-
|
89
|
+
provisioners [
|
90
|
+
TestLab::Provisioner::Resolv,
|
91
|
+
TestLab::Provisioner::AptCacherNG,
|
92
|
+
TestLab::Provisioner::Apt,
|
93
|
+
TestLab::Provisioner::Shell
|
94
|
+
]
|
95
|
+
|
96
|
+
config ({
|
78
97
|
:shell => "/bin/bash",
|
79
98
|
:script => shell_provision_script
|
80
|
-
|
99
|
+
})
|
81
100
|
|
82
101
|
interface do
|
83
102
|
name :eth0
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testlab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
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-06-
|
12
|
+
date: 2013-06-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gli
|
@@ -229,32 +229,38 @@ files:
|
|
229
229
|
- lib/testlab/network/status.rb
|
230
230
|
- lib/testlab/node.rb
|
231
231
|
- lib/testlab/node/actions.rb
|
232
|
-
- lib/testlab/node/bind.rb
|
233
232
|
- lib/testlab/node/class_methods.rb
|
234
233
|
- lib/testlab/node/lifecycle.rb
|
235
234
|
- lib/testlab/node/lxc.rb
|
236
235
|
- lib/testlab/node/method_missing.rb
|
237
|
-
- lib/testlab/node/resolv.rb
|
238
236
|
- lib/testlab/node/ssh.rb
|
239
237
|
- lib/testlab/node/status.rb
|
240
|
-
- lib/testlab/node/templates/bind-db.erb
|
241
|
-
- lib/testlab/node/templates/bind-zone.erb
|
242
|
-
- lib/testlab/node/templates/bind.erb
|
243
|
-
- lib/testlab/node/templates/node-setup.erb
|
244
|
-
- lib/testlab/node/templates/resolv.erb
|
245
238
|
- lib/testlab/provider.rb
|
246
239
|
- lib/testlab/providers/aws.rb
|
247
240
|
- lib/testlab/providers/local.rb
|
248
241
|
- lib/testlab/providers/templates/vagrant/Vagrantfile.erb
|
249
242
|
- lib/testlab/providers/vagrant.rb
|
250
243
|
- lib/testlab/provisioner.rb
|
244
|
+
- lib/testlab/provisioners/apt.rb
|
251
245
|
- lib/testlab/provisioners/apt_cacher_ng.rb
|
246
|
+
- lib/testlab/provisioners/bind.rb
|
252
247
|
- lib/testlab/provisioners/chef_gem.rb
|
253
248
|
- lib/testlab/provisioners/omnibus.rb
|
254
249
|
- lib/testlab/provisioners/omnitruck.rb
|
250
|
+
- lib/testlab/provisioners/raring.rb
|
251
|
+
- lib/testlab/provisioners/resolv.rb
|
255
252
|
- lib/testlab/provisioners/shell.rb
|
253
|
+
- lib/testlab/provisioners/templates/apt/bootstrap.erb
|
254
|
+
- lib/testlab/provisioners/templates/apt_cacher_ng/00proxy.erb
|
255
|
+
- lib/testlab/provisioners/templates/apt_cacher_ng/bootstrap.erb
|
256
|
+
- lib/testlab/provisioners/templates/bind/bind-db.erb
|
257
|
+
- lib/testlab/provisioners/templates/bind/bind-zone.erb
|
258
|
+
- lib/testlab/provisioners/templates/bind/bind.erb
|
256
259
|
- lib/testlab/provisioners/templates/chef/omnibus.erb
|
257
260
|
- lib/testlab/provisioners/templates/chef/omnitruck.erb
|
261
|
+
- lib/testlab/provisioners/templates/chef/rubygem.erb
|
262
|
+
- lib/testlab/provisioners/templates/raring/bootstrap.erb
|
263
|
+
- lib/testlab/provisioners/templates/resolv/resolv.conf.erb
|
258
264
|
- lib/testlab/user.rb
|
259
265
|
- lib/testlab/user/lifecycle.rb
|
260
266
|
- lib/testlab/utility.rb
|
@@ -287,7 +293,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
287
293
|
version: '0'
|
288
294
|
segments:
|
289
295
|
- 0
|
290
|
-
hash:
|
296
|
+
hash: 2170053698694927612
|
291
297
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
292
298
|
none: false
|
293
299
|
requirements:
|
@@ -296,7 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
296
302
|
version: '0'
|
297
303
|
segments:
|
298
304
|
- 0
|
299
|
-
hash:
|
305
|
+
hash: 2170053698694927612
|
300
306
|
requirements: []
|
301
307
|
rubyforge_project:
|
302
308
|
rubygems_version: 1.8.25
|
data/lib/testlab/node/resolv.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
class TestLab
|
2
|
-
class Node
|
3
|
-
|
4
|
-
module Resolv
|
5
|
-
require 'tempfile'
|
6
|
-
|
7
|
-
# Builds the main resolv configuration sections
|
8
|
-
def build_resolv_main_conf(file)
|
9
|
-
resolv_conf_template = File.join(self.class.template_dir, "resolv.erb")
|
10
|
-
|
11
|
-
context = {
|
12
|
-
:servers => [TestLab::Network.ips, "8.8.8.8", "8.8.4.4" ].flatten,
|
13
|
-
:search => TestLab::Container.domains.join(' ')
|
14
|
-
}
|
15
|
-
|
16
|
-
file.puts(ZTK::Template.do_not_edit_notice(:message => "TestLab v#{TestLab::VERSION} RESOLVER Configuration"))
|
17
|
-
file.puts(ZTK::Template.render(resolv_conf_template, context))
|
18
|
-
end
|
19
|
-
|
20
|
-
def build_resolv_conf
|
21
|
-
self.ssh.file(:target => File.join("/etc/resolv.conf"), :chown => "root:root") do |file|
|
22
|
-
build_resolv_main_conf(file)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
end
|