rzo 0.1.0 → 0.2.0
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/.gitignore +15 -0
- data/.rubocop.yml +62 -0
- data/.simplecov +5 -0
- data/.travis.yml +10 -1
- data/.yardopts +1 -0
- data/CHANGELOG.md +18 -0
- data/Gemfile +1 -4
- data/Guardfile +41 -0
- data/LICENSE +13 -0
- data/README.md +308 -20
- data/Rakefile +28 -3
- data/bin/console +5 -6
- data/exe/rizzo +7 -0
- data/exe/rzo +7 -0
- data/ext/_rizzo.json +32 -0
- data/lib/rzo/app/config.rb +16 -0
- data/lib/rzo/app/generate.rb +137 -0
- data/lib/rzo/app/subcommand.rb +172 -0
- data/lib/rzo/app/templates/Vagrantfile.erb +55 -0
- data/lib/rzo/app.rb +92 -0
- data/lib/rzo/logging.rb +144 -0
- data/lib/rzo/option_parsing.rb +123 -0
- data/lib/rzo/trollop.rb +930 -0
- data/lib/rzo/version.rb +15 -1
- data/lib/rzo.rb +6 -2
- data/rzo.gemspec +35 -14
- metadata +196 -19
- data/CODE_OF_CONDUCT.md +0 -74
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d67408c1091aa82e515dd92bbd1bbcd1034290e6
|
4
|
+
data.tar.gz: 04671d9b7c98f50d71a653489d8862e181cf23a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3897968ecc1fb45588f2888003559de212c0f80300d91528cd71ec3a016a1bbe4efe8632574da15dc6995ddc52ae083fd9adca7b4ca74dcb56032c13cc324d4
|
7
|
+
data.tar.gz: 6252bd6fec7b7f27912f34e29bd6eb0d29469392d177a9df4077fadde5c33d425c2bed73e24f212268b4e9c6bb4ca5e37d37763577eb80a7c90cda4a6393d750
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
---
|
2
|
+
AllCops:
|
3
|
+
DisplayCopNames: true
|
4
|
+
DisplayStyleGuide: true
|
5
|
+
Exclude:
|
6
|
+
- vendor/**/*
|
7
|
+
- pkg/**/*
|
8
|
+
- spec/fixtures/**/*
|
9
|
+
- lib/rzo/trollop.rb
|
10
|
+
|
11
|
+
# Cop's to ignore
|
12
|
+
|
13
|
+
Lint/UnneededDisable:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Layout/MultilineOperationIndentation:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
# With this enabled it suggests a change that will break the Gemfile
|
20
|
+
Lint/AssignmentInCondition:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
Metrics/LineLength:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
# This is a good idea, but does not line up the rest of the lines making it
|
27
|
+
# harder to read
|
28
|
+
Layout/IndentHash:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
Style/Next:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
# If enabled, this cop makes it harder to understand the logic
|
35
|
+
Style/NonNilCheck:
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
Style/TrailingCommaInLiteral:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
Style/TrailingCommaInArguments:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
# Cop's that require ruby >= 1.9
|
45
|
+
Style/HashSyntax:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Style/BracesAroundHashParameters:
|
49
|
+
Enabled: false
|
50
|
+
|
51
|
+
# too many lines is the nature of a Vagrantfile
|
52
|
+
Metrics/BlockLength:
|
53
|
+
Enabled: false
|
54
|
+
|
55
|
+
Metrics/BlockNesting:
|
56
|
+
Enabled: false
|
57
|
+
|
58
|
+
Lint/ShadowingOuterLocalVariable:
|
59
|
+
Enabled: false
|
60
|
+
|
61
|
+
Style/IfInsideElse:
|
62
|
+
Enabled: false
|
data/.simplecov
ADDED
data/.travis.yml
CHANGED
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--markup markdown --private
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## [v0.2.0](https://github.com/ghoneycutt/rizzo/tree/v0.1.0) (2017-08-23)
|
4
|
+
**Closed issues:**
|
5
|
+
|
6
|
+
- configuration language should be YAML instead of JSON [\#4](https://github.com/ghoneycutt/rizzo/issues/4)
|
7
|
+
|
8
|
+
**Merged pull requests:**
|
9
|
+
|
10
|
+
- rzo gem \(bundle exec rizzo --help\) [\#8](https://github.com/ghoneycutt/rizzo/pull/8) ([jeffmccune](https://github.com/jeffmccune))
|
11
|
+
- Turn into a gem [\#7](https://github.com/ghoneycutt/rizzo/pull/7) ([ghoneycutt](https://github.com/ghoneycutt))
|
12
|
+
- Change formatting in README [\#6](https://github.com/ghoneycutt/rizzo/pull/6) ([ghoneycutt](https://github.com/ghoneycutt))
|
13
|
+
- Allow multiple nodes to be a puppetmaster [\#3](https://github.com/ghoneycutt/rizzo/pull/3) ([ghoneycutt](https://github.com/ghoneycutt))
|
14
|
+
- Add CI testing with Travis-CI [\#2](https://github.com/ghoneycutt/rizzo/pull/2) ([ghoneycutt](https://github.com/ghoneycutt))
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/Gemfile
CHANGED
data/Guardfile
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
2
|
+
# rspec may be run, below are examples of the most common uses.
|
3
|
+
# * bundler: 'bundle exec rspec'
|
4
|
+
# * bundler binstubs: 'bin/rspec'
|
5
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
6
|
+
# installed the spring binstubs per the docs)
|
7
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
8
|
+
# * 'just' rspec: 'rspec'
|
9
|
+
rspec_results = File.expand_path('.rspec_status')
|
10
|
+
guard 'yard', server: false do
|
11
|
+
watch(%r{app\/.+\.rb})
|
12
|
+
watch(%r{lib\/.+\.rb})
|
13
|
+
watch(%r{ext\/.+\.c})
|
14
|
+
end
|
15
|
+
|
16
|
+
guard :rubocop do
|
17
|
+
watch(/.+\.rb$/)
|
18
|
+
watch('Gemfile')
|
19
|
+
watch('Guardfile')
|
20
|
+
watch('Vagrantfile')
|
21
|
+
watch('rzo.gemspec')
|
22
|
+
watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
|
23
|
+
end
|
24
|
+
|
25
|
+
guard :rspec, cmd: 'bundle exec rspec', results_file: rspec_results do
|
26
|
+
require 'guard/rspec/dsl'
|
27
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
28
|
+
|
29
|
+
# Feel free to open issues for suggestions and improvements
|
30
|
+
|
31
|
+
# RSpec files
|
32
|
+
rspec = dsl.rspec
|
33
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
34
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
35
|
+
watch(rspec.spec_files)
|
36
|
+
|
37
|
+
# Ruby files
|
38
|
+
ruby = dsl.ruby
|
39
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
40
|
+
end
|
41
|
+
# vim:ft=ruby
|
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright (C) 2016-2017 Garrett Honeycutt <code@garretthoneycutt.com>
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
CHANGED
@@ -1,39 +1,327 @@
|
|
1
|
-
#
|
1
|
+
# Rizzo
|
2
2
|
|
3
|
-
|
3
|
+
Rizzo is a heavily customized Vagrant configuration and work flow with a
|
4
|
+
role based focus. It is meant to make working with Vagrant easier and
|
5
|
+
purpose built for layered Puppet control repositories.
|
4
6
|
|
5
|
-
|
7
|
+
There should be at least one node for every role that is managed by a
|
8
|
+
control repo. This information is stored in `.rizzo.json` under the
|
9
|
+
control repo. This makes it apparent what roles are available and aids
|
10
|
+
in functional testing.
|
6
11
|
|
7
|
-
|
12
|
+
Each control repo must have a directory under it named `modules`. It is
|
13
|
+
up to you to populate this, so it works with the common tools such as
|
14
|
+
librarian-puppet-simple, librarian-puppet and r10k, without being
|
15
|
+
dependent on them.
|
8
16
|
|
9
|
-
|
17
|
+
Rizzo is named after Rizzo the Rat.
|
10
18
|
|
11
|
-
|
12
|
-
|
19
|
+
# Installation
|
20
|
+
|
21
|
+
Add the rizzo gem to your control repository `Gemfile`. For example, in
|
22
|
+
`puppetdata`:
|
23
|
+
|
24
|
+
```diff
|
25
|
+
diff --git a/Gemfile b/Gemfile
|
26
|
+
index 572f681..5c2f3b0 100644
|
27
|
+
--- a/Gemfile
|
28
|
+
+++ b/Gemfile
|
29
|
+
@@ -20,6 +20,7 @@ gem 'puppet-lint-undef_in_function-check'
|
30
|
+
gem 'puppet-lint-unquoted_string-check'
|
31
|
+
gem 'puppet-lint-variable_contains_upcase'
|
32
|
+
gem 'puppet-syntax'
|
33
|
+
+gem 'rzo'
|
34
|
+
|
35
|
+
gem 'serverspec', :require => false
|
36
|
+
gem 'vagrant-wrapper', :require => false
|
37
|
+
```
|
38
|
+
|
39
|
+
Then update the bundle with:
|
40
|
+
|
41
|
+
```shell
|
42
|
+
bundle install --path .bundle/gems/
|
43
|
+
bundle update rzo
|
44
|
+
```
|
45
|
+
|
46
|
+
Interact with rizzo using:
|
47
|
+
|
48
|
+
```shell
|
49
|
+
bundle exec rizzo --help
|
50
|
+
usage: rizzo [GLOBAL OPTIONS] SUBCOMMAND [ARGS]
|
51
|
+
Sub Commands:
|
52
|
+
|
53
|
+
config Print out the combined rizzo json config
|
54
|
+
generate Initialize Vagrantfile in top control repo
|
55
|
+
|
56
|
+
Global options: (Note, command line arguments supersede ENV vars in {}'s)
|
57
|
+
-l, --logto=<s> Log file to write to or keywords STDOUT, STDERR {RZO_LOGTO} (default: STDERR)
|
58
|
+
-s, --syslog Log to syslog
|
59
|
+
-v, --verbose Set log level to INFO
|
60
|
+
-d, --debug Set log level to DEBUG
|
61
|
+
-c, --config=<s> Rizzo config file {RZO_CONFIG} (default: ~/.rizzo.json)
|
62
|
+
-e, --version Print version and exit
|
63
|
+
-h, --help Show this message
|
13
64
|
```
|
14
65
|
|
15
|
-
|
66
|
+
Once rizzo is installed, setup your configuration file, `~/.rizzo.json`, then
|
67
|
+
use `bundle exec rizzo generate` to write the `Vagrantfile` in your control
|
68
|
+
repo.
|
69
|
+
|
70
|
+
# Dependencies
|
71
|
+
|
72
|
+
1. **vagrant-vbguest gem** See
|
73
|
+
[https://github.com/dotless-de/vagrant-vbguest](https://github.com/dotless-de/vagrant-vbguest)
|
74
|
+
|
75
|
+
`vagrant plugin install vagrant-vbguest`
|
76
|
+
|
77
|
+
1. **vagrant-proxyconf gem** This is optional. When used, if you have proxy
|
78
|
+
settings set in your environment, they will be transferred to the
|
79
|
+
guest. See
|
80
|
+
[http://tmatilai.github.io/vagrant-proxyconf/](http://tmatilai.github.io/vagrant-proxyconf/)
|
81
|
+
|
82
|
+
`vagrant plugin install vagrant-proxyconf`
|
83
|
+
|
84
|
+
# Setup
|
85
|
+
|
86
|
+
## `~/.rizzo.json`
|
87
|
+
|
88
|
+
Change the paths to your git repos
|
89
|
+
|
90
|
+
```json
|
91
|
+
{
|
92
|
+
"defaults": {
|
93
|
+
"bootstrap_repo_path": "/Users/gh/git/bootstrap"
|
94
|
+
},
|
95
|
+
"control_repos": [
|
96
|
+
"/Users/gh/git/puppetdata",
|
97
|
+
"/Users/gh/git/puppet-modules"
|
98
|
+
],
|
99
|
+
"puppetmaster": {
|
100
|
+
"name": "infra-puppetca",
|
101
|
+
"modulepath": [
|
102
|
+
"./modules",
|
103
|
+
"./puppetdata/modules",
|
104
|
+
"./ghoneycutt/modules"
|
105
|
+
],
|
106
|
+
"synced_folders": {
|
107
|
+
"/repos/puppetdata": {
|
108
|
+
"local": "/Users/gh/git/puppetdata",
|
109
|
+
"owner": "root",
|
110
|
+
"group": "root"
|
111
|
+
},
|
112
|
+
"/repos/ghoneycutt": {
|
113
|
+
"local": "/Users/gh/git/puppet-modules",
|
114
|
+
"owner": "root",
|
115
|
+
"group": "root"
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}
|
120
|
+
```
|
121
|
+
|
122
|
+
Once you have `~/.rizzo.json`, change to your top level control repository and generate your `Vagrantfile`.
|
123
|
+
|
124
|
+
```shell
|
125
|
+
bundle exec rizzo generate
|
126
|
+
```
|
127
|
+
```
|
128
|
+
Wrote vagrant config to Vagrantfile
|
129
|
+
```
|
130
|
+
|
131
|
+
Once the `Vagrantfile` has been generated, interact with the roles using `vagrant status`.
|
132
|
+
|
133
|
+
```shell
|
134
|
+
vagrant status
|
135
|
+
```
|
136
|
+
```
|
137
|
+
Current machine states:
|
138
|
+
|
139
|
+
infra-puppetfourca not created (virtualbox)
|
140
|
+
infra-puppetfour not created (virtualbox)
|
141
|
+
infra-test not created (virtualbox)
|
142
|
+
|
143
|
+
This environment represents multiple VMs. The VMs are all listed
|
144
|
+
above with their current state. For more information about a specific
|
145
|
+
VM, run `vagrant status NAME`.
|
146
|
+
```
|
147
|
+
|
148
|
+
## Configuration Specification
|
149
|
+
|
150
|
+
### defaults
|
151
|
+
|
152
|
+
The defaults hash is merged with each node entries hash. Put user
|
153
|
+
specific entries in `~/.rizzo.json` and project specific entries in
|
154
|
+
`${PATH_TO_CONTROL_REPO}/.rizzo.json`.
|
155
|
+
|
156
|
+
### control_repos
|
157
|
+
|
158
|
+
The control_repos array is a list of control repos. Rizzo takes the
|
159
|
+
approach that control repos are layered. The ordering should match your
|
160
|
+
`puppetmaster['modulepath']` array. The first control repo with a
|
161
|
+
`.rizzo.json` in it will have that Rizzo config used.
|
162
|
+
|
163
|
+
### puppetmaster
|
164
|
+
|
165
|
+
This hash is for your puppet master and is specific to that purpose.
|
166
|
+
|
167
|
+
#### name
|
168
|
+
|
169
|
+
If the name of the node matches puppetmaster['name'] then that node will
|
170
|
+
be treated as a puppetmaster. This will add the synced folders which map
|
171
|
+
to your control repos. This allows you to edit code locally using your
|
172
|
+
favorite editor and have it immediately available within the
|
173
|
+
puppetmaster.
|
174
|
+
|
175
|
+
#### modulepath
|
176
|
+
|
177
|
+
An array to describe the modulepath that is used in the puppetmaster's
|
178
|
+
environment.conf. This file is available in the `bootstrap_guest_path`
|
179
|
+
for use with your bootstrap script.
|
180
|
+
|
181
|
+
#### synced_folders
|
182
|
+
|
183
|
+
Hash of hashes for directories that are made available to the guest. The
|
184
|
+
key for the hash is the directory under the guest and its keys are
|
185
|
+
local, which is the path on the host and owner and group which are the
|
186
|
+
owner and group permissions the directory will be mounted with on the
|
187
|
+
guest.
|
188
|
+
|
189
|
+
## `controlrepo/.rizzo.json`
|
190
|
+
|
191
|
+
```json
|
192
|
+
{
|
193
|
+
"defaults": {
|
194
|
+
"bootstrap_script_path": "bootstrap_puppet4.sh",
|
195
|
+
"bootstrap_script_args": "-l -f `hostname -f`",
|
196
|
+
"bootstrap_guest_path": "/tmp/bootstrap",
|
197
|
+
"box": "centos7.box",
|
198
|
+
"box_url": "https://vagrantboxes/centos7.box",
|
199
|
+
"box_download_checksum": "3764a2c4ae3829aa4b50971e216c3a03736aafb2",
|
200
|
+
"box_download_checksum_type": "sha1",
|
201
|
+
"memory": "1024",
|
202
|
+
"netmask": "255.255.255.0",
|
203
|
+
"update_packages": true,
|
204
|
+
"update_packages_command": "yum -y update",
|
205
|
+
"shutdown": true,
|
206
|
+
"shutdown_command": "/sbin/shutdown -h now"
|
207
|
+
},
|
208
|
+
"nodes": [
|
209
|
+
{
|
210
|
+
"name": "infra-puppetca",
|
211
|
+
"hostname": "infra-puppetca1.example.org",
|
212
|
+
"forwarded_ports": [
|
213
|
+
{
|
214
|
+
"guest": "8140",
|
215
|
+
"host": "8140"
|
216
|
+
}
|
217
|
+
],
|
218
|
+
"ip": "172.16.100.5",
|
219
|
+
"memory": "2048"
|
220
|
+
},
|
221
|
+
{
|
222
|
+
"name": "infra-puppet",
|
223
|
+
"hostname": "infra-puppet1.example.org",
|
224
|
+
"ip": "172.16.100.6",
|
225
|
+
"memory": "2048"
|
226
|
+
},
|
227
|
+
{
|
228
|
+
"name": "www-api",
|
229
|
+
"hostname": "www-api1.example.org",
|
230
|
+
"ip": "172.16.100.7"
|
231
|
+
}
|
232
|
+
]
|
233
|
+
}
|
234
|
+
```
|
235
|
+
|
236
|
+
### defaults
|
237
|
+
|
238
|
+
This hash is merged with each node entry.
|
239
|
+
|
240
|
+
### nodes
|
241
|
+
|
242
|
+
A list of node entries.
|
243
|
+
|
244
|
+
#### name
|
245
|
+
|
246
|
+
Name of the node entry. This is what it will be referred to by Vagrant.
|
247
|
+
|
248
|
+
#### hostname
|
249
|
+
|
250
|
+
The FQDN (fully qualified domain name).
|
251
|
+
|
252
|
+
#### forwarded_ports
|
253
|
+
|
254
|
+
An optional array of hashes with the key guest and value is the port on
|
255
|
+
the guest and the key host and the value is the port on the host. Rizzo
|
256
|
+
will check and fail if you use duplicate host ports, as they must be
|
257
|
+
unique.
|
258
|
+
|
259
|
+
#### ip
|
260
|
+
|
261
|
+
IP address.
|
262
|
+
|
263
|
+
#### netmask
|
264
|
+
|
265
|
+
Netmask.
|
266
|
+
|
267
|
+
#### memory
|
268
|
+
|
269
|
+
Amount of memory. This should be specified in MB without any unit
|
270
|
+
signifier.
|
271
|
+
|
272
|
+
#### bootstrap_repo_path
|
273
|
+
|
274
|
+
The path on the host to your bootstrap repo.
|
275
|
+
|
276
|
+
#### bootstrap_guest_path
|
277
|
+
|
278
|
+
The path on the guest where the `bootstrap_repo_path` will be mounted.
|
279
|
+
|
280
|
+
#### bootstrap_script_path
|
281
|
+
|
282
|
+
Path of script to be used to bootstrap a system. This is relative to
|
283
|
+
`bootstrap_guest_path`.
|
284
|
+
|
285
|
+
#### bootstrap_script_args
|
286
|
+
|
287
|
+
Any arguments to pass to `bootstrap_script_path`.
|
288
|
+
|
289
|
+
#### box
|
290
|
+
|
291
|
+
Name of the Vagrant box.
|
292
|
+
|
293
|
+
#### box_url
|
294
|
+
|
295
|
+
URL to the Vagrant box.
|
16
296
|
|
17
|
-
|
297
|
+
#### box_download_checksum
|
18
298
|
|
19
|
-
|
299
|
+
Checksum of the Vagrant box.
|
20
300
|
|
21
|
-
|
301
|
+
#### box_download_checksum_type
|
22
302
|
|
23
|
-
|
303
|
+
Type of checksum used in `box_download_checksum`.
|
24
304
|
|
25
|
-
|
305
|
+
#### update_packages
|
26
306
|
|
27
|
-
|
307
|
+
Boolean to determine if packages should be updated.
|
28
308
|
|
29
|
-
|
309
|
+
#### update_packages_command
|
30
310
|
|
31
|
-
|
311
|
+
Command to update the packages.
|
32
312
|
|
33
|
-
|
313
|
+
#### shutdown
|
34
314
|
|
35
|
-
|
315
|
+
Boolean to determine if the system should be shutdown after being
|
316
|
+
provisioned. This is useful because Rizzo uses
|
317
|
+
[vagrant-vbguest](https://github.com/dotless-de/vagrant-vbguest) which
|
318
|
+
will check the version of the VirtualBox Guest Additions you have with
|
319
|
+
that of the guest VM. If they differ, it will recompile on the guest. If
|
320
|
+
the system is not shutdown and just rebooted, then on the next boot the
|
321
|
+
guest additions will not work. Instead the system must be brought up
|
322
|
+
with `vagrant up node_name` which will activate the vbguest plugin and
|
323
|
+
ensure the guest additions are working.
|
36
324
|
|
37
|
-
|
325
|
+
#### shutdown_command
|
38
326
|
|
39
|
-
|
327
|
+
The command used to shutdown the system.
|
data/Rakefile
CHANGED
@@ -1,6 +1,31 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'json'
|
2
|
+
require 'rubocop/rake_task'
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
3
5
|
|
6
|
+
RuboCop::RakeTask.new
|
4
7
|
RSpec::Core::RakeTask.new(:spec)
|
5
8
|
|
6
|
-
|
9
|
+
desc 'Validation tests'
|
10
|
+
task :validate do
|
11
|
+
puts '=== Validating JSON (*.json) files'
|
12
|
+
filelist = FileList.new('**/*.json')
|
13
|
+
filelist.exclude('.bundle/**')
|
14
|
+
filelist.each do |json_file|
|
15
|
+
puts json_file
|
16
|
+
json = File.read(json_file)
|
17
|
+
JSON.parse(json)
|
18
|
+
end
|
19
|
+
|
20
|
+
puts "\n=== Validating ruby (*.rb, Vagrantfile, Rakefile and Gemfile) files"
|
21
|
+
Dir['**/*.rb', 'Vagrantfile', 'Rakefile', 'Gemfile'].each do |ruby|
|
22
|
+
sh "ruby -c #{ruby}"
|
23
|
+
end
|
24
|
+
|
25
|
+
puts "\n=== Validating ERB (*.erb) files"
|
26
|
+
Dir['**/*.erb'].each do |erb|
|
27
|
+
sh "erb -P -x -T '-' #{erb} | ruby -c"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
task :default => %i[validate spec]
|
data/bin/console
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'rzo'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
# Pry.start
|
9
|
+
require 'pry'
|
10
|
+
Pry.start
|
12
11
|
|
13
|
-
require
|
12
|
+
require 'irb'
|
14
13
|
IRB.start(__FILE__)
|
data/exe/rizzo
ADDED
data/exe/rzo
ADDED
data/ext/_rizzo.json
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
{
|
2
|
+
"defaults": {
|
3
|
+
"bootstrap_repo_path": "/Users/jeff/projects/acme/bootstrap"
|
4
|
+
},
|
5
|
+
"control_repos": [
|
6
|
+
"/Users/jeff/projects/acme/puppetdata",
|
7
|
+
"/Users/jeff/projects/acme/ghoneycutt-modules"
|
8
|
+
],
|
9
|
+
"puppetmaster": {
|
10
|
+
"name": [
|
11
|
+
"infra-puppetfourca",
|
12
|
+
"infra-puppetfour"
|
13
|
+
],
|
14
|
+
"modulepath": [
|
15
|
+
"./modules",
|
16
|
+
"./puppetdata/modules",
|
17
|
+
"./ghoneycutt/modules"
|
18
|
+
],
|
19
|
+
"synced_folders": {
|
20
|
+
"/repos/puppetdata": {
|
21
|
+
"local": "/Users/jeff/projects/acme/puppetdata",
|
22
|
+
"owner": "root",
|
23
|
+
"group": "root"
|
24
|
+
},
|
25
|
+
"/repos/ghoneycutt": {
|
26
|
+
"local": "/Users/jeff/projects/acme/ghoneycutt-modules",
|
27
|
+
"owner": "root",
|
28
|
+
"group": "root"
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rzo/app/subcommand'
|
2
|
+
module Rzo
|
3
|
+
class App
|
4
|
+
##
|
5
|
+
# Load all rizzo config files and print the config
|
6
|
+
class Config < Subcommand
|
7
|
+
attr_reader :config
|
8
|
+
def run
|
9
|
+
exit_status = 0
|
10
|
+
load_config!
|
11
|
+
write_file(opts[:output]) { |fd| fd.puts(JSON.pretty_generate(config)) }
|
12
|
+
exit_status
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|