puppet-magnum 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +19 -181
- data/VERSION +1 -1
- data/generator_files/vagrant/Vagrantfile.erb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8775f7bed93f95a69341ab20142fd8a74d281845
|
4
|
+
data.tar.gz: 9f330f4b1f4935af457c0f4eac556ac42d218d5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1049a73e202b45b1fefa45ca7b7d5b52fa10bebf64cac8f91a98ac6c3112d5aafb77deb2e69d3fc81ca984a5f4ecbc531419cf513738c8b1f84c4a41b8ea7e4f
|
7
|
+
data.tar.gz: 013994ebb015cf8399381220635de424d8af26319fb77abe79a8b474738a0b074a21a32e03fb892eedf298bf820f22214ab6598edfdb02c42ff6a633d8587a0b
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -2,24 +2,19 @@
|
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/tehmaspc/puppet-magnum.svg?branch=master)](https://travis-ci.org/tehmaspc/puppet-magnum)
|
4
4
|
|
5
|
-
puppet-magnum
|
5
|
+
`puppet-magnum` is a tool for rapid, consistent, and best practice Puppet module development.
|
6
6
|
|
7
|
-
puppet-magnum
|
8
|
-
around tools such as: [puppetlabs_spec_helper](http://github.com/puppetlabs/puppetlabs_spec_helper), [rspec-puppet](http://rspec-puppet.com/), [puppet-lint](http://puppet-lint.com/), [vagrant-serverspec](https://github.com/jvoorhis/vagrant-serverspec), [vagrant](http://vagrantup.com), and more!
|
7
|
+
`puppet-magnum` helps the Puppet module developer create or maintain a Puppet module and test the module with tools like the following:
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
Currently, using Ruby 2.3.0 latest and above should work fine with puppet-magnum.
|
16
|
-
Additionally, ensure that [bundler](http://bundler.io/) (a Ruby gem manager) is installed and available in your gem path.
|
9
|
+
* [puppet-lint](http://puppet-lint.com)
|
10
|
+
* [rspec-puppet](http://rspec-puppet.com)
|
11
|
+
* [puppetlabs_spec_helper](http://github.com/puppetlabs/puppetlabs_spec_helper)
|
12
|
+
* [serverspec](http://serverspec.org) (via [vagrant-serverspec](https://github.com/jvoorhis/vagrant-serverspec))
|
17
13
|
|
18
14
|
## Installation
|
19
15
|
|
20
|
-
|
21
|
-
|
22
|
-
% bundle install && rake install
|
16
|
+
* install ruby 2.3.0+
|
17
|
+
* `% gem install puppet-magnum`
|
23
18
|
|
24
19
|
## Usage
|
25
20
|
|
@@ -29,7 +24,7 @@ Install puppet-magnum for yourself by doing the following inside a copy of this
|
|
29
24
|
puppet-magnum module # Module related tasks. Type 'puppet-magnum module' for more help.
|
30
25
|
puppet-magnum version # Display version and copyright information
|
31
26
|
|
32
|
-
## Example Creating An
|
27
|
+
## Example: Creating An `nginx` Puppet Module
|
33
28
|
|
34
29
|
The following shows how one can get started quickly creating an 'nginx' Puppet module:
|
35
30
|
|
@@ -39,56 +34,20 @@ The following shows how one can get started quickly creating an 'nginx' Puppet m
|
|
39
34
|
create nginx/files
|
40
35
|
create nginx/spec
|
41
36
|
create nginx/serverspec
|
42
|
-
|
43
|
-
create nginx/README.md
|
44
|
-
create nginx/LICENSE
|
45
|
-
create nginx/metadata.json
|
46
|
-
create nginx/manifests/init.pp
|
47
|
-
create nginx/spec/classes
|
48
|
-
create nginx/spec/defines
|
49
|
-
create nginx/spec/functions
|
50
|
-
create nginx/spec/hosts
|
51
|
-
create nginx/spec/unit
|
52
|
-
create nginx/spec/fixtures/manifests
|
53
|
-
create nginx/spec/fixtures/manifests/site.pp
|
54
|
-
create nginx/spec/fixtures/modules/nginx
|
55
|
-
remove nginx/spec/fixtures/modules/nginx/manifests
|
56
|
-
create nginx/spec/fixtures/modules/nginx/manifests
|
57
|
-
remove nginx/spec/fixtures/modules/nginx/templates
|
58
|
-
create nginx/spec/fixtures/modules/nginx/templates
|
59
|
-
remove nginx/spec/fixtures/modules/nginx/files
|
60
|
-
create nginx/spec/fixtures/modules/nginx/files
|
61
|
-
create nginx/spec/spec_helper.rb
|
62
|
-
create nginx/spec/classes/nginx_spec.rb
|
63
|
-
create nginx/.rspec
|
64
|
-
create nginx/serverspec/nginx_spec.rb
|
65
|
-
create nginx/.fixtures.yml
|
66
|
-
remove nginx/Gemfile
|
67
|
-
create nginx/Gemfile
|
68
|
-
remove nginx/Rakefile
|
69
|
-
create nginx/Rakefile
|
37
|
+
...
|
70
38
|
create nginx/Vagrantfile
|
71
39
|
create nginx/.vagrant_puppet/init.sh
|
72
40
|
create nginx/.vagrant_puppet/environments/vagrant/environment.conf
|
73
41
|
create nginx/.vagrant_puppet/environments/vagrant/manifests/init.pp
|
74
|
-
remove nginx/.magnum.init
|
75
|
-
create nginx/.magnum.init
|
42
|
+
remove nginx/.puppet-magnum.init
|
43
|
+
create nginx/.puppet-magnum.init
|
76
44
|
remove nginx/.gitignore
|
77
45
|
create nginx/.gitignore
|
78
46
|
run git init from "./nginx"
|
79
47
|
run git add -A from "./nginx"
|
80
48
|
|
81
|
-
##
|
82
|
-
|
83
|
-
puppet-magnum can take several parameters which will be used for populating the templates of things like manifest documentation, licensing and maintainer information.
|
84
|
-
|
85
|
-
- maintainer: maintainer name of module.
|
86
|
-
- maintainer_email: maintainer email of module.
|
87
|
-
- copyright_year: defaults to current year.
|
88
|
-
- copyright_holder: defaults to maintainer if not declared.
|
89
|
-
|
90
|
-
### .magnumrc file
|
91
|
-
The values above can be set via a file in your home directory called *_.magnumrc_*
|
49
|
+
## `.magnumrc` File
|
50
|
+
The following values can be set via a file in your *home* directory called `.magnumrc`
|
92
51
|
|
93
52
|
```
|
94
53
|
---
|
@@ -97,142 +56,21 @@ The values above can be set via a file in your home directory called *_.magnumrc
|
|
97
56
|
copyright_holder: Example.com LLC
|
98
57
|
```
|
99
58
|
|
100
|
-
##
|
101
|
-
|
102
|
-
puppet-magnum provides the following Puppet testing tools to allow the Puppet module developer a means to test their Puppet code. The tools provided are [puppet-lint](http://puppet-lint.com/), [rspec-puppet](http://rspec-puppet.com/), [serverspec](http://serverspec.org/), and [vagrant](http://vagrantup.com).
|
103
|
-
|
104
|
-
The following will describe what each tool provided does and how it can be used within a puppet-magnum managed Puppet module.
|
105
|
-
|
106
|
-
### puppet-lint
|
107
|
-
|
108
|
-
[puppet-lint](http://puppet-lint.com/) allows the Puppet module developer to statically check that the content of their Puppet code conforms to the Puppet style standard. It checks for trailing whitespace, indentation and tabs, and many other Puppet style guidelines as listed [here](http://puppet-lint.com/checks/). With puppet-lint checking for unconformity, it's a lot easier for a team of Puppet developers to adhere to a general style guideline.
|
109
|
-
|
110
|
-
puppet-magnum sets up the puppet-lint tool in the Puppet module directory and provides the Rake task 'lint' to run puppet-lint against your code, as shown:
|
111
|
-
|
112
|
-
% rake lint
|
113
|
-
manifests/client.pp - WARNING: class not documented on line 1
|
114
|
-
manifests/crowsnest.pp - WARNING: class not documented on line 1
|
115
|
-
manifests/params.pp - WARNING: top-scope variable being used without an explicit namespace on line 3
|
116
|
-
manifests/params.pp - WARNING: class not documented on line 1
|
117
|
-
manifests/params.pp - ERROR: trailing whitespace found on line 21
|
118
|
-
...
|
119
|
-
|
120
|
-
The developer should check for puppet-lint warnings and errors and fix their code to conform to the style guidelines. Errors should definitely be fixed as they will cause further tests to fail.
|
121
|
-
|
122
|
-
If the developer runs the 'lint' task and there is no output - then all the puppet-lint checks passed successfully.
|
123
|
-
|
124
|
-
For more details about puppet-lint, please check the [project website](http://puppet-lint.com/).
|
125
|
-
|
126
|
-
### rspec-puppet
|
127
|
-
|
128
|
-
[rspec-puppet](http://rspec-puppet.com/) allows the Puppet module developer to write [RSpec](https://relishapp.com/rspec) unit tests for their Puppet code.
|
129
|
-
|
130
|
-
Each puppet-magnum managed Puppet module directory will have a subdirectory called 'spec' with a directory tree as follows:
|
131
|
-
|
132
|
-
spec
|
133
|
-
├── spec/classes
|
134
|
-
│ └── spec/classes/ntp_spec.rb
|
135
|
-
├── spec/defines
|
136
|
-
├── spec/fixtures
|
137
|
-
│ ├── spec/fixtures/manifests
|
138
|
-
│ │ └── spec/fixtures/manifests/site.pp
|
139
|
-
│ └── spec/fixtures/modules
|
140
|
-
│ └── spec/fixtures/modules/ntp
|
141
|
-
│ ├── spec/fixtures/modules/ntp/files -> ../../../../files
|
142
|
-
│ ├── spec/fixtures/modules/ntp/lib
|
143
|
-
│ │ └── spec/fixtures/modules/ntp/lib/puppet
|
144
|
-
│ │ └── spec/fixtures/modules/ntp/lib/puppet/parser
|
145
|
-
│ │ └── spec/fixtures/modules/ntp/lib/puppet/parser/functions
|
146
|
-
│ │ └── spec/fixtures/modules/ntp/lib/puppet/parser/functions/zabbix_registration.rb
|
147
|
-
│ ├── spec/fixtures/modules/ntp/manifests -> ../../../../manifests
|
148
|
-
│ └── spec/fixtures/modules/ntp/templates -> ../../../../templates
|
149
|
-
├── spec/functions
|
150
|
-
├── spec/hosts
|
151
|
-
├── spec/spec_helper.rb
|
152
|
-
└── spec/unit
|
153
|
-
|
154
|
-
All rspec-puppet tests for Puppet classes should be written in the 'spec/classes/MODULE_spec.rb' file.
|
155
|
-
|
156
|
-
All rspec-puppet tests for Puppet define types should be written in the 'spec/defines/MODULE_spec.rb' file.
|
157
|
-
|
158
|
-
As you can see above there are numerous files underneath the 'spec' subdirectory. A lot of these files - especially the files under 'spec/fixtures' - exist to glue together our RSpec testing tools. The 'spec/fixtures' directory is unique in that all module dependencies, including the module being developed, should be found under the 'spec/fixtures' directory. rspec-puppet, serverspec, and vagrant will all make use of this special 'spec/fixtures' directory.
|
159
|
-
|
160
|
-
In order to add additional module dependencies into your Puppet module, puppet-magnum provides a .fixtures.yml file which can be modified to add additional Puppet modules to your project. The default .fixtures.yml file will look like the following:
|
59
|
+
## Documentation
|
161
60
|
|
162
|
-
|
163
|
-
# repositories:
|
164
|
-
# stdlib: 'git://github.com/puppetlabs/puppetlabs-stdlib'
|
165
|
-
symlinks:
|
166
|
-
ntp/files: '../../../../files'
|
167
|
-
ntp/manifests: '../../../../manifests'
|
168
|
-
ntp/templates: '../../../../templates'
|
169
|
-
|
170
|
-
As you can see, additional modules - like 'stdlib' - can be added to your Puppet module project directory.
|
171
|
-
|
172
|
-
#### Running rspec-puppet tests
|
173
|
-
|
174
|
-
% rake unit
|
175
|
-
HEAD is now at 44c181e Merge branch 'fix/master/add_recursive_merge'
|
176
|
-
/usr/local/opt/rbenv/shims/ruby -S rspec spec/classes/config_spec.rb spec/classes/install_spec.rb spec/classes/ntp_spec.rb spec/classes/service_spec.rb --color
|
177
|
-
........
|
178
|
-
|
179
|
-
Finished in 0.53874 seconds
|
180
|
-
8 examples, 0 failures
|
181
|
-
|
182
|
-
For more details about rspec-puppet and how to write the actual rspec-puppet tests, please check the [project website](http://rspec-puppet.com/).
|
183
|
-
|
184
|
-
### serverspec
|
185
|
-
|
186
|
-
[serverspec](http://serverspec.org/) allows the Puppet module developer to write [RSpec](https://relishapp.com/rspec) integration tests for their Puppet code. serverspec integration tests work in conjunction with [vagrant](http://www.vagrantup.com/) and allow a Puppet developer the ability to quickly provision a vagrant virtual box Linux system and then run these tests against this live system.
|
187
|
-
|
188
|
-
Each puppet-magnum managed Puppet module directory will have a subdirectory called 'serverspec' with a directory tree as follows:
|
189
|
-
|
190
|
-
serverspec
|
191
|
-
├── serverspec/spec
|
192
|
-
│ └── serverspec/spec/MODULE_spec.rb
|
193
|
-
└── serverspec/spec_helper.rb
|
194
|
-
|
195
|
-
All serverspec tests should be written in the 'serverspec/spec/MODULE_spec.rb' file.
|
196
|
-
|
197
|
-
#### Running serverspec tests
|
198
|
-
|
199
|
-
% rake integ
|
200
|
-
HEAD is now at 44c181e Merge branch 'fix/master/add_recursive_merge'
|
201
|
-
|
202
|
-
Running integration tests on Vagrant image; this will take a few moments...
|
203
|
-
|
204
|
-
/usr/local/opt/rbenv/shims/ruby -S rspec serverspec/spec/ntp_spec.rb --color
|
205
|
-
................
|
206
|
-
|
207
|
-
Finished in 48.7 seconds
|
208
|
-
16 examples, 0 failures
|
209
|
-
|
210
|
-
For more details about serverspec and how to write the actual serverspec tests, please check the [project website](http://serverspec.org/).
|
211
|
-
|
212
|
-
### vagrant
|
213
|
-
|
214
|
-
[vagrant](http://vagrantup.com) allows the Puppet developer to start local VirtualBox instances in their Puppet module project and provision the instance with the Puppet module being tested. vagrant requires a Vagrantfile which specifies how to launch a VirtualBox instance. puppet-magnum sets up the required Vagrantfile with the proper configurations required to start the VirtualBox VM (w/ 'vagrant up') and provision the instance with the module being tested.
|
215
|
-
|
216
|
-
puppet-magnum also creates a .vagrant_puppet/ directory in your Puppet module project and more importantly a .vagrant_puppet/init.pp file containing the necessary configuration for Puppet provisioning your VirtualBox instance. The Puppet module developer should change the .vagrant_puppet/init.pp file to provision their VirtualBox instance according to their needs. The best way to understand this is to take a look at some of the Puppet module examples below.
|
217
|
-
|
218
|
-
During the development of a Puppet module, the Puppet module developer can run 'vagrant provision' to continuously test their Puppet module changes. The developer can login to the VirtualBox instance (w/ 'vagrant ssh') and check the state of their Puppet provisioning.
|
219
|
-
|
220
|
-
NOTE: vagrant does NOT implicitly re-provision your VirtualBox instance each time. Only on a new VirtualBox instance creation will VirtualBox automatically run a 'provision' for you. The Puppet module developer should run 'vagrant provision' each time they need to check their latest Puppet code changes.
|
221
|
-
|
222
|
-
For more details about vagrant, please check the [project website](http://www.vagrantup.com/).
|
61
|
+
* [puppet-magnum Wiki](https://github.com/tehmaspc/puppet-magnum/wiki)
|
223
62
|
|
224
63
|
## Credits
|
225
64
|
|
226
|
-
|
65
|
+
Thanks to the following projects and folks!:
|
227
66
|
|
228
67
|
* [Thor](http://whatisthor.com/)
|
229
68
|
* [Berkshelf](http://berkshelf.com/)
|
69
|
+
* [Contributors](https://github.com/tehmaspc/puppet-magnum/graphs/contributors), including [@sepulworld](https://github.com/sepulworld)
|
230
70
|
|
231
71
|
## Authors and License
|
232
72
|
|
233
|
-
|
234
|
-
|
235
|
-
Copyright 2013-2016 Tehmasp Chaudhri
|
73
|
+
Copyright 2013-2016 Tehmasp Chaudhri <tehmasp@gmail.com>
|
236
74
|
|
237
75
|
Licensed under the Apache License, Version 2.0 (the "License");
|
238
76
|
you may not use this file except in compliance with the License.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0.
|
1
|
+
3.0.1
|
@@ -29,5 +29,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|
29
29
|
end
|
30
30
|
|
31
31
|
unless Vagrant.has_plugin?('vagrant-serverspec')
|
32
|
-
raise 'vagrant-serverspec is
|
32
|
+
raise "'vagrant-serverspec' is NOT installed!"
|
33
|
+
raise "To install, run: 'vagrant plugin install vagrant-serverspec'"
|
33
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-magnum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tehmasp Chaudhri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sem_ver
|