stork 0.1.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 +7 -0
- data/.gitignore +21 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +10 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +75 -0
- data/LICENSE +201 -0
- data/README.md +61 -0
- data/Rakefile +25 -0
- data/bin/stork +97 -0
- data/bin/storkctl +62 -0
- data/lib/stork/builder.rb +104 -0
- data/lib/stork/client/plugins/host_install.rb +19 -0
- data/lib/stork/client/plugins/host_list.rb +12 -0
- data/lib/stork/client/plugins/host_localboot.rb +19 -0
- data/lib/stork/client/plugins/host_show.rb +19 -0
- data/lib/stork/collection/base.rb +45 -0
- data/lib/stork/collection/chefs.rb +6 -0
- data/lib/stork/collection/distros.rb +6 -0
- data/lib/stork/collection/hosts.rb +6 -0
- data/lib/stork/collection/layouts.rb +6 -0
- data/lib/stork/collection/networks.rb +6 -0
- data/lib/stork/collection/snippets.rb +6 -0
- data/lib/stork/collection/templates.rb +6 -0
- data/lib/stork/collections.rb +38 -0
- data/lib/stork/configuration.rb +98 -0
- data/lib/stork/deploy/command.rb +59 -0
- data/lib/stork/deploy/install_script.rb +39 -0
- data/lib/stork/deploy/kickstart_binding.rb +222 -0
- data/lib/stork/deploy/section.rb +30 -0
- data/lib/stork/deploy/snippet_binding.rb +49 -0
- data/lib/stork/plugin.rb +54 -0
- data/lib/stork/pxe.rb +70 -0
- data/lib/stork/resource/base.rb +42 -0
- data/lib/stork/resource/chef.rb +81 -0
- data/lib/stork/resource/delegator.rb +50 -0
- data/lib/stork/resource/distro.rb +30 -0
- data/lib/stork/resource/firewall.rb +47 -0
- data/lib/stork/resource/host.rb +202 -0
- data/lib/stork/resource/interface.rb +125 -0
- data/lib/stork/resource/layout.rb +50 -0
- data/lib/stork/resource/logical_volume.rb +49 -0
- data/lib/stork/resource/network.rb +36 -0
- data/lib/stork/resource/partition.rb +47 -0
- data/lib/stork/resource/password.rb +26 -0
- data/lib/stork/resource/repo.rb +29 -0
- data/lib/stork/resource/snippet.rb +20 -0
- data/lib/stork/resource/template.rb +24 -0
- data/lib/stork/resource/timezone.rb +31 -0
- data/lib/stork/resource/volume_group.rb +31 -0
- data/lib/stork/resources.rb +17 -0
- data/lib/stork/server/application.rb +127 -0
- data/lib/stork/server/control.rb +38 -0
- data/lib/stork/version.rb +4 -0
- data/lib/stork.rb +30 -0
- data/specs/builder_spec.rb +14 -0
- data/specs/collections_spec.rb +72 -0
- data/specs/configuration_spec.rb +151 -0
- data/specs/keys/snakeoil-root.pem +27 -0
- data/specs/keys/snakeoil-validation.pem +27 -0
- data/specs/kickstart_spec.rb +36 -0
- data/specs/pxe_spec.rb +57 -0
- data/specs/resource_chef_spec.rb +122 -0
- data/specs/resource_distro_spec.rb +38 -0
- data/specs/resource_firewall_spec.rb +71 -0
- data/specs/resource_host_spec.rb +323 -0
- data/specs/resource_interface_spec.rb +158 -0
- data/specs/resource_layout_spec.rb +78 -0
- data/specs/resource_logical_volume_spec.rb +44 -0
- data/specs/resource_network_spec.rb +45 -0
- data/specs/resource_partition_spec.rb +51 -0
- data/specs/resource_password_spec.rb +10 -0
- data/specs/resource_repo_spec.rb +43 -0
- data/specs/resource_snippet_spec.rb +10 -0
- data/specs/resource_template_spec.rb +5 -0
- data/specs/resource_timezone_spec.rb +5 -0
- data/specs/resource_volume_group_spec.rb +23 -0
- data/specs/scripts/kssetup.sh +24 -0
- data/specs/scripts/ksvalidate.sh +21 -0
- data/specs/server_spec.rb +84 -0
- data/specs/spec_helper.rb +33 -0
- data/specs/stork/authorized_keys +1 -0
- data/specs/stork/bundles/chefs/default.rb +9 -0
- data/specs/stork/bundles/distros/centos.rb +5 -0
- data/specs/stork/bundles/hosts/example.org.rb +66 -0
- data/specs/stork/bundles/layouts/home.rb +33 -0
- data/specs/stork/bundles/networks/local.rb +6 -0
- data/specs/stork/bundles/networks/org.rb +7 -0
- data/specs/stork/bundles/snippets/authorized-keys.erb +10 -0
- data/specs/stork/bundles/snippets/chef-bootstrap.erb +104 -0
- data/specs/stork/bundles/snippets/chef-reconfigure.erb +22 -0
- data/specs/stork/bundles/snippets/etc-hosts.erb +6 -0
- data/specs/stork/bundles/snippets/network-config.erb +7 -0
- data/specs/stork/bundles/snippets/noop.erb +1 -0
- data/specs/stork/bundles/snippets/notify.erb +2 -0
- data/specs/stork/bundles/snippets/ntp.erb +2 -0
- data/specs/stork/bundles/snippets/resolv-conf.erb +6 -0
- data/specs/stork/bundles/snippets/setup.erb +1 -0
- data/specs/stork/bundles/templates/default.ks.erb +25 -0
- data/specs/stork/config.rb +11 -0
- data/stork.gemspec +35 -0
- metadata +329 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
describe "Stork::Builder" do
|
4
|
+
it "must load everything" do
|
5
|
+
builder = Stork::Builder.load(configuration)
|
6
|
+
collection = builder.collection
|
7
|
+
collection.hosts.size.must_equal 11
|
8
|
+
collection.chefs.size.must_equal 1
|
9
|
+
collection.distros.size.must_equal 1
|
10
|
+
collection.layouts.size.must_equal 1
|
11
|
+
collection.networks.size.must_equal 2
|
12
|
+
collection.templates.size.must_equal 1
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
describe "Stork::Collections" do
|
4
|
+
it "should be created" do
|
5
|
+
Stork::Collections.new.must_be_instance_of Stork::Collections
|
6
|
+
end
|
7
|
+
|
8
|
+
it "responds to the hosts method" do
|
9
|
+
Stork::Collections.new.must_respond_to :hosts
|
10
|
+
end
|
11
|
+
|
12
|
+
it "responds to the layouts method" do
|
13
|
+
Stork::Collections.new.must_respond_to :layouts
|
14
|
+
end
|
15
|
+
|
16
|
+
it "responds to the networks method" do
|
17
|
+
Stork::Collections.new.must_respond_to :networks
|
18
|
+
end
|
19
|
+
|
20
|
+
it "responds to the chefs method" do
|
21
|
+
Stork::Collections.new.must_respond_to :chefs
|
22
|
+
end
|
23
|
+
|
24
|
+
it "responds to the distros method" do
|
25
|
+
Stork::Collections.new.must_respond_to :distros
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "Stork::Collection::Base" do
|
30
|
+
it "should be emumerable" do
|
31
|
+
Stork::Collection::Base.included_modules.must_include Enumerable
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should be created" do
|
35
|
+
Stork::Collection::Base.new.must_be_instance_of Stork::Collection::Base
|
36
|
+
end
|
37
|
+
|
38
|
+
it "responds to each" do
|
39
|
+
Stork::Collection::Base.new.must_respond_to :each
|
40
|
+
end
|
41
|
+
|
42
|
+
it "responds to validate" do
|
43
|
+
Stork::Collection::Base.new.must_respond_to :validate
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should always validate by default" do
|
47
|
+
Stork::Collection::Base.new.validate(1).must_equal true
|
48
|
+
end
|
49
|
+
|
50
|
+
it "can add and iterate through values" do
|
51
|
+
bc = Stork::Collection::Base.new
|
52
|
+
bc.add(1,2,3,4,5)
|
53
|
+
1.upto 5 do |value|
|
54
|
+
bc.include?(value)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
it "must get a value from the collection" do
|
59
|
+
class Foo
|
60
|
+
attr_reader :id
|
61
|
+
def initialize(id)
|
62
|
+
@id = id
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
bc = Stork::Collection::Base.new
|
67
|
+
1.upto 5 do |id|
|
68
|
+
bc.add(Foo.new(id))
|
69
|
+
end
|
70
|
+
bc.get(3).id.must_equal 3
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,151 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
describe "Stork::Configuration" do
|
4
|
+
before(:each) do
|
5
|
+
@path = File.dirname(__FILE__)
|
6
|
+
FileUtils.mkdir_p "#{@path}/tmp"
|
7
|
+
end
|
8
|
+
|
9
|
+
after(:each) do
|
10
|
+
FileUtils.rm_rf(Dir.glob("#{@path}/tmp/*"))
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should respond to path accessors" do
|
14
|
+
Stork::Configuration.new.must_respond_to :path
|
15
|
+
Stork::Configuration.new.must_respond_to :path=
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should respond to bundles accessors" do
|
19
|
+
Stork::Configuration.new.must_respond_to :bundle_path
|
20
|
+
Stork::Configuration.new.must_respond_to :bundle_path=
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should respond to hosts_path" do
|
24
|
+
Stork::Configuration.new.must_respond_to :hosts_path
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should respond to snippets_path" do
|
28
|
+
Stork::Configuration.new.must_respond_to :snippets_path
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should respond to layouts_path accessors" do
|
32
|
+
Stork::Configuration.new.must_respond_to :layouts_path
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should respond to networks_path accessors" do
|
36
|
+
Stork::Configuration.new.must_respond_to :networks_path
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should respond to distros_path accessors" do
|
40
|
+
Stork::Configuration.new.must_respond_to :distros_path
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should respond to templates_path accessors" do
|
44
|
+
Stork::Configuration.new.must_respond_to :templates_path
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should respond to chefs_path accessors" do
|
48
|
+
Stork::Configuration.new.must_respond_to :chefs_path
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should respond to authorized_keys_file accessors" do
|
52
|
+
Stork::Configuration.new.must_respond_to :authorized_keys_file
|
53
|
+
Stork::Configuration.new.must_respond_to :authorized_keys_file=
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should respond to pxe_path accessors" do
|
57
|
+
Stork::Configuration.new.must_respond_to :pxe_path
|
58
|
+
Stork::Configuration.new.must_respond_to :pxe_path=
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should respond to log_file accessors" do
|
62
|
+
Stork::Configuration.new.must_respond_to :log_file
|
63
|
+
Stork::Configuration.new.must_respond_to :log_file=
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should respond to pid_file accessors" do
|
67
|
+
Stork::Configuration.new.must_respond_to :pid_file
|
68
|
+
Stork::Configuration.new.must_respond_to :pid_file=
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should respond to server accessors" do
|
72
|
+
Stork::Configuration.new.must_respond_to :server
|
73
|
+
Stork::Configuration.new.must_respond_to :server=
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should respond to port accessors" do
|
77
|
+
Stork::Configuration.new.must_respond_to :port
|
78
|
+
Stork::Configuration.new.must_respond_to :port=
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should respond to bind accessors" do
|
82
|
+
Stork::Configuration.new.must_respond_to :bind
|
83
|
+
Stork::Configuration.new.must_respond_to :bind=
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should respond to timezone accessors" do
|
87
|
+
Stork::Configuration.new.must_respond_to :timezone
|
88
|
+
Stork::Configuration.new.must_respond_to :timezone=
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should have the defaults" do
|
92
|
+
config = Stork::Configuration.new
|
93
|
+
config.path.must_equal "/etc/stork"
|
94
|
+
config.bundle_path.must_equal "/etc/stork/bundles"
|
95
|
+
config.hosts_path.must_equal "/etc/stork/bundles/hosts"
|
96
|
+
config.layouts_path.must_equal "/etc/stork/bundles/layouts"
|
97
|
+
config.snippets_path.must_equal "/etc/stork/bundles/snippets"
|
98
|
+
config.networks_path.must_equal "/etc/stork/bundles/networks"
|
99
|
+
config.distros_path.must_equal "/etc/stork/bundles/distros"
|
100
|
+
config.chefs_path.must_equal "/etc/stork/bundles/chefs"
|
101
|
+
config.templates_path.must_equal "/etc/stork/bundles/templates"
|
102
|
+
config.authorized_keys_file.must_equal "/etc/stork/authorized_keys"
|
103
|
+
config.pxe_path.must_equal "/var/lib/tftpboot/pxelinux.cfg"
|
104
|
+
config.log_file.must_equal "/var/log/stork.log"
|
105
|
+
config.pid_file.must_equal "/var/run/stork.pid"
|
106
|
+
config.server.must_equal "localhost"
|
107
|
+
config.port.must_equal 9293
|
108
|
+
config.bind.must_equal "0.0.0.0"
|
109
|
+
config.timezone.must_equal "America/Los_Angeles"
|
110
|
+
end
|
111
|
+
|
112
|
+
it "should load from file" do
|
113
|
+
config = Stork::Configuration.from_file("./specs/stork/config.rb")
|
114
|
+
config.path.must_equal "./specs/stork"
|
115
|
+
config.bundle_path.must_equal "./specs/stork/bundles"
|
116
|
+
config.hosts_path.must_equal "./specs/stork/bundles/hosts"
|
117
|
+
config.layouts_path.must_equal "./specs/stork/bundles/layouts"
|
118
|
+
config.snippets_path.must_equal "./specs/stork/bundles/snippets"
|
119
|
+
config.networks_path.must_equal "./specs/stork/bundles/networks"
|
120
|
+
config.distros_path.must_equal "./specs/stork/bundles/distros"
|
121
|
+
config.chefs_path.must_equal "./specs/stork/bundles/chefs"
|
122
|
+
config.templates_path.must_equal "./specs/stork/bundles/templates"
|
123
|
+
config.authorized_keys_file.must_equal "./specs/stork/authorized_keys"
|
124
|
+
config.pxe_path.must_equal "./specs/tmp/pxeboot"
|
125
|
+
config.log_file.must_equal "./specs/tmp/stork.log"
|
126
|
+
config.pid_file.must_equal "./specs/tmp/stork.pid"
|
127
|
+
config.server.must_equal "localhost"
|
128
|
+
config.port.must_equal 5000
|
129
|
+
config.bind.must_equal "0.0.0.0"
|
130
|
+
config.timezone.must_equal "America/New_York"
|
131
|
+
end
|
132
|
+
|
133
|
+
it "should create a file if the configuration file does not exist" do
|
134
|
+
config = Stork::Configuration.from_file("./specs/tmp/config.rb")
|
135
|
+
File.exist?("./specs/tmp/config.rb").must_equal true
|
136
|
+
expected_content = <<-EOS
|
137
|
+
# Stork configuration file"
|
138
|
+
path "/etc/stork"
|
139
|
+
bundle_path "/etc/stork/bundles"
|
140
|
+
authorized_keys_file "/etc/stork/authorized_keys"
|
141
|
+
pxe_path "/var/lib/tftpboot/pxelinux.cfg"
|
142
|
+
log_file "/var/log/stork.log"
|
143
|
+
pid_file "/var/run/stork.pid"
|
144
|
+
server "localhost"
|
145
|
+
port 9293
|
146
|
+
bind "0.0.0.0"
|
147
|
+
timezone "America/Los_Angeles"
|
148
|
+
EOS
|
149
|
+
File.read("./specs/tmp/config.rb").must_equal expected_content
|
150
|
+
end
|
151
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
-----BEGIN RSA PRIVATE KEY-----
|
2
|
+
MIIEogIBAAKCAQEA5OPAyH1UC88Z8L8m+AnXgNQvz3qFOXjtZnHjAm2h4H+RKPYZ
|
3
|
+
J2YdIuvrWZC7XReRtNqzlVoKSj0DglKlng6aRHm0mlZevqm34WOe9z2r1AFUb0gh
|
4
|
+
t+JfRk/uTNWMBZhGvrzJmUFhmqfFvyEioUMKLO+lu54GoLgs9KsgBCXcYpDABME7
|
5
|
+
xK6uLjWcyD7pr1Cpx2BbhuO2P1zNXi527MEhQTzC1A4Yt/KXdR/rWLBRRT1+0Bzo
|
6
|
+
NbdM0NdGFZxJ+AlEfVIffSpNwjQAUS7vHlfPhjhkTBLVHLgTXx0QtN2LwPIhuMUi
|
7
|
+
unErkxTqFMelLe83XB1TYWfZPYHuA2OZ2vj6bQIDAQABAoIBAGyMNhjelsUi6kJp
|
8
|
+
5Kkswa6u8h2LFTM0TiGPUQENzP8SgFzUmQk+PAMbrvlC0hhL3SXPseraUJb0aH2d
|
9
|
+
hD1432Ap96RZ4YS6KCIThIfsD1jzaH99zb/O8y/9KB34B/d/R82c6l5ry0X02qrR
|
10
|
+
pAKmMGUvIYHgZ3RA49EEdqKA8gsrhKY0o+LtW3naESvD2waFH+mbJI5jBTJyAgQ+
|
11
|
+
r24uclBtB7VmrrBLJ+V32Njtee8e7FG9Xs3lyTAL60ipp7WZBGp94Y9TiBHoQIUh
|
12
|
+
crp0h5o3KMUZJTA6tChLMLlOEjhS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
|
+
9pGcJ+bsl5Bv7SASrCiOfHO5luQgrdCTPKbeOdHRJVOhsp0snMtdUXdaCtV2GX22
|
17
|
+
YW5CvckB26QJGdnwPiqcB2liRPnAYNeSBIoGAzhv8SJWXl7XwKiWieJuFTfgLFB+
|
18
|
+
lc8H/qcfMkI8aJAAwVo24XLzVA677Mf8NBOytBUCgYBHuctW3Ca0zj2pdbtr0pUT
|
19
|
+
1CzNA8PnFXgZtL0a5nlnRNNRVbwS9BbPEXkjtPbWyXBvRgIvKe4CeGEamnx22A3o
|
20
|
+
9tce40mU/tC6y0pFhYIJeuQkEHqHr4g+pNPe7WQ+EIfOvMrTsgP5X8WO8snbtxP3
|
21
|
+
bOfSrYzQdZkgHwsoKqNv4QJ/WuX4pcFVAL+idQr9rHTcASZfagUGE1lLdXcNQG5c
|
22
|
+
Q9bO7hr3KfgOPv3nSwLJyh7vZJ2SBpPvqg9qyBuMBCq8sW6dRL57yMViZn9Hqsbf
|
23
|
+
8pWgI6Nrf1d6a9H4ZII1X2fyLCJNOZSWCs2vVRauSLL3pKU8OOvdVjlW7fOwU+iZ
|
24
|
+
EQKBgFGOottZB3OUEkHVfbw39ERf1Saqc2oOfw8YM9H0TIhCJvTTSlhaL6OYqEig
|
25
|
+
I3z0yoLGTD/0e7DXjC2kQyf+9LTMwcodC6MbwZ/cncDkebFLZ1DDig7+s0WoAjfI
|
26
|
+
Kl/ogSogT0HuY/6VcRjkvccDN7aZvLDXrS9N7EwqhjojsIl6
|
27
|
+
-----END RSA PRIVATE KEY-----
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
describe "Stork::Deploy::Kickstart" do
|
4
|
+
before(:each) do
|
5
|
+
@host = collection.hosts.get("server.example.org")
|
6
|
+
@path = File.dirname(__FILE__)
|
7
|
+
FileUtils.mkdir_p "#{@path}/tmp"
|
8
|
+
end
|
9
|
+
|
10
|
+
after(:each) do
|
11
|
+
FileUtils.rm_rf(Dir.glob("#{@path}/tmp/*"))
|
12
|
+
end
|
13
|
+
|
14
|
+
%w{ RHEL5 RHEL6 RHEL7 }.each do |ver|
|
15
|
+
it "should generate valid kickstart configurations for #{ver}" do
|
16
|
+
ksvalidate = "#{@path}/scripts/ksvalidate.sh"
|
17
|
+
testpath = "#{@path}"
|
18
|
+
kspath = "#{@path}/tmp/output.ks"
|
19
|
+
template = "#{@path}/stork/bundles/templates/default.ks.erb"
|
20
|
+
|
21
|
+
ks = Stork::Deploy::InstallScript.new(@host, :kickstart)
|
22
|
+
|
23
|
+
File.open("#{@path}/tmp/output.ks", 'w') do |file|
|
24
|
+
file.write(ks.render)
|
25
|
+
end
|
26
|
+
|
27
|
+
Open3.popen3("#{ksvalidate} #{testpath} #{kspath} #{ver}") do |stdin, stdout, stderr, wait_thr|
|
28
|
+
exit_status = wait_thr.value.to_i
|
29
|
+
output = (stdout.readlines + stderr.readlines).join
|
30
|
+
assert_equal(0, exit_status, output)
|
31
|
+
end
|
32
|
+
|
33
|
+
File.unlink("#{@path}/tmp/output.ks")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/specs/pxe_spec.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
describe "Stork::PXE" do
|
5
|
+
before :all do
|
6
|
+
@host = collection.hosts.get("server.example.org")
|
7
|
+
@path = './specs/tmp/pxeboot'
|
8
|
+
FileUtils.mkdir_p @path
|
9
|
+
@pxe = Stork::PXE.new(@host, 'midwife.example.org', 9293)
|
10
|
+
end
|
11
|
+
|
12
|
+
after(:each) do
|
13
|
+
FileUtils.rm_rf(Dir.glob('./specs/tmp/*'))
|
14
|
+
end
|
15
|
+
|
16
|
+
it "creates the localboot file" do
|
17
|
+
@pxe.localboot
|
18
|
+
expected_content = <<-EOS
|
19
|
+
DEFAULT local
|
20
|
+
PROMPT 0
|
21
|
+
TIMEOUT 0
|
22
|
+
TOTALTIMEOUT 0
|
23
|
+
ONTIMEOUT local
|
24
|
+
LABEL local
|
25
|
+
LOCALBOOT -1
|
26
|
+
EOS
|
27
|
+
File.read("#{@path}/01-00-11-22-33-44-55").must_equal expected_content
|
28
|
+
end
|
29
|
+
|
30
|
+
it "creates the default file" do
|
31
|
+
@pxe.default
|
32
|
+
expected_content = <<-EOS
|
33
|
+
DEFAULT local
|
34
|
+
PROMPT 0
|
35
|
+
TIMEOUT 0
|
36
|
+
TOTALTIMEOUT 0
|
37
|
+
ONTIMEOUT local
|
38
|
+
LABEL local
|
39
|
+
LOCALBOOT -1
|
40
|
+
EOS
|
41
|
+
File.read("#{@path}/01-00-11-22-33-44-55").must_equal expected_content
|
42
|
+
end
|
43
|
+
|
44
|
+
it "creates the install file" do
|
45
|
+
@pxe.install
|
46
|
+
expected_content = <<-EOS
|
47
|
+
default install
|
48
|
+
prompt 0
|
49
|
+
timeout 1
|
50
|
+
label install
|
51
|
+
kernel vmlinuz
|
52
|
+
ipappend 2
|
53
|
+
append initrd=initrd.img ksdevice=bootif priority=critical kssendmac ks=http://midwife.example.org:9293/host/server.example.org
|
54
|
+
EOS
|
55
|
+
File.read("#{@path}/01-00-11-22-33-44-55").must_equal expected_content
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
describe "Chef" do
|
4
|
+
it "should be created" do
|
5
|
+
Stork::Resource::Chef.new("test").must_be_instance_of Stork::Resource::Chef
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should respond to the name method" do
|
9
|
+
Stork::Resource::Chef.new("test").must_respond_to :name
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should respond to the url accessors" do
|
13
|
+
Stork::Resource::Chef.new("test").must_respond_to :url
|
14
|
+
Stork::Resource::Chef.new("test").must_respond_to :url=
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should respond to the version accessors" do
|
18
|
+
Stork::Resource::Chef.new("test").must_respond_to :version
|
19
|
+
Stork::Resource::Chef.new("test").must_respond_to :version=
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should respond to the client_key accessors" do
|
23
|
+
Stork::Resource::Chef.new("test").must_respond_to :client_key
|
24
|
+
Stork::Resource::Chef.new("test").must_respond_to :client_key=
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should respond to the client_name accessors" do
|
28
|
+
Stork::Resource::Chef.new("test").must_respond_to :client_name
|
29
|
+
Stork::Resource::Chef.new("test").must_respond_to :client_name=
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should respond to the validator_name accessors" do
|
33
|
+
Stork::Resource::Chef.new("test").must_respond_to :validator_name
|
34
|
+
Stork::Resource::Chef.new("test").must_respond_to :validator_name=
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should respond to the validation_key accessors" do
|
38
|
+
Stork::Resource::Chef.new("test").must_respond_to :validation_key
|
39
|
+
Stork::Resource::Chef.new("test").must_respond_to :validation_key=
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should respond to the encrypted_data_bag_secret accessors" do
|
43
|
+
Stork::Resource::Chef.new("test").must_respond_to :encrypted_data_bag_secret
|
44
|
+
Stork::Resource::Chef.new("test").must_respond_to :encrypted_data_bag_secret=
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should require url" do
|
48
|
+
proc {
|
49
|
+
ckey = "./specs/keys/snakeoil-root.pem"
|
50
|
+
vkey = "./specs/keys/snakeoil-validation.pem"
|
51
|
+
|
52
|
+
chef = Stork::Resource::Chef.build("test") do
|
53
|
+
version "11.4.4"
|
54
|
+
client_key ckey
|
55
|
+
validation_key vkey
|
56
|
+
end
|
57
|
+
}.must_raise(SyntaxError)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should require version" do
|
61
|
+
proc {
|
62
|
+
ckey = "./specs/keys/snakeoil-root.pem"
|
63
|
+
vkey = "./specs/keys/snakeoil-validation.pem"
|
64
|
+
|
65
|
+
chef = Stork::Resource::Chef.build("test") do
|
66
|
+
url "https://chef.example.org"
|
67
|
+
client_key ckey
|
68
|
+
validation_key vkey
|
69
|
+
end
|
70
|
+
}.must_raise(SyntaxError)
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should require client_key" do
|
74
|
+
proc {
|
75
|
+
ckey = "./specs/keys/snakeoil-root.pem"
|
76
|
+
vkey = "./specs/keys/snakeoil-validation.pem"
|
77
|
+
|
78
|
+
chef = Stork::Resource::Chef.build("test") do
|
79
|
+
url "https://chef.example.org"
|
80
|
+
version "11.4.4"
|
81
|
+
validation_key vkey
|
82
|
+
end
|
83
|
+
}.must_raise(SyntaxError)
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should require validation_key" do
|
87
|
+
proc {
|
88
|
+
ckey = "./specs/keys/snakeoil-root.pem"
|
89
|
+
vkey = "./specs/keys/snakeoil-validation.pem"
|
90
|
+
|
91
|
+
chef = Stork::Resource::Chef.build("test") do
|
92
|
+
url "https://chef.example.org"
|
93
|
+
version "11.4.4"
|
94
|
+
client_key ckey
|
95
|
+
end
|
96
|
+
}.must_raise(SyntaxError)
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should build" do
|
100
|
+
ckey = "./specs/keys/snakeoil-root.pem"
|
101
|
+
vkey = "./specs/keys/snakeoil-validation.pem"
|
102
|
+
|
103
|
+
chef = Stork::Resource::Chef.build("test") do
|
104
|
+
url "https://chef.example.org"
|
105
|
+
version "11.4.4"
|
106
|
+
client_name "root"
|
107
|
+
client_key ckey
|
108
|
+
validator_name "validator"
|
109
|
+
validation_key vkey
|
110
|
+
encrypted_data_bag_secret "secret"
|
111
|
+
end
|
112
|
+
|
113
|
+
chef.name.must_equal "test"
|
114
|
+
chef.url.must_equal "https://chef.example.org"
|
115
|
+
chef.version.must_equal "11.4.4"
|
116
|
+
chef.client_name.must_equal "root"
|
117
|
+
chef.client_key.must_equal File.read(ckey)
|
118
|
+
chef.validator_name.must_equal "validator"
|
119
|
+
chef.validation_key.must_equal File.read(vkey)
|
120
|
+
chef.encrypted_data_bag_secret.must_equal "secret"
|
121
|
+
end
|
122
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
describe "Stork::Resource::Distro" do
|
4
|
+
it "should be created" do
|
5
|
+
Stork::Resource::Distro.new("test").must_be_instance_of Stork::Resource::Distro
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should respond to the name method" do
|
9
|
+
Stork::Resource::Distro.new("test").must_respond_to :name
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should respond to the kernel accessors" do
|
13
|
+
Stork::Resource::Distro.new("test").must_respond_to :kernel
|
14
|
+
Stork::Resource::Distro.new("test").must_respond_to :kernel=
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should respond to the image accessors" do
|
18
|
+
Stork::Resource::Distro.new("test").must_respond_to :image
|
19
|
+
Stork::Resource::Distro.new("test").must_respond_to :image=
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should respond to the url accessors" do
|
23
|
+
Stork::Resource::Distro.new("test").must_respond_to :url
|
24
|
+
Stork::Resource::Distro.new("test").must_respond_to :url=
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should build" do
|
28
|
+
distro = Stork::Resource::Distro.build("test") do
|
29
|
+
kernel "vmlinuz"
|
30
|
+
image "initrd.img"
|
31
|
+
url "http://mirror.example.org"
|
32
|
+
end
|
33
|
+
distro.name.must_equal "test"
|
34
|
+
distro.kernel.must_equal "vmlinuz"
|
35
|
+
distro.image.must_equal "initrd.img"
|
36
|
+
distro.url.must_equal "http://mirror.example.org"
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
describe "Stork::Resource::Firewall" do
|
4
|
+
it "must respond to the enabled accessors" do
|
5
|
+
Stork::Resource::Firewall.new.must_respond_to :enabled
|
6
|
+
Stork::Resource::Firewall.new.must_respond_to :enabled=
|
7
|
+
end
|
8
|
+
|
9
|
+
it "must respond to the trusted_devices accessors" do
|
10
|
+
Stork::Resource::Firewall.new.must_respond_to :trusted_devices
|
11
|
+
Stork::Resource::Firewall.new.must_respond_to :trusted_devices=
|
12
|
+
end
|
13
|
+
|
14
|
+
it "must respond to the allowed_ports accessors" do
|
15
|
+
Stork::Resource::Firewall.new.must_respond_to :allowed_ports
|
16
|
+
Stork::Resource::Firewall.new.must_respond_to :allowed_ports=
|
17
|
+
end
|
18
|
+
|
19
|
+
it "must respond to the ssh accessors" do
|
20
|
+
Stork::Resource::Firewall.new.must_respond_to :ssh
|
21
|
+
Stork::Resource::Firewall.new.must_respond_to :ssh=
|
22
|
+
end
|
23
|
+
|
24
|
+
it "must respond to the telnet accessors" do
|
25
|
+
Stork::Resource::Firewall.new.must_respond_to :telnet
|
26
|
+
Stork::Resource::Firewall.new.must_respond_to :telnet=
|
27
|
+
end
|
28
|
+
|
29
|
+
it "must respond to the smtp accessors" do
|
30
|
+
Stork::Resource::Firewall.new.must_respond_to :smtp
|
31
|
+
Stork::Resource::Firewall.new.must_respond_to :smtp=
|
32
|
+
end
|
33
|
+
|
34
|
+
it "must respond to the http accessors" do
|
35
|
+
Stork::Resource::Firewall.new.must_respond_to :http
|
36
|
+
Stork::Resource::Firewall.new.must_respond_to :http=
|
37
|
+
end
|
38
|
+
|
39
|
+
it "must respond to the ftp accessors" do
|
40
|
+
Stork::Resource::Firewall.new.must_respond_to :ftp
|
41
|
+
Stork::Resource::Firewall.new.must_respond_to :ftp=
|
42
|
+
end
|
43
|
+
|
44
|
+
it "must build disabled" do
|
45
|
+
fw = Stork::Resource::Firewall.build do
|
46
|
+
disable
|
47
|
+
end
|
48
|
+
fw.enabled.must_equal false
|
49
|
+
end
|
50
|
+
|
51
|
+
it "must build enabled" do
|
52
|
+
fw = Stork::Resource::Firewall.build do
|
53
|
+
trusted 'eth1'
|
54
|
+
trusted 'eth2'
|
55
|
+
allow '8080:tcp'
|
56
|
+
nossh
|
57
|
+
telnet
|
58
|
+
smtp
|
59
|
+
http
|
60
|
+
ftp
|
61
|
+
end
|
62
|
+
fw.enabled.must_equal true
|
63
|
+
fw.trusted_devices.must_equal ['eth1', 'eth2']
|
64
|
+
fw.allowed_ports.must_equal ['8080:tcp']
|
65
|
+
fw.ssh.must_equal false
|
66
|
+
fw.telnet.must_equal true
|
67
|
+
fw.smtp.must_equal true
|
68
|
+
fw.http.must_equal true
|
69
|
+
fw.ftp.must_equal true
|
70
|
+
end
|
71
|
+
end
|