stork 0.2.0.pre → 0.3.0.pre
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 +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +6 -6
- data/README.md +1 -53
- data/Rakefile +1 -3
- data/lib/stork/builder.rb +1 -15
- data/lib/stork/client/plugins/host_show.rb +0 -2
- data/lib/stork/collections.rb +0 -4
- data/lib/stork/configuration.rb +0 -1
- data/lib/stork/database.rb +1 -1
- data/lib/stork/deploy/snippet_binding.rb +0 -10
- data/lib/stork/plugin.rb +1 -1
- data/lib/stork/resource/base.rb +25 -0
- data/lib/stork/resource/host.rb +15 -31
- data/lib/stork/resource/interface.rb +1 -1
- data/lib/stork/resource/network.rb +12 -0
- data/lib/stork/resources.rb +0 -1
- data/lib/stork/version.rb +1 -1
- data/specs/builder_spec.rb +0 -1
- data/specs/collections_spec.rb +0 -4
- data/specs/kickstart_spec.rb +2 -3
- data/specs/resource_host_spec.rb +19 -27
- data/specs/resource_interface_spec.rb +22 -1
- data/specs/resource_layout_spec.rb +3 -3
- data/specs/resource_network_spec.rb +56 -0
- data/specs/scripts/kssetup.sh +13 -21
- data/specs/scripts/ksvalidate.sh +9 -14
- data/specs/scripts/requirements.txt +8 -0
- data/specs/server_spec.rb +2 -2
- data/specs/stork/bundles/hosts/example.org.rb +5 -16
- data/specs/stork/bundles/networks/internal-one.rb +7 -0
- data/specs/stork/bundles/networks/internal-two.rb +3 -0
- metadata +41 -52
- data/.ruby-gemset +0 -1
- data/box/Vagrantfile +0 -41
- data/box/bootstrap.sh +0 -317
- data/box/integration.sh +0 -33
- data/lib/stork/collection/chefs.rb +0 -6
- data/lib/stork/resource/chef.rb +0 -81
- data/specs/deploy_snippet_binding_spec.rb +0 -15
- data/specs/resource_chef_spec.rb +0 -122
- data/specs/stork/bundles/chefs/default.rb +0 -9
- data/specs/stork/bundles/networks/local.rb +0 -6
- data/specs/stork/bundles/networks/org.rb +0 -7
- data/specs/stork/bundles/snippets/chef-bootstrap.erb +0 -104
- data/specs/stork/bundles/snippets/chef-reconfigure.erb +0 -22
data/lib/stork/resources.rb
CHANGED
data/lib/stork/version.rb
CHANGED
data/specs/builder_spec.rb
CHANGED
@@ -9,7 +9,6 @@ describe "Stork::Builder" do
|
|
9
9
|
builder = Stork::Builder.load
|
10
10
|
collection = builder.collection
|
11
11
|
collection.hosts.size.must_equal 11
|
12
|
-
collection.chefs.size.must_equal 1
|
13
12
|
collection.distros.size.must_equal 1
|
14
13
|
collection.layouts.size.must_equal 1
|
15
14
|
collection.networks.size.must_equal 2
|
data/specs/collections_spec.rb
CHANGED
@@ -17,10 +17,6 @@ describe "Stork::Collections" do
|
|
17
17
|
Stork::Collections.new.must_respond_to :networks
|
18
18
|
end
|
19
19
|
|
20
|
-
it "responds to the chefs method" do
|
21
|
-
Stork::Collections.new.must_respond_to :chefs
|
22
|
-
end
|
23
|
-
|
24
20
|
it "responds to the distros method" do
|
25
21
|
Stork::Collections.new.must_respond_to :distros
|
26
22
|
end
|
data/specs/kickstart_spec.rb
CHANGED
@@ -15,9 +15,8 @@ describe "Stork::Deploy::Kickstart" do
|
|
15
15
|
%w{ RHEL5 RHEL6 RHEL7 }.each do |ver|
|
16
16
|
it "should generate valid kickstart configurations for #{ver}" do
|
17
17
|
ksvalidate = "#{@path}/scripts/ksvalidate.sh"
|
18
|
-
testpath = "#{@path}"
|
19
18
|
kspath = "#{@path}/tmp/output.ks"
|
20
|
-
template = "#{@path}/stork/bundles/templates/default.ks.erb"
|
19
|
+
#template = "#{@path}/stork/bundles/templates/default.ks.erb"
|
21
20
|
|
22
21
|
ks = Stork::Deploy::InstallScript.new(@host, :kickstart)
|
23
22
|
|
@@ -25,7 +24,7 @@ describe "Stork::Deploy::Kickstart" do
|
|
25
24
|
file.write(ks.render)
|
26
25
|
end
|
27
26
|
|
28
|
-
Open3.popen3("#{ksvalidate} #{
|
27
|
+
Open3.popen3("#{ksvalidate} #{kspath} #{ver}") do |stdin, stdout, stderr, wait_thr|
|
29
28
|
exit_status = wait_thr.value.to_i
|
30
29
|
output = (stdout.readlines + stderr.readlines).join
|
31
30
|
assert_equal(0, exit_status, output)
|
data/specs/resource_host_spec.rb
CHANGED
@@ -19,11 +19,6 @@ describe "Stork::Resource::Host" do
|
|
19
19
|
Stork::Resource::Host.new.must_respond_to :template=
|
20
20
|
end
|
21
21
|
|
22
|
-
it "must respond to the chef accessors" do
|
23
|
-
Stork::Resource::Host.new.must_respond_to :chef
|
24
|
-
Stork::Resource::Host.new.must_respond_to :chef=
|
25
|
-
end
|
26
|
-
|
27
22
|
it "must respond to the pxemac accessors" do
|
28
23
|
Stork::Resource::Host.new.must_respond_to :pxemac
|
29
24
|
Stork::Resource::Host.new.must_respond_to :pxemac=
|
@@ -49,19 +44,19 @@ describe "Stork::Resource::Host" do
|
|
49
44
|
Stork::Resource::Host.new.must_respond_to :distro=
|
50
45
|
end
|
51
46
|
|
52
|
-
it "must respond to the
|
53
|
-
Stork::Resource::Host.new.must_respond_to :
|
54
|
-
Stork::Resource::Host.new.must_respond_to :
|
47
|
+
it "must respond to the repos accessors" do
|
48
|
+
Stork::Resource::Host.new.must_respond_to :repos
|
49
|
+
Stork::Resource::Host.new.must_respond_to :repos=
|
55
50
|
end
|
56
51
|
|
57
|
-
it "must respond to the
|
58
|
-
Stork::Resource::Host.new.must_respond_to :
|
59
|
-
Stork::Resource::Host.new.must_respond_to :
|
52
|
+
it "must respond to the tags accessors" do
|
53
|
+
Stork::Resource::Host.new.must_respond_to :tags
|
54
|
+
Stork::Resource::Host.new.must_respond_to :tags=
|
60
55
|
end
|
61
56
|
|
62
|
-
it "must respond to the
|
63
|
-
Stork::Resource::Host.new.must_respond_to :
|
64
|
-
Stork::Resource::Host.new.must_respond_to :
|
57
|
+
it "must respond to the environments accessors" do
|
58
|
+
Stork::Resource::Host.new.must_respond_to :environments
|
59
|
+
Stork::Resource::Host.new.must_respond_to :environments=
|
65
60
|
end
|
66
61
|
|
67
62
|
it "must return a hash with hashify" do
|
@@ -69,9 +64,7 @@ describe "Stork::Resource::Host" do
|
|
69
64
|
hash = {
|
70
65
|
'name' => 'server.example.org',
|
71
66
|
'distro' => 'centos',
|
72
|
-
'template' => 'default',
|
73
|
-
'chef' => 'default',
|
74
|
-
'chef_environment' => 'testing',
|
67
|
+
'template' => 'default',
|
75
68
|
'layout' => {
|
76
69
|
'partitions' => [
|
77
70
|
{
|
@@ -125,19 +118,19 @@ describe "Stork::Resource::Host" do
|
|
125
118
|
},
|
126
119
|
'interfaces' => [
|
127
120
|
{
|
128
|
-
'ip' => '
|
121
|
+
'ip' => '192.168.0.15',
|
129
122
|
'bootproto' => :static,
|
130
123
|
'netmask' => '255.255.255.0',
|
131
|
-
'gateway' =>
|
132
|
-
'nameservers' => [],
|
133
|
-
'search_paths' => []
|
124
|
+
'gateway' => '192.168.0.1',
|
125
|
+
'nameservers' => ["192.168.0.2", "192.168.0.3"],
|
126
|
+
'search_paths' => ['example.org']
|
134
127
|
},
|
135
128
|
{
|
136
129
|
'ip' => '192.168.1.10',
|
137
130
|
'bootproto' => :static,
|
138
131
|
'netmask' => '255.255.255.0',
|
139
|
-
'gateway' =>
|
140
|
-
'nameservers' => [
|
132
|
+
'gateway' => nil,
|
133
|
+
'nameservers' => [],
|
141
134
|
'search_paths' => []
|
142
135
|
}
|
143
136
|
],
|
@@ -145,12 +138,9 @@ describe "Stork::Resource::Host" do
|
|
145
138
|
'post_snippets' => [
|
146
139
|
'ntp',
|
147
140
|
'resolv-conf',
|
148
|
-
'chef-bootstrap',
|
149
|
-
'chef-reconfigure',
|
150
141
|
'notify'
|
151
142
|
],
|
152
143
|
'repos' => ['whamcloud-client'],
|
153
|
-
'run_list' => ['role[base]', 'recipe[apache]'],
|
154
144
|
'packages' => [
|
155
145
|
'@core',
|
156
146
|
'curl',
|
@@ -176,7 +166,9 @@ describe "Stork::Resource::Host" do
|
|
176
166
|
'foo'
|
177
167
|
],
|
178
168
|
'timezone' => 'America/Los_Angeles',
|
179
|
-
'selinux' => 'enforcing'
|
169
|
+
'selinux' => 'enforcing',
|
170
|
+
'tags' => [],
|
171
|
+
'environments' => []
|
180
172
|
}
|
181
173
|
host.hashify.must_equal hash
|
182
174
|
end
|
@@ -73,12 +73,33 @@ describe "Stork::Resource::Interface" do
|
|
73
73
|
it "should raise a syntax error if the network is not found" do
|
74
74
|
collection = Stork::Collections.new
|
75
75
|
proc {
|
76
|
-
|
76
|
+
Stork::Resource::Interface.build "eth0", collection: collection do
|
77
77
|
network 'invalid'
|
78
78
|
end
|
79
79
|
}.must_raise(SyntaxError)
|
80
80
|
end
|
81
81
|
|
82
|
+
it "should error on invalid ip addresses" do
|
83
|
+
collection = Stork::Collections.new
|
84
|
+
proc {
|
85
|
+
Stork::Resource::Interface.build "eth0", collection: collection do
|
86
|
+
ip '1000.1000.1.1'
|
87
|
+
end
|
88
|
+
}.must_raise(SyntaxError)
|
89
|
+
|
90
|
+
proc {
|
91
|
+
Stork::Resource::Interface.build "eth0", collection: collection do
|
92
|
+
ip 'hey.there.buddy'
|
93
|
+
end
|
94
|
+
}.must_raise(SyntaxError)
|
95
|
+
|
96
|
+
proc {
|
97
|
+
Stork::Resource::Interface.build "eth0", collection: collection do
|
98
|
+
ip '1.1.1'
|
99
|
+
end
|
100
|
+
}.must_raise(SyntaxError)
|
101
|
+
end
|
102
|
+
|
82
103
|
it "should have dhcp as the default for bootproto" do
|
83
104
|
Stork::Resource::Interface.new('eth0').bootproto.must_equal :dhcp
|
84
105
|
end
|
@@ -26,7 +26,7 @@ describe "Stork::Resource::Layout" do
|
|
26
26
|
|
27
27
|
it "requires a block for partition during build" do
|
28
28
|
proc {
|
29
|
-
|
29
|
+
Stork::Resource::Layout.build('test') do
|
30
30
|
zerombr
|
31
31
|
clearpart
|
32
32
|
part '/'
|
@@ -36,7 +36,7 @@ describe "Stork::Resource::Layout" do
|
|
36
36
|
|
37
37
|
it "requires a block for volume_group during build" do
|
38
38
|
proc {
|
39
|
-
|
39
|
+
Stork::Resource::Layout.build('test') do
|
40
40
|
zerombr
|
41
41
|
clearpart
|
42
42
|
volgroup 'hello'
|
@@ -69,7 +69,7 @@ describe "Stork::Resource::Layout" do
|
|
69
69
|
|
70
70
|
it "must error if part blocks are not given" do
|
71
71
|
proc {
|
72
|
-
|
72
|
+
Stork::Resource::Layout.build('test') do
|
73
73
|
zerombr
|
74
74
|
clearpart
|
75
75
|
end
|
@@ -29,6 +29,62 @@ describe "Stork::Resource::Network" do
|
|
29
29
|
Stork::Resource::Network.new("local").must_respond_to :search_paths=
|
30
30
|
end
|
31
31
|
|
32
|
+
it "must error if the netmask given is invalid" do
|
33
|
+
proc {
|
34
|
+
Stork::Resource::Network.build "test" do
|
35
|
+
netmask '2555555.255.255.0'
|
36
|
+
end
|
37
|
+
}.must_raise(SyntaxError)
|
38
|
+
|
39
|
+
proc {
|
40
|
+
Stork::Resource::Network.build "test" do
|
41
|
+
netmask '255.255.255.foo'
|
42
|
+
end
|
43
|
+
}.must_raise(SyntaxError)
|
44
|
+
|
45
|
+
proc {
|
46
|
+
Stork::Resource::Network.build "test" do
|
47
|
+
netmask 'howdy.there.pilgrim'
|
48
|
+
end
|
49
|
+
}.must_raise(SyntaxError)
|
50
|
+
end
|
51
|
+
|
52
|
+
it "must error if the gateway is invalid" do
|
53
|
+
proc {
|
54
|
+
Stork::Resource::Network.build "test" do
|
55
|
+
gateway '10.1.1.1111'
|
56
|
+
end
|
57
|
+
}.must_raise(SyntaxError)
|
58
|
+
|
59
|
+
proc {
|
60
|
+
Stork::Resource::Network.build "test" do
|
61
|
+
gateway '10.1.1.blah'
|
62
|
+
end
|
63
|
+
}.must_raise(SyntaxError)
|
64
|
+
|
65
|
+
proc {
|
66
|
+
Stork::Resource::Network.build "test" do
|
67
|
+
gateway 'wow, this is a really cool gateway'
|
68
|
+
end
|
69
|
+
}.must_raise(SyntaxError)
|
70
|
+
end
|
71
|
+
|
72
|
+
it "must error if the nameserver are invalid" do
|
73
|
+
proc {
|
74
|
+
Stork::Resource::Network.build "test" do
|
75
|
+
nameserver 'superfly'
|
76
|
+
nameserver '8.8.8.8'
|
77
|
+
end
|
78
|
+
}.must_raise(SyntaxError)
|
79
|
+
|
80
|
+
proc {
|
81
|
+
Stork::Resource::Network.build "test" do
|
82
|
+
nameserver '8.8.8.8'
|
83
|
+
nameserver 'superfly'
|
84
|
+
end
|
85
|
+
}.must_raise(SyntaxError)
|
86
|
+
end
|
87
|
+
|
32
88
|
it "should build" do
|
33
89
|
net = Stork::Resource::Network.build("local") do
|
34
90
|
netmask "255.255.255.0"
|
data/specs/scripts/kssetup.sh
CHANGED
@@ -1,24 +1,16 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
|
+
echo "Creating virtual environment: ksvalidator"
|
3
|
+
virtualenv specs/ksvalidator
|
4
|
+
echo "Activating!!!"
|
5
|
+
. ./specs/ksvalidator/bin/activate
|
6
|
+
echo "Installing packages"
|
7
|
+
pip install -r ./specs/scripts/requirements.txt
|
2
8
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
else
|
11
|
-
# pip install virtualenv
|
12
|
-
echo "Creating virtual environment: ksvalidator"
|
13
|
-
virtualenv ksvalidator
|
14
|
-
cd ksvalidator
|
15
|
-
echo "Activating!!!"
|
16
|
-
. ./bin/activate
|
17
|
-
echo "Installing packages"
|
18
|
-
pip install pycurl
|
19
|
-
pip install urlgrabber
|
20
|
-
git clone git://git.fedorahosted.org/git/pykickstart.git
|
21
|
-
cd pykickstart
|
22
|
-
python setup.py install
|
23
|
-
fi
|
9
|
+
cd ./specs/ksvalidator
|
10
|
+
git clone https://github.com/rhinstaller/pykickstart
|
11
|
+
cd pykickstart
|
12
|
+
python setup.py install
|
13
|
+
|
14
|
+
which ksvalidator
|
15
|
+
env
|
24
16
|
echo "Setup complete"
|
data/specs/scripts/ksvalidate.sh
CHANGED
@@ -1,21 +1,16 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
VER=$3
|
6
|
-
mkdir -p $TESTPATH
|
7
|
-
cd $TESTPATH
|
3
|
+
KSPATH=$1
|
4
|
+
VER=$2
|
8
5
|
|
9
|
-
if [
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
exit 1
|
15
|
-
fi
|
16
|
-
cd ksvalidator
|
17
|
-
source bin/activate
|
6
|
+
if ! [ -f "./specs/ksvalidator/bin/activate" ] ; then
|
7
|
+
echo "Please run 'rake ksvalidator:setup' to ensure that the virtual"
|
8
|
+
echo "environment is set up before running the integration tests or set"
|
9
|
+
echo "NOVALIDATE before you run"
|
10
|
+
exit 1
|
18
11
|
fi
|
19
12
|
|
13
|
+
source ./specs/ksvalidator/bin/activate
|
14
|
+
|
20
15
|
ksvalidator -e -v $VER $KSPATH
|
21
16
|
exit $?
|
data/specs/server_spec.rb
CHANGED
@@ -36,13 +36,13 @@ describe "Stork::Server::Application" do
|
|
36
36
|
it "should output the kickstart file for a valid host" do
|
37
37
|
get '/host/server.example.org/install'
|
38
38
|
get '/host/server.example.org'
|
39
|
-
message = "foo"
|
39
|
+
# message = "foo"
|
40
40
|
last_response.body.wont_equal "{ \"status\":\"404\", \"message\": \"Not found\" }"
|
41
41
|
end
|
42
42
|
|
43
43
|
it "should not output the kickstart file when host action is not set to install" do
|
44
44
|
get '/host/server.example.org'
|
45
|
-
message = "foo"
|
45
|
+
# message = "foo"
|
46
46
|
last_response.body.must_equal "{ \"status\":\"404\", \"message\": \"Not found\" }"
|
47
47
|
end
|
48
48
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# Config for example.org
|
2
2
|
host "server.example.org" do
|
3
3
|
template "default"
|
4
|
-
chef "default"
|
5
4
|
pxemac "00:11:22:33:44:55"
|
6
5
|
layout "home"
|
7
6
|
distro "centos"
|
@@ -11,28 +10,20 @@ host "server.example.org" do
|
|
11
10
|
|
12
11
|
interface "eth0" do
|
13
12
|
bootproto :static
|
14
|
-
ip "
|
15
|
-
|
13
|
+
ip "192.168.0.15"
|
14
|
+
network "internal-one"
|
16
15
|
end
|
17
16
|
|
18
17
|
interface "eth1" do
|
19
18
|
bootproto :static
|
20
19
|
ip "192.168.1.10"
|
21
|
-
|
22
|
-
gateway "192.168.1.1"
|
23
|
-
nameserver "192.168.1.253"
|
24
|
-
nameserver "192.168.1.252"
|
20
|
+
network "internal-two"
|
25
21
|
end
|
26
22
|
|
27
23
|
pre_snippet "setup"
|
28
24
|
post_snippet "ntp"
|
29
25
|
post_snippet "resolv-conf"
|
30
|
-
post_snippet "chef-bootstrap"
|
31
|
-
post_snippet "chef-reconfigure"
|
32
26
|
post_snippet "notify"
|
33
|
-
|
34
|
-
run_list %w{ role[base] recipe[apache] }
|
35
|
-
chef_environment "testing"
|
36
27
|
end
|
37
28
|
|
38
29
|
hosts=[
|
@@ -51,7 +42,6 @@ hosts=[
|
|
51
42
|
hosts.each do |octet, mac|
|
52
43
|
host "c0#{octet}.example.org" do
|
53
44
|
template "default"
|
54
|
-
chef "default"
|
55
45
|
distro "centos"
|
56
46
|
pxemac mac
|
57
47
|
layout "home"
|
@@ -59,9 +49,8 @@ hosts.each do |octet, mac|
|
|
59
49
|
|
60
50
|
interface "eth0" do
|
61
51
|
bootproto :static
|
62
|
-
ip "192.168.
|
63
|
-
network "
|
52
|
+
ip "192.168.0.#{octet}"
|
53
|
+
network "internal-one"
|
64
54
|
end
|
65
|
-
run_list %w{ role[node] }
|
66
55
|
end
|
67
56
|
end
|