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
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1581ba2bfdc4b0cf01bccf46a1c47e6e13e17189
|
4
|
+
data.tar.gz: a787111c144416b14481e5a37d563cf15b54aa5e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7cc04766af4a80d5e9f63d0c31856ba10bbdd4f179eb9325755dc1390f1dac2c7f8691258147081e4df8520bf234aa450e9bca5e09a3ca1936464d21dd4f5c40
|
7
|
+
data.tar.gz: 5f11301ad092f211d2fed355201f30416460f3236168bab0ad693c1bb30f5ee774b653d9fbfc3d34d94fa2d4cd618da439a417b4f11abbb59ea6cf9839e53ee5
|
data/.gitignore
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
log/
|
12
|
+
lib/bundler/man
|
13
|
+
pkg
|
14
|
+
rdoc
|
15
|
+
specs/reports
|
16
|
+
specs/tmp
|
17
|
+
specs/version_tmp
|
18
|
+
specs/ksvalidator
|
19
|
+
tmp
|
20
|
+
test*
|
21
|
+
.DS_Store
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
stork
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.0.0-p247
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
stork (0.1.0.pre)
|
5
|
+
highline
|
6
|
+
rest-client
|
7
|
+
sinatra
|
8
|
+
sqlite3
|
9
|
+
thin
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
coveralls (0.7.0)
|
15
|
+
multi_json (~> 1.3)
|
16
|
+
rest-client
|
17
|
+
simplecov (>= 0.7)
|
18
|
+
term-ansicolor
|
19
|
+
thor
|
20
|
+
daemons (1.1.9)
|
21
|
+
docile (1.1.3)
|
22
|
+
eventmachine (1.0.3)
|
23
|
+
given_core (3.5.4)
|
24
|
+
sorcerer (>= 0.3.7)
|
25
|
+
highline (1.6.21)
|
26
|
+
mime-types (2.2)
|
27
|
+
minitest (4.7.5)
|
28
|
+
minitest-debugger (1.0.1)
|
29
|
+
minitest (~> 4.0)
|
30
|
+
minitest-given (3.5.4)
|
31
|
+
given_core (= 3.5.4)
|
32
|
+
minitest (> 4.3)
|
33
|
+
multi_json (1.9.2)
|
34
|
+
rack (1.5.2)
|
35
|
+
rack-protection (1.5.3)
|
36
|
+
rack
|
37
|
+
rack-test (0.6.2)
|
38
|
+
rack (>= 1.0)
|
39
|
+
rake (10.2.2)
|
40
|
+
rest-client (1.6.7)
|
41
|
+
mime-types (>= 1.16)
|
42
|
+
simplecov (0.8.2)
|
43
|
+
docile (~> 1.1.0)
|
44
|
+
multi_json
|
45
|
+
simplecov-html (~> 0.8.0)
|
46
|
+
simplecov-html (0.8.0)
|
47
|
+
sinatra (1.4.5)
|
48
|
+
rack (~> 1.4)
|
49
|
+
rack-protection (~> 1.4)
|
50
|
+
tilt (~> 1.3, >= 1.3.4)
|
51
|
+
sorcerer (1.0.2)
|
52
|
+
sqlite3 (1.3.9)
|
53
|
+
term-ansicolor (1.3.0)
|
54
|
+
tins (~> 1.0)
|
55
|
+
thin (1.6.2)
|
56
|
+
daemons (>= 1.0.9)
|
57
|
+
eventmachine (>= 1.0.0)
|
58
|
+
rack (>= 1.0.0)
|
59
|
+
thor (0.19.1)
|
60
|
+
tilt (1.4.1)
|
61
|
+
tins (1.1.0)
|
62
|
+
|
63
|
+
PLATFORMS
|
64
|
+
ruby
|
65
|
+
|
66
|
+
DEPENDENCIES
|
67
|
+
bundler (~> 1.3)
|
68
|
+
coveralls
|
69
|
+
minitest (~> 4.7.3)
|
70
|
+
minitest-debugger
|
71
|
+
minitest-given
|
72
|
+
rack-test
|
73
|
+
rake
|
74
|
+
simplecov
|
75
|
+
stork!
|
data/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Stork
|
2
|
+
[](https://travis-ci.org/rlyon/stork)
|
3
|
+
[](https://coveralls.io/r/rlyon/stork)
|
4
|
+
[](https://codeclimate.com/github/rlyon/stork)
|
5
|
+
|
6
|
+
Stork is a autoinstall utility, kickstart generation tool and server for CentOS and Redhat systems. It aims to fill the gap in the bare metal systems deployment that many of the other tools for cloud and virtual systems excel at.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Installation using rubygems:
|
11
|
+
|
12
|
+
$ gem install stork
|
13
|
+
|
14
|
+
Install the latest version from the github:
|
15
|
+
|
16
|
+
$ git clone https://github.com/rlyon/stork.git
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
### Control the server
|
21
|
+
storkctl start restart stop [options]
|
22
|
+
|
23
|
+
### Query
|
24
|
+
stork host list
|
25
|
+
stork host localboot [name]
|
26
|
+
stork host install [name]
|
27
|
+
stork host show [name]
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
### Grab the source and make a branch
|
32
|
+
|
33
|
+
1. Fork it
|
34
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
35
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
36
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
37
|
+
5. Create new Pull Request
|
38
|
+
|
39
|
+
### Seting up for the kickstart validation tests
|
40
|
+
|
41
|
+
To run the kickstart validation tests on your local system, you
|
42
|
+
will need to install python and the python virtualenv module.
|
43
|
+
I'm currently using 2.7, and I don't know if it makes a difference.
|
44
|
+
On Linux you can use your favorite package manager if by some chance
|
45
|
+
your distribution didn't come with it installed. On Mac use homebrew
|
46
|
+
or macports to avoid using the system python which is bound to be
|
47
|
+
a very old version.
|
48
|
+
|
49
|
+
$ brew install python
|
50
|
+
$ pip install virtualenv
|
51
|
+
|
52
|
+
Once python and virtualenv has been installed, run
|
53
|
+
|
54
|
+
$ rake validator:setup
|
55
|
+
|
56
|
+
This will create the directories that you need, set up a virtual
|
57
|
+
environment and get everything ready for the integration tests.
|
58
|
+
|
59
|
+
### Run the tests to see if it breaks
|
60
|
+
|
61
|
+
$ rake test
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rake/testtask"
|
3
|
+
|
4
|
+
task default: :test
|
5
|
+
|
6
|
+
Rake::TestTask.new do |t|
|
7
|
+
t.libs.push File.join(File.dirname(__FILE__), 'lib')
|
8
|
+
t.test_files = FileList['specs/*_spec.rb']
|
9
|
+
t.verbose = true
|
10
|
+
end
|
11
|
+
|
12
|
+
namespace :ksvalidator do
|
13
|
+
desc 'Set up the validation directories and environment.'
|
14
|
+
task :setup do
|
15
|
+
spath = File.join(File.dirname(__FILE__), 'specs', 'scripts', 'kssetup.sh')
|
16
|
+
vpath = File.join(File.dirname(__FILE__), 'specs')
|
17
|
+
puts "Setting up in #{vpath}"
|
18
|
+
system("mkdir -p #{vpath} ; cd #{vpath} ; sh #{spath}")
|
19
|
+
end
|
20
|
+
|
21
|
+
task :clean do
|
22
|
+
vpath = File.join(File.dirname(__FILE__), 'specs', 'ksvalidator')
|
23
|
+
FileUtils.rm_rf(Dir.glob("#{vpath}/*"))
|
24
|
+
end
|
25
|
+
end
|
data/bin/stork
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'rubygems'
|
5
|
+
rescue LoadError
|
6
|
+
end
|
7
|
+
|
8
|
+
begin
|
9
|
+
require 'stork'
|
10
|
+
rescue LoadError
|
11
|
+
$LOAD_PATH << File.dirname(__FILE__) + "/../lib"
|
12
|
+
require 'stork'
|
13
|
+
end
|
14
|
+
|
15
|
+
require 'optparse'
|
16
|
+
require 'ostruct'
|
17
|
+
|
18
|
+
class StorkApp
|
19
|
+
def initialize
|
20
|
+
@options = OpenStruct.new
|
21
|
+
@options.config = "/etc/stork/config.rb"
|
22
|
+
|
23
|
+
@opts = OptionParser.new do |o|
|
24
|
+
o.banner = "Usage: stork sub-command action [options]"
|
25
|
+
o.on("-c", "--config FILE", "Read configuration from the specified file") do |config|
|
26
|
+
@options.config = config
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def help(error = nil)
|
32
|
+
puts "Error: #{error}" if error
|
33
|
+
puts @opts.help
|
34
|
+
puts
|
35
|
+
puts "** COMMANDS **"
|
36
|
+
plugins.sort.each do |plugin|
|
37
|
+
const_name = "#{plugin}::#{plugin.to_s.gsub('Plugin', '')}"
|
38
|
+
puts Module.const_get(const_name).help
|
39
|
+
end
|
40
|
+
exit 1
|
41
|
+
end
|
42
|
+
|
43
|
+
# Probably not the best way to keep track
|
44
|
+
def plugins
|
45
|
+
Module.constants.select{|m| m =~ /Plugin/}
|
46
|
+
end
|
47
|
+
|
48
|
+
def parse
|
49
|
+
sub_command = ARGV.shift
|
50
|
+
action = ARGV.shift
|
51
|
+
|
52
|
+
if sub_command.nil? || action.nil?
|
53
|
+
help "You need to pass a sub-command and an action."
|
54
|
+
end
|
55
|
+
|
56
|
+
sub_command_name = sub_command.to_s.capitalize
|
57
|
+
action_name = action.to_s.capitalize
|
58
|
+
|
59
|
+
opt_parse
|
60
|
+
|
61
|
+
plugin_name = "#{sub_command_name}#{action_name}"
|
62
|
+
module_name = "#{plugin_name}Plugin"
|
63
|
+
constant_name = "#{module_name}::#{plugin_name}"
|
64
|
+
|
65
|
+
begin
|
66
|
+
klass = Stork.const_get(constant_name)
|
67
|
+
# pass the options and the remaning args
|
68
|
+
configuration = Stork::Configuration.from_file(@options.config)
|
69
|
+
@plugin = klass.new(configuration, @options, ARGV)
|
70
|
+
rescue NameError => err
|
71
|
+
help "Unknown sub-command"
|
72
|
+
rescue Errno::ENOENT => err
|
73
|
+
help err.message
|
74
|
+
raise "bam"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def opt_parse
|
79
|
+
@opts.parse!
|
80
|
+
end
|
81
|
+
|
82
|
+
def run
|
83
|
+
begin
|
84
|
+
@plugin.run
|
85
|
+
rescue SyntaxError => err
|
86
|
+
help err.message
|
87
|
+
rescue RestClient::InternalServerError => err
|
88
|
+
puts err.message
|
89
|
+
rescue RestClient::ResourceNotFound
|
90
|
+
puts "Not Found"
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
app = StorkApp.new
|
96
|
+
app.parse
|
97
|
+
app.run
|
data/bin/storkctl
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'rubygems'
|
5
|
+
rescue LoadError
|
6
|
+
end
|
7
|
+
|
8
|
+
begin
|
9
|
+
require 'stork'
|
10
|
+
rescue LoadError
|
11
|
+
$LOAD_PATH << File.dirname(__FILE__) + "/../lib"
|
12
|
+
require 'stork'
|
13
|
+
end
|
14
|
+
|
15
|
+
require 'optparse'
|
16
|
+
require 'ostruct'
|
17
|
+
|
18
|
+
class StorkCtlApp
|
19
|
+
def initialize
|
20
|
+
@options = OpenStruct.new
|
21
|
+
@options.config = "/etc/stork/config.rb"
|
22
|
+
@options.command = :start
|
23
|
+
end
|
24
|
+
|
25
|
+
def parse
|
26
|
+
opts = OptionParser.new do |o|
|
27
|
+
o.banner = "Usage: storkctl start|stop|restart [options]"
|
28
|
+
o.on("-c", "--config FILE", "Read configuration from the specified file") do |config|
|
29
|
+
@options.config = config
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
action = :"#{ARGV.shift}"
|
34
|
+
unless [:start, :stop, :restart].include?(action)
|
35
|
+
puts opts.help
|
36
|
+
exit 1
|
37
|
+
end
|
38
|
+
@options.command = action
|
39
|
+
opts.parse!
|
40
|
+
end
|
41
|
+
|
42
|
+
def build
|
43
|
+
@configuration = Stork::Configuration.from_file(@options.config)
|
44
|
+
@collection = Stork::Builder.load(@configuration).collection
|
45
|
+
end
|
46
|
+
|
47
|
+
def run
|
48
|
+
case @options.command
|
49
|
+
when :start
|
50
|
+
Stork::Server::Control.start(@configuration, @collection)
|
51
|
+
when :stop
|
52
|
+
Stork::Server::Control.stop(@configuration, @collection)
|
53
|
+
when :restart
|
54
|
+
Stork::Server::Control.restart(@configuration, @collection)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
app = StorkCtlApp.new
|
60
|
+
app.parse
|
61
|
+
app.build
|
62
|
+
app.run
|
@@ -0,0 +1,104 @@
|
|
1
|
+
module Stork
|
2
|
+
# The Builder object loads all of the configuration files and parses them
|
3
|
+
# to build a collection of resources
|
4
|
+
#
|
5
|
+
# === Attributes
|
6
|
+
# * +configuration+ - The configuration containing the paths to the resource
|
7
|
+
# files.
|
8
|
+
class Builder
|
9
|
+
attr_reader :collection
|
10
|
+
attr_reader :configuration
|
11
|
+
|
12
|
+
def initialize(configuration)
|
13
|
+
@configuration = configuration
|
14
|
+
@collection = Stork::Collections.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.load(configuration)
|
18
|
+
builder = Builder.new(configuration)
|
19
|
+
delegator = BuilderDelegator.new(builder)
|
20
|
+
|
21
|
+
# Load in snippets and templates
|
22
|
+
delegator.snippets(configuration.snippets_path)
|
23
|
+
delegator.templates(configuration.templates_path)
|
24
|
+
|
25
|
+
load_paths = [
|
26
|
+
configuration.distros_path,
|
27
|
+
configuration.chefs_path,
|
28
|
+
configuration.networks_path,
|
29
|
+
configuration.layouts_path,
|
30
|
+
configuration.hosts_path
|
31
|
+
]
|
32
|
+
|
33
|
+
load_paths.each do |path|
|
34
|
+
Dir.glob(path + '/*.rb') do |file|
|
35
|
+
delegator.instance_eval(File.read(file))
|
36
|
+
end
|
37
|
+
end
|
38
|
+
builder
|
39
|
+
end
|
40
|
+
|
41
|
+
# Expose a limited number of methods for DSL parsing from files. Allow
|
42
|
+
# delegation of the host, layout, network, chef, distro, templates and
|
43
|
+
# snippets blocks.
|
44
|
+
#
|
45
|
+
# ==== Attributes
|
46
|
+
# * +obj+ - The Builder object that is being delegated.
|
47
|
+
class BuilderDelegator
|
48
|
+
def initialize(obj)
|
49
|
+
@delegated = obj
|
50
|
+
end
|
51
|
+
|
52
|
+
def host(name, &block)
|
53
|
+
@delegated.collection.hosts.add(
|
54
|
+
Resource::Host.build(
|
55
|
+
name,
|
56
|
+
configuration: @delegated.configuration,
|
57
|
+
collection: @delegated.collection,
|
58
|
+
&block
|
59
|
+
)
|
60
|
+
)
|
61
|
+
end
|
62
|
+
|
63
|
+
def layout(name, &block)
|
64
|
+
@delegated.collection.layouts.add(
|
65
|
+
Resource::Layout.build(name, &block)
|
66
|
+
)
|
67
|
+
end
|
68
|
+
|
69
|
+
def network(name, &block)
|
70
|
+
@delegated.collection.networks.add(
|
71
|
+
Resource::Network.build(name, &block)
|
72
|
+
)
|
73
|
+
end
|
74
|
+
|
75
|
+
def chef(name, &block)
|
76
|
+
@delegated.collection.chefs.add(
|
77
|
+
Resource::Chef.build(name, &block)
|
78
|
+
)
|
79
|
+
end
|
80
|
+
|
81
|
+
def distro(name, &block)
|
82
|
+
@delegated.collection.distros.add(
|
83
|
+
Resource::Distro.build(name, &block)
|
84
|
+
)
|
85
|
+
end
|
86
|
+
|
87
|
+
def templates(path)
|
88
|
+
Dir.glob(path + '/*.erb') do |file|
|
89
|
+
@delegated.collection.templates.add(
|
90
|
+
Resource::Template.new(file)
|
91
|
+
)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def snippets(path)
|
96
|
+
Dir.glob(path + '/*.erb') do |file|
|
97
|
+
@delegated.collection.snippets.add(
|
98
|
+
Resource::Snippet.new(file)
|
99
|
+
)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|