falkorlib 0.4.8 → 0.4.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 24f2e16454b28d1ca83d3df97e64a245b1b0c01e
4
- data.tar.gz: 2a4c42fc9214770ad2cf683adc8251f2ff8e4cbd
3
+ metadata.gz: 547ac0a671298d19987ffa23c3fac3d6172a94f9
4
+ data.tar.gz: 711e6f847ac8df89ccb2991978bcdb03852de130
5
5
  SHA512:
6
- metadata.gz: 0d4ddf35ca1812050bdfa24c526adf855d32fe27dd2132ea9db044004a1a5463fa2726df6c18580c5d23715b6e8ca2f8ae993f18bd2cdf67cb98ab1b720a0357
7
- data.tar.gz: dbe16737008ea26ac775fa79dc8100400dca0a659d4431808c60cce0b43705bb09e48b5d8ba9b82fb802431c2a133a70124f1c71772b2819734b509fd384593a
6
+ metadata.gz: 9bcc4f2c3d71e273642155008f898266606e32630b3a8d2c98eb15eba1b8c1f3f859ad18bfe6eae768bce777968f9034437e215c99d89e6a2c72daec16437f4d
7
+ data.tar.gz: c8043d01e52d548282c8266ad8adc8cf949bb60d11582f7283ec52b84e6cb8bd211355b5d1e5316c463ea09746fd68e4ac8c93154e91652df5e098485b220a34
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- falkorlib (0.4.8)
4
+ falkorlib (0.4.9)
5
5
  artii (>= 2.1)
6
6
  awesome_print (~> 1.2)
7
7
  configatron (~> 3.2)
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  ################################################################################
3
- # Time-stamp: <Fri 2015-05-08 11:21 svarrette>
3
+ # Time-stamp: <Fri 2015-05-08 16:19 svarrette>
4
4
  ################################################################################
5
5
  # Interface for the main Puppet Module operations
6
6
  #
@@ -126,8 +126,8 @@ module FalkorLib #:nodoc:
126
126
  # Supported platforms
127
127
  config[:platforms] = [ 'debian' ]
128
128
  config[:dependencies] = [{
129
- "name" => "puppetlabs-stdlib",
130
- "version_range" => ">= 1.0.0"
129
+ "name" => "puppetlabs-stdlib",
130
+ "version_requirement" => ">=4.2.2 <5.0.0"
131
131
  }]
132
132
  config[:params] = [ 'ensure', 'protocol', 'port', 'packagename' ]
133
133
  #ap config
@@ -164,11 +164,11 @@ module FalkorLib #:nodoc:
164
164
  if FalkorLib::Git.init?(moduledir)
165
165
  if FalkorLib::GitFlow.init?(moduledir)
166
166
  info "=> preparing git-flow feature for the newly created module '#{config[:name]}'"
167
- FalkorLib::GitFlow.start('feature', "bootstraping", moduledir)
167
+ FalkorLib::GitFlow.start('feature', "bootstrapping", moduledir)
168
168
  end
169
169
  [ 'metadata.json',
170
- 'doc/', 'LICENSE', '.gitignore',
171
- 'Gemfile', '.vagrant_init.rb', 'Rakefile', 'Vagrantfile' ].each do |f|
170
+ 'doc/', 'LICENSE', '.gitignore', '.ruby-version', '.ruby-gemset',
171
+ 'Gemfile', '.vagrant_init.rb', 'Rakefile', 'Vagrantfile' ].each do |f|
172
172
  FalkorLib::Git.add(File.join(moduledir, f))
173
173
  end
174
174
  end
@@ -301,6 +301,7 @@ module FalkorLib #:nodoc:
301
301
  ans = options[:no_interaction] ? 'Yes' : ask(cyan("==> procceed? (Y|n)"), 'Yes')
302
302
  next if ans =~ /n.*/i
303
303
  if update_from_erb.include?(f)
304
+ ap "=> updating #{f}.erb"
304
305
  i += write_from_erb_template(File.join(templatedir, "#{f}.erb"),
305
306
  File.join(moduledir, f),
306
307
  metadata,
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  ################################################################################
3
3
  # puppet_modules.rake - Special tasks for the management of Puppet modules
4
- # Time-stamp: <Thu 2015-05-07 18:51 svarrette>
4
+ # Time-stamp: <Fri 2015-05-08 15:33 svarrette>
5
5
  #
6
6
  # Copyright (c) 2014 Sebastien Varrette <Sebastien.Varrette@uni.lu>
7
7
  # http://varrette.gforge.uni.lu
@@ -130,10 +130,11 @@ namespace :templates do
130
130
 
131
131
  [ 'readme', 'rake', 'vagrant' ].each do |t|
132
132
  ########### templates:upgrade:{readme,rake,vagrant} ###########
133
+ desc "Upgrade (overwrite) #{t.capitalize} using the current FalkorLib template"
133
134
  task t.to_sym do
134
135
  list = case t
135
136
  when 'readme'
136
- [ 'README.md', 'doc/contributing.md' ]
137
+ [ 'README.md', 'doc/contributing.md', 'doc/vagrant.md' ]
137
138
  when 'rake'
138
139
  [ 'Gemfile', 'Rakefile' ]
139
140
  when 'vagrant'
@@ -169,7 +170,7 @@ exclude_tests_paths = ['pkg/**/*','spec/**/*']
169
170
  #
170
171
  require 'puppet-lint/tasks/puppet-lint'
171
172
 
172
- PuppetLint.configuration.send('disable_autoloader_layout')
173
+ #PuppetLint.configuration.send('disable_autoloader_layout')
173
174
  PuppetLint.configuration.send('disable_class_inherits_from_params_class')
174
175
  PuppetLint.configuration.send('disable_80chars')
175
176
  PuppetLint.configuration.ignore_paths = exclude_tests_paths
@@ -19,7 +19,7 @@ module FalkorLib #:nodoc:
19
19
  # MAJOR: Defines the major version
20
20
  # MINOR: Defines the minor version
21
21
  # PATCH: Defines the patch version
22
- MAJOR, MINOR, PATCH = 0, 4, 8
22
+ MAJOR, MINOR, PATCH = 0, 4, 9
23
23
 
24
24
  module_function
25
25
 
@@ -2,7 +2,7 @@
2
2
  #########################################
3
3
  # puppet_modules_spec.rb
4
4
  # @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
5
- # Time-stamp: <Fri 2015-05-08 11:23 svarrette>
5
+ # Time-stamp: <Fri 2015-05-08 16:21 svarrette>
6
6
  #
7
7
  # @description Check the Puppet Modules operations
8
8
  #
@@ -71,8 +71,8 @@ describe FalkorLib::Puppet::Modules do
71
71
  "toto::params",
72
72
  "toto",
73
73
  "toto::common",
74
- "toto::debian",
75
- "toto::redhat"
74
+ "toto::common::debian",
75
+ "toto::common::redhat"
76
76
  ]
77
77
  c.size.should == ref.size
78
78
  c.each { |e| ref.should include(e) }
@@ -110,10 +110,10 @@ describe FalkorLib::Puppet::Modules do
110
110
  'definitions',
111
111
  'toto',
112
112
  'toto::common',
113
- 'toto::debian',
113
+ 'toto::common::debian',
114
+ 'toto::common::redhat',
114
115
  'toto::mydef',
115
116
  'toto::params',
116
- 'toto::redhat',
117
117
  ]
118
118
  end
119
119
 
@@ -147,12 +147,12 @@ describe FalkorLib::Puppet::Modules do
147
147
  ]
148
148
  end
149
149
 
150
- upgraded_files_default = 1
150
+ upgraded_files_default = 2
151
151
  it "#upgrade" do
152
152
  d = FalkorLib::Puppet::Modules.upgrade(moduledir, {
153
153
  :no_interaction => true
154
154
  })
155
- d.should == upgraded_files_default
155
+ d.should == upgraded_files_default
156
156
  end
157
157
 
158
158
  it "#upgrade -- with only a subset of files" do
@@ -168,7 +168,8 @@ describe FalkorLib::Puppet::Modules do
168
168
  :no_interaction => true,
169
169
  :exclude => [ 'README.md']
170
170
  })
171
- d.should == (upgraded_files_default - 1)
171
+ d.should == 0
172
+ #d.should == (upgraded_files_default - 1)
172
173
  end
173
174
 
174
175
  it "#upgrade -- both include and exclude files" do
@@ -2,7 +2,7 @@
2
2
  #########################################
3
3
  # versioning_puppet_module_spec.rb
4
4
  # @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
5
- # Time-stamp: <Ven 2014-09-05 10:53 svarrette>
5
+ # Time-stamp: <Fri 2015-05-08 16:28 svarrette>
6
6
  #
7
7
  # @description Check the versioning operations on Gems
8
8
  #
@@ -51,14 +51,14 @@ describe FalkorLib::Versioning::Puppet do
51
51
  ###################################################################
52
52
  context 'Test Puppet Module versioning operations within temporary directory' do
53
53
 
54
-
54
+ ap default_version
55
55
  it "#get_version -- get default version #{default_version} after initialization" do
56
56
  Array.new(16).each { |e| STDIN.should_receive(:gets).and_return('') }
57
57
  FalkorLib::Puppet::Modules.init(moduledir)
58
58
  v = FalkorLib::Versioning.get_version(moduledir)
59
59
  v.should == default_version
60
60
  if command?('git-flow')
61
- a = FalkorLib::GitFlow.finish('feature', 'bootstraping', moduledir)
61
+ a = FalkorLib::GitFlow.finish('feature', 'bootstrapping', moduledir)
62
62
  a.should == 0
63
63
  end
64
64
  end
@@ -1,6 +1,5 @@
1
1
  .DS_Store
2
2
  .vagrant
3
3
  /.bundle/*
4
- .ruby-*
5
- .falkorlib.yaml
4
+ .falkor*
6
5
  /pkg/*
@@ -1,4 +1,4 @@
1
- -*- mode: markdown; mode: auto-fill; fill-column: 80 -*-
1
+ -*- mode: markdown; mode: visual-line; -*-
2
2
 
3
3
  # <%= config[:shortname].capitalize %> Puppet Module
4
4
 
@@ -16,16 +16,29 @@
16
16
 
17
17
  ## Synopsis
18
18
 
19
- <%= config[:description] %>
19
+ <%= config[:description] %>.
20
20
 
21
21
  This module implements the following elements:
22
22
 
23
- * __classes__: `<%= config[:shortname] %>`
24
- * __definitions__:
25
- * `<%= config[:shortname] %>::mydef`:
26
-
27
- The various operations of this repository are piloted from a `Rakefile` which
28
- assumes that you have [RVM](https://rvm.io/) installed on your system.
23
+ * __Puppet classes__:
24
+ <% unless config[:classes].nil? %>
25
+ <% config[:classes].each do |cl| %>
26
+ - `<%= cl %>`
27
+ <% end %>
28
+ <% end %>
29
+
30
+ * __Puppet definitions__:
31
+ <% unless config[:definitions].nil? %>
32
+ <% config[:definitions].each do |de| %>
33
+ - `<%= de %>`
34
+ <% end %>
35
+ <% end %>
36
+
37
+ All these components are configured through a set of variables you will find in
38
+ [`manifests/params.pp`](manifests/params.pp).
39
+
40
+ _Note_: the various operations that can be conducted from this repository are piloted from a [`Rakefile`](https://github.com/ruby/rake) and assumes you have a running [Ruby](https://www.ruby-lang.org/en/) installation.
41
+ See [`doc/contributing.md`](doc/contributing.md) for more details on the steps you shall follow to have this `Rakefile` working properly.
29
42
 
30
43
  ## Dependencies
31
44
 
@@ -35,19 +48,34 @@ See [`metadata.json`](metadata.json). In particular, this module depends on
35
48
  * [<%= dep["name"].gsub(/-/,"/") %>](https://forge.puppetlabs.com/<%= dep["name"].gsub(/-/,"/") %>)
36
49
  <% end %>
37
50
 
38
- ## General Parameters
51
+ ## Overview and Usage
39
52
 
40
- See [manifests/params.pp](manifests/params.pp)
53
+ ### Class `<%= config[:shortname] %>`
41
54
 
42
- ## Overview and Usage
55
+ This is the main class defined in this module.
56
+ It accepts the following parameters:
43
57
 
44
- ### class `<%= config[:shortname] %>`
58
+ * `$ensure`: default to 'present', can be 'absent'
59
+
60
+ Use is as follows:
45
61
 
46
62
  include ' <%= config[:shortname] %>'
47
63
 
48
- ### definition `<%= config[:shortname] %>::mydef`
64
+ See also [`tests/init.pp`](tests/init.pp)
49
65
 
50
- The definition `<%= config[:shortname] %>::mydef` provides ...
66
+ <% unless config[:classes].nil? %>
67
+ <% config[:classes].each do |cl| %>
68
+ ### Class `<%= cl %>`
69
+
70
+ See `tests/<%= cl.gsub(/::/, '/') %>.pp`
71
+ <% end %>
72
+ <% end %>
73
+
74
+ <% unless config[:definitions].nil? %>
75
+ <% config[:definitions].each do |de| %>
76
+ ### Definition `<%= de %>`
77
+
78
+ The definition `<%= de %>` provides ...
51
79
  This definition accepts the following parameters:
52
80
 
53
81
  * `$ensure`: default to 'present', can be 'absent'
@@ -56,14 +84,18 @@ This definition accepts the following parameters:
56
84
 
57
85
  Example:
58
86
 
59
- <%= config[:shortname] %>::mydef {'entry':
60
- content => "entry\n",
61
- }
87
+ <%= de %> { 'toto':
88
+ ensure => 'present',
89
+ }
90
+
91
+ See also `tests/<%= de.gsub(/::/, '/') %>.pp`
92
+
93
+ <% end %>
94
+ <% end %>
62
95
 
63
96
  ## Librarian-Puppet / R10K Setup
64
97
 
65
- You can of course configure ULHPC-sudo in your `Puppetfile` to make it
66
- available with [Librarian puppet](http://librarian-puppet.com/) or
98
+ You can of course configure the <%= config[:shortname] %> module in your `Puppetfile` to make it available with [Librarian puppet](http://librarian-puppet.com/) or
67
99
  [r10k](https://github.com/adrienthebo/r10k) by adding the following entry:
68
100
 
69
101
  # Modules from the Puppet Forge
@@ -77,60 +109,20 @@ or, if you prefer to work on the git version:
77
109
 
78
110
  ## Issues / Feature request
79
111
 
80
- You can submit bug / issues / feature request using the
81
- [<%= config[:name] %> Puppet Module Tracker](<%= config[:issues_url] %>).
82
-
112
+ You can submit bug / issues / feature request using the [<%= config[:name] %> Puppet Module Tracker](<%= config[:issues_url] %>).
83
113
 
84
114
  ## Developments / Contributing to the code
85
115
 
86
- If you want to contribute to the code, you shall be aware of the way this module
87
- is organized.
116
+ If you want to contribute to the code, you shall be aware of the way this module is organized.
88
117
  These elements are detailed on [`doc/contributing.md`](doc/contributing.md)
89
118
 
90
- You are more than welcome to contribute to its development by
91
- [sending a pull request](https://help.github.com/articles/using-pull-requests).
92
-
93
- ## Tests on Vagrant box
94
-
95
- The best way to test this module in a non-intrusive way is to rely on
96
- [Vagrant](http://www.vagrantup.com/). The `Vagrantfile` at the root of the
97
- repository pilot the provisioning of the vagrant box and relies on boxes
98
- generated through my [vagrant-vms](https://github.com/falkor/vagrant-vms)
99
- repository.
100
- Once cloned, run
101
-
102
- $> rake packer:Debian:init
103
-
104
- To create a template. Select the version matching the once mentioned on the
105
- `Vagrantfile` (`7.6.0-amd64` for instance)
106
- Then run
107
-
108
- $> rake packer:Debian:build
109
-
110
- This shall generate the vagrant box `debian-7.6.0-amd64.box` that you can then
111
- add to your box lists:
112
-
113
- $> vagrant box add debian-7.6.0-amd64 packer/debian-7.6.0-amd64/debian-7.6.0-amd64.box
114
-
115
- Now you can run `vagrant up` from this repository to boot the VM, provision it
116
- to be ready to test this module (see the [`.vagrant_init.rb`](.vagrant_init.rb)
117
- script). For instance, you can test the manifests of the `tests/` directory
118
- within the VM:
119
-
120
- $> vagrant ssh
121
- [...]
122
- (vagrant)$> sudo puppet apply -t /vagrant/tests/init.pp
123
-
124
- Run `vagrant halt` (or `vagrant destroy`) to stop (or kill) the VM once you've
125
- finished to play with it.
119
+ You are more than welcome to contribute to its development by [sending a pull request](https://help.github.com/articles/using-pull-requests).
126
120
 
127
- ## Resources
121
+ ## Puppet modules tests within a Vagrant box
128
122
 
129
- ### Git
123
+ The best way to test this module in a non-intrusive way is to rely on [Vagrant](http://www.vagrantup.com/).
124
+ The `Vagrantfile` at the root of the repository pilot the provisioning various vagrant boxes available on [Vagrant cloud](https://atlas.hashicorp.com/boxes/search?utf8=%E2%9C%93&sort=&provider=virtualbox&q=svarrette) you can use to test this module.
130
125
 
131
- You should become familiar (if not yet) with Git. Consider these resources:
126
+ See [`doc/vagrant.md`](doc/vagrant.md) for more details.
132
127
 
133
- * [Git book](http://book.git-scm.com/index.html)
134
- * [Github:help](http://help.github.com/mac-set-up-git/)
135
- * [Git reference](http://gitref.org/)
136
128
 
@@ -21,8 +21,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
21
21
  }
22
22
  }.each do |name,cfg|
23
23
  boxname = name.to_s.downcase.gsub(/_/, '-')
24
- config.vm.define boxname do |local|
25
- local.vm.primary = true if cfg[:primary]
24
+ config.vm.define boxname, :primary => cfg[:primary] do |local|
25
+ #local.vm.primary = true if cfg[:primary]
26
26
  local.vm.box = cfg[:box]
27
27
  local.vm.host_name = ENV['VAGRANT_HOSTNAME'] || name.to_s.downcase.gsub(/_/, '-').concat(".vagrant.com")
28
28
  local.vm.provision "shell", path: ".vagrant_init.rb"
@@ -1,9 +1,8 @@
1
- -*- mode: markdown; mode: auto-fill; fill-column: 80 -*-
1
+ -*- mode: markdown; mode: visual-line; -*-
2
2
 
3
3
  # <%= config[:shortname].capitalize %> Puppet Module Developments
4
4
 
5
- If you want to contribute to the code, you shall be aware of the way this module
6
- is organized.
5
+ If you want to contribute to the code, you shall be aware of the way this module is organized.
7
6
 
8
7
  ### Directory Layout
9
8
 
@@ -15,7 +14,17 @@ is organized.
15
14
  `-- manifests/
16
15
  `-- init.pp # Main manifests file which defines the <%= config[:shortname] %> class
17
16
  `-- params.pp # <%= config[:name] %> module variables
18
- `-- mydef.pp # defines the <%= config[:shortname] %>::mydef definition
17
+ <% unless config[:classes].nil? %>
18
+ <% config[:classes].each do |cl| %>
19
+ <% next if cl =~ /params/ %>
20
+ `-- <%= cl.gsub(/::/, '/') %>.pp
21
+ <% end %>
22
+ <% end %>
23
+ <% unless config[:definitions].nil? %>
24
+ <% config[:definitions].each do |de| %>
25
+ `-- <%= de.gsub(/::/, '/') %>.pp
26
+ <% end %>
27
+ <% end %>
19
28
  `-- templates/ # Module ERB template files
20
29
  `-- tests/ # Contains examples showing how to declare the module’s classes and defined type
21
30
  `-- spec/ # Contains rspec tests
@@ -28,21 +37,13 @@ is organized.
28
37
 
29
38
  ### Git Branching Model
30
39
 
31
- The Git branching model for this repository follows the guidelines of
32
- [gitflow](http://nvie.com/posts/a-successful-git-branching-model/).
33
- In particular, the central repository holds two main branches with an infinite
34
- lifetime:
40
+ The Git branching model for this repository follows the guidelines of [gitflow](http://nvie.com/posts/a-successful-git-branching-model/).
41
+ In particular, the central repository holds two main branches with an infinite lifetime:
35
42
 
36
- * `<%= FalkorLib.config[:gitflow][:branches][:master] %>`: the branch holding
37
- tags of the successive releases of this tutorial
38
- * `<%= FalkorLib.config[:gitflow][:branches][:develop] %>`: the main branch
39
- where the sources are in a state with the latest delivered development changes
40
- for the next release. This is the *default* branch you get when you clone the
41
- repository, and the one on which developments will take places.
43
+ * `<%= FalkorLib.config[:gitflow][:branches][:master] %>`: the branch holding tags of the successive releases of this tutorial
44
+ * `<%= FalkorLib.config[:gitflow][:branches][:develop] %>`: the main branch where the sources are in a state with the latest delivered development changes for the next release. This is the *default* branch you get when you clone the repository, and the one on which developments will take places.
42
45
 
43
- You should therefore install [git-flow](https://github.com/nvie/gitflow), and
44
- probably also its associated
45
- [bash completion](https://github.com/bobthecow/git-flow-completion).
46
+ You should therefore install [git-flow](https://github.com/nvie/gitflow), and probably also its associated [bash completion](https://github.com/bobthecow/git-flow-completion).
46
47
 
47
48
  ### Ruby, [RVM](https://rvm.io/) and [Bundler](http://bundler.io/)
48
49
 
@@ -59,39 +60,31 @@ The ruby stuff part of this repository corresponds to the following files:
59
60
  project as [gemset](https://rvm.io/gemsets) name
60
61
  * `Gemfile[.lock]`: used by `[bundle](http://bundler.io/)`
61
62
 
62
- You should now be able to access the list of available tasks by running:
63
+ ### Repository Setup
64
+
65
+ Then, to make your local copy of the repository ready to use the [git-flow](https://github.com/nvie/gitflow) workflow and the local [RVM](https://rvm.io/) setup, you have to run the following commands once you cloned it for the first time:
63
66
 
64
- $> rake -T
67
+ $> gem install bundler # assuming it is not yet available
68
+ $> bundle install
69
+ $> rake -T # To list the available tasks
70
+ $> rake setup
65
71
 
66
72
  You probably wants to activate the bash-completion for rake tasks.
67
73
  I personnaly use the one provided [here](https://github.com/ai/rake-completion)
68
74
 
69
75
  Also, some of the tasks are hidden. Run `rake -T -A` to list all of them.
70
76
 
71
- ### Repository Setup
72
-
73
- Then, to make your local copy of the repository ready to use the
74
- [git-flow](https://github.com/nvie/gitflow) workflow and the local
75
- [RVM](https://rvm.io/) setup, you have to run the following commands once you
76
- cloned it for the first time:
77
-
78
- $> rake setup
79
-
80
77
  ### RSpec tests
81
78
 
82
- A set of unitary tests are defined to validate the different function of my
83
- library using [Rspec](http://rspec.info/)
79
+ A set of unitary tests are defined to validate the different function of my library using [Rspec](http://rspec.info/)
84
80
 
85
81
  You can run these tests by issuing:
86
82
 
87
83
  $> rake rspec # NOT YET IMPLEMENTED
88
84
 
89
- By conventions, you will find all the currently implemented tests in the `spec/`
90
- directory, in files having the `_spec.rb` suffix. This is expected from the
91
- `rspec` task of the `Rakefile`.
85
+ By conventions, you will find all the currently implemented tests in the `spec/` directory, in files having the `_spec.rb` suffix. This is expected from the `rspec` task of the `Rakefile`.
92
86
 
93
- **Important** Kindly stick to this convention, and feature tests for all
94
- definitions/classes/modules you might want to add.
87
+ **Important** Kindly stick to this convention, and feature tests for all definitions/classes/modules you might want to add.
95
88
 
96
89
  ### Releasing mechanism
97
90
 
@@ -117,15 +110,14 @@ For more information on the version, run:
117
110
 
118
111
  If a new version number such be bumped, you simply have to run:
119
112
 
120
- $> rake version:bump:{major,minor,patch}
113
+ $> rake version:bump:{major,minor,patch}
121
114
 
122
115
  This will start the release process for you using `git-flow`.
123
116
  Then, to make the release effective, just run:
124
117
 
125
- $> rake version:release
118
+ $> rake version:release
126
119
 
127
- This will finalize the release using `git-flow`, create the appropriate tag and
128
- merge all things the way they should be.
120
+ This will finalize the release using `git-flow`, create the appropriate tag and merge all things the way they should be.
129
121
 
130
122
  # Contributing Notes
131
123
 
@@ -0,0 +1,59 @@
1
+ -*- mode: markdown; mode: visual-line; -*-
2
+
3
+ # <%= config[:shortname].capitalize %> Puppet Module Tests with Vagrant
4
+
5
+ The best way to test this module in a non-intrusive way is to rely on [Vagrant](http://www.vagrantup.com/).
6
+ [Vagrant](http://vagrantup.com/) uses [Oracle's VirtualBox](http://www.virtualbox.org/)
7
+ to build configurable, lightweight, and portable virtual machines dynamically.
8
+
9
+ * [Reference installation notes](http://docs.vagrantup.com/v2/installation/) -- assuming you have installed [Oracle's VirtualBox](http://www.virtualbox.org/)
10
+ * [installation notes on Mac OS](http://sourabhbajaj.com/mac-setup/Vagrant/README.html) using [Homebrew](http://brew.sh/) and [Cask](http://sourabhbajaj.com/mac-setup/Homebrew/Cask.html)
11
+
12
+ The `Vagrantfile` at the root of the repository pilot the provisioning of many vagrant boxes generated through the [vagrant-vms](https://github.com/falkor/vagrant-vms) repository and available on [Vagrant cloud](https://atlas.hashicorp.com/boxes/search?utf8=%E2%9C%93&sort=&provider=virtualbox&q=svarrette).
13
+
14
+ You can list the available vagrant box as follows:
15
+
16
+ $> vagrant status
17
+ Current machine states:
18
+
19
+ centos-7 not created (virtualbox)
20
+ debian-7 not created (virtualbox)
21
+
22
+ This environment represents multiple VMs. The VMs are all listed
23
+ above with their current state. For more information about a specific
24
+ VM, run `vagrant status NAME`.
25
+
26
+ As suggested, you can run a debian 7 machine for instance by issuing:
27
+
28
+ $> vagrant up debian-7
29
+
30
+ Then you can ssh into the machine afterwards:
31
+
32
+ $> vagrant ssh debian-7
33
+
34
+ When you run `vagrant up <os>` to boot the VM, it is configured to be provisioned with the `.vagrant_init.rb` script.
35
+ This script is responsible for two main tasks:
36
+
37
+ 1. pre-install the puppet modules listed as dependencies in `metadata.json`
38
+ 2. make the appropriate symbolic link in the puppet module directory (to `/vagrant`) to ensure you can directly make changes and correct your own module transparently within the box.
39
+
40
+ So you can test the manifests of the `tests/` directory within the VM:
41
+
42
+ $> vagrant ssh <os>
43
+ [...]
44
+ (vagrant)$> sudo puppet apply -t /vagrant/tests/init.pp
45
+
46
+ From now on, you can test (with --noop) the other manifests.
47
+
48
+ Run `vagrant halt` (or `vagrant destroy`) to stop (or kill) the VM once you've finished to play with it.
49
+
50
+ _Note_: The `Vagrantfile` at the root of this repository might evolve over the time with new boxes. To automatically get the last version available:
51
+
52
+ 1. Upgrade the [`falkorlib`](https://rubygems.org/gems/falkorlib) gem
53
+
54
+ $> bundle update falkorlib
55
+ $> git commit -s -m "Upgrade falkorlib to the latest version" Gemfile.lock
56
+
57
+ 2. update the `Vagrantfile` to the last version by issuing:
58
+
59
+ $> rake templates:upgrade:vagrant
@@ -0,0 +1,10 @@
1
+ # File:: <tt>common/debian.pp</tt>
2
+ # Author:: <%= config[:author] %> (<%= config[:mail] %>)
3
+ # Copyright:: Copyright (c) <%= Time.now.year %> <%= config[:author] %>
4
+ # License:: <%= config[:license].capitalize %>
5
+ #
6
+ # ------------------------------------------------------------------------------
7
+ # = Class: <%= config[:shortname] %>::debian
8
+ #
9
+ # Specialization class for Debian systems
10
+ class <%= config[:shortname] %>::common::debian inherits <%= config[:shortname] %>::common { }
@@ -0,0 +1,10 @@
1
+ # File:: <tt>common/redhat.pp</tt>
2
+ # Author:: <%= config[:author] %> (<%= config[:mail] %>)
3
+ # Copyright:: Copyright (c) <%= Time.now.year %> <%= config[:author] %>
4
+ # License:: <%= config[:license].capitalize %>
5
+ #
6
+ # ------------------------------------------------------------------------------
7
+ # = Class: <%= config[:shortname] %>::debian
8
+ #
9
+ # Specialization class for Debian systems
10
+ class <%= config[:shortname] %>::common::redhat inherits <%= config[:shortname] %>::common { }
@@ -0,0 +1,127 @@
1
+ # File:: <tt>common.pp</tt>
2
+ # Author:: <%= config[:author] %> (<%= config[:mail] %>)
3
+ # Copyright:: Copyright (c) <%= Time.now.year %> <%= config[:author] %>
4
+ # License:: <%= config[:license].capitalize %>
5
+ #
6
+ # ------------------------------------------------------------------------------
7
+ # = Class: <%= config[:shortname] %>::common
8
+ #
9
+ # Base class to be inherited by the other <%= config[:shortname] %> classes, containing the common code.
10
+ #
11
+ # Note: respect the Naming standard provided here[http://projects.puppetlabs.com/projects/puppet/wiki/Module_Standards]
12
+
13
+ class <%= config[:shortname] %>::common {
14
+
15
+ # Load the variables used in this module. Check the params.pp file
16
+ require <%= config[:shortname] %>::params
17
+
18
+ package { '<%= config[:shortname] %>':
19
+ name => "${<%= config[:shortname] %>::params::packagename}",
20
+ ensure => "${<%= config[:shortname] %>::ensure}",
21
+ }
22
+ # package { $<%= config[:shortname] %>::params::extra_packages:
23
+ # ensure => 'present'
24
+ # }
25
+
26
+ if $<%= config[:shortname] %>::ensure == 'present' {
27
+
28
+ # Prepare the log directory
29
+ file { "${<%= config[:shortname] %>::params::logdir}":
30
+ ensure => 'directory',
31
+ owner => "${<%= config[:shortname] %>::params::logdir_owner}",
32
+ group => "${<%= config[:shortname] %>::params::logdir_group}",
33
+ mode => "${<%= config[:shortname] %>::params::logdir_mode}",
34
+ require => Package['<%= config[:shortname] %>'],
35
+ }
36
+
37
+ # Configuration file
38
+ # file { "${<%= config[:shortname] %>::params::configdir}":
39
+ # ensure => 'directory',
40
+ # owner => "${<%= config[:shortname] %>::params::configdir_owner}",
41
+ # group => "${<%= config[:shortname] %>::params::configdir_group}",
42
+ # mode => "${<%= config[:shortname] %>::params::configdir_mode}",
43
+ # require => Package['<%= config[:shortname] %>'],
44
+ # }
45
+ # Regular version using file resource
46
+ file { '<%= config[:shortname] %>.conf':
47
+ path => "${<%= config[:shortname] %>::params::configfile}",
48
+ owner => "${<%= config[:shortname] %>::params::configfile_owner}",
49
+ group => "${<%= config[:shortname] %>::params::configfile_group}",
50
+ mode => "${<%= config[:shortname] %>::params::configfile_mode}",
51
+ ensure => "${<%= config[:shortname] %>::ensure}",
52
+ #content => template("<%= config[:shortname] %>/<%= config[:shortname] %>conf.erb"),
53
+ #source => "puppet:///modules/<%= config[:shortname] %>/<%= config[:shortname] %>.conf",
54
+ #notify => Service['<%= config[:shortname] %>'],
55
+ require => [
56
+ #File["${<%= config[:shortname] %>::params::configdir}"],
57
+ Package['<%= config[:shortname] %>']
58
+ ],
59
+ }
60
+
61
+ # # Concat version -- see https://forge.puppetlabs.com/puppetlabs/concat
62
+ # include concat::setup
63
+ # concat { "${<%= config[:shortname] %>::params::configfile}":
64
+ # warn => false,
65
+ # owner => "${<%= config[:shortname] %>::params::configfile_owner}",
66
+ # group => "${<%= config[:shortname] %>::params::configfile_group}",
67
+ # mode => "${<%= config[:shortname] %>::params::configfile_mode}",
68
+ # #notify => Service['<%= config[:shortname] %>'],
69
+ # require => Package['<%= config[:shortname] %>'],
70
+ # }
71
+ # # Populate the configuration file
72
+ # concat::fragment { "${<%= config[:shortname] %>::params::configfile}_header":
73
+ # target => "${<%= config[:shortname] %>::params::configfile}",
74
+ # ensure => "${<%= config[:shortname] %>::ensure}",
75
+ # content => template("<%= config[:shortname] %>/<%= config[:shortname] %>_header.conf.erb"),
76
+ # #source => "puppet:///modules/<%= config[:shortname] %>/<%= config[:shortname] %>_header.conf",
77
+ # order => '01',
78
+ # }
79
+ # concat::fragment { "${<%= config[:shortname] %>::params::configfile}_footer":
80
+ # target => "${<%= config[:shortname] %>::params::configfile}",
81
+ # ensure => "${<%= config[:shortname] %>::ensure}",
82
+ # content => template("<%= config[:shortname] %>/<%= config[:shortname] %>_footer.conf.erb"),
83
+ # #source => "puppet:///modules/<%= config[:shortname] %>/<%= config[:shortname] %>_footer.conf",
84
+ # order => '99',
85
+ # }
86
+
87
+ # PID file directory
88
+ # file { "${<%= config[:shortname] %>::params::piddir}":
89
+ # ensure => 'directory',
90
+ # owner => "${<%= config[:shortname] %>::params::piddir_user}",
91
+ # group => "${<%= config[:shortname] %>::params::piddir_group}",
92
+ # mode => "${<%= config[:shortname] %>::params::piddir_mode}",
93
+ # }
94
+
95
+ file { "${<%= config[:shortname] %>::params::configfile_init}":
96
+ owner => "${<%= config[:shortname] %>::params::configfile_owner}",
97
+ group => "${<%= config[:shortname] %>::params::configfile_group}",
98
+ mode => "${<%= config[:shortname] %>::params::configfile_mode}",
99
+ ensure => "${<%= config[:shortname] %>::ensure}",
100
+ #content => template("<%= config[:shortname] %>/default/<%= config[:shortname] %>.erb"),
101
+ #source => "puppet:///modules/<%= config[:shortname] %>/default/<%= config[:shortname] %>.conf",
102
+ notify => Service['<%= config[:shortname] %>'],
103
+ require => Package['<%= config[:shortname] %>']
104
+ }
105
+
106
+ service { '<%= config[:shortname] %>':
107
+ name => "${<%= config[:shortname] %>::params::servicename}",
108
+ enable => true,
109
+ ensure => running,
110
+ hasrestart => "${<%= config[:shortname] %>::params::hasrestart}",
111
+ pattern => "${<%= config[:shortname] %>::params::processname}",
112
+ hasstatus => "${<%= config[:shortname] %>::params::hasstatus}",
113
+ require => [
114
+ Package['<%= config[:shortname] %>'],
115
+ File["${<%= config[:shortname] %>::params::configfile_init}"]
116
+ ],
117
+ subscribe => File['<%= config[:shortname] %>.conf'],
118
+ }
119
+ }
120
+ else
121
+ {
122
+ # Here $<%= config[:shortname] %>::ensure is 'absent'
123
+
124
+ }
125
+
126
+ }
127
+
@@ -22,12 +22,12 @@
22
22
  #
23
23
  # == Sample Usage:
24
24
  #
25
- # import <%= config[:name] %>
25
+ # include '<%= config[:shortname] %>'
26
26
  #
27
27
  # You can then specialize the various aspects of the configuration,
28
28
  # for instance:
29
29
  #
30
- # class { '<%= config[:name] %>':
30
+ # class { '<%= config[:shortname] %>':
31
31
  # ensure => 'present'
32
32
  # }
33
33
  #
@@ -39,159 +39,25 @@
39
39
  #
40
40
  # [Remember: No empty lines between comments and class definition]
41
41
  #
42
- class <%= config[:name] %>(
43
- $ensure = $<%= config[:name] %>::params::ensure
42
+ class <%= config[:shortname] %>(
43
+ $ensure = $<%= config[:shortname] %>::params::ensure
44
44
  )
45
- inherits <%= config[:name] %>::params
45
+ inherits <%= config[:shortname] %>::params
46
46
  {
47
- info ("Configuring <%= config[:name] %> (with ensure = ${ensure})")
47
+ info ("Configuring <%= config[:shortname] %> (with ensure = ${ensure})")
48
48
 
49
49
  if ! ($ensure in [ 'present', 'absent' ]) {
50
- fail("<%= config[:name] %> 'ensure' parameter must be set to either 'absent' or 'present'")
50
+ fail("<%= config[:shortname] %> 'ensure' parameter must be set to either 'absent' or 'present'")
51
51
  }
52
52
 
53
53
  case $::operatingsystem {
54
- debian, ubuntu: { include <%= config[:name] %>::debian }
55
- redhat, fedora, centos: { include <%= config[:name] %>::redhat }
54
+ debian, ubuntu: { include <%= config[:shortname] %>::common::debian }
55
+ redhat, fedora, centos: { include <%= config[:shortname] %>::common::redhat }
56
56
  default: {
57
57
  fail("Module $module_name is not supported on $operatingsystem")
58
58
  }
59
59
  }
60
60
  }
61
61
 
62
- # ------------------------------------------------------------------------------
63
- # = Class: <%= config[:name] %>::common
64
- #
65
- # Base class to be inherited by the other <%= config[:name] %> classes
66
- #
67
- # Note: respect the Naming standard provided here[http://projects.puppetlabs.com/projects/puppet/wiki/Module_Standards]
68
- class <%= config[:name] %>::common {
69
-
70
- # Load the variables used in this module. Check the <%= config[:name] %>-params.pp file
71
- require <%= config[:name] %>::params
72
-
73
- package { '<%= config[:name] %>':
74
- name => "${<%= config[:name] %>::params::packagename}",
75
- ensure => "${<%= config[:name] %>::ensure}",
76
- }
77
- # package { $<%= config[:name] %>::params::extra_packages:
78
- # ensure => 'present'
79
- # }
80
-
81
- if $<%= config[:name] %>::ensure == 'present' {
82
-
83
- # Prepare the log directory
84
- file { "${<%= config[:name] %>::params::logdir}":
85
- ensure => 'directory',
86
- owner => "${<%= config[:name] %>::params::logdir_owner}",
87
- group => "${<%= config[:name] %>::params::logdir_group}",
88
- mode => "${<%= config[:name] %>::params::logdir_mode}",
89
- require => Package['<%= config[:name] %>'],
90
- }
91
-
92
- # Configuration file
93
- # file { "${<%= config[:name] %>::params::configdir}":
94
- # ensure => 'directory',
95
- # owner => "${<%= config[:name] %>::params::configdir_owner}",
96
- # group => "${<%= config[:name] %>::params::configdir_group}",
97
- # mode => "${<%= config[:name] %>::params::configdir_mode}",
98
- # require => Package['<%= config[:name] %>'],
99
- # }
100
- # Regular version using file resource
101
- file { '<%= config[:name] %>.conf':
102
- path => "${<%= config[:name] %>::params::configfile}",
103
- owner => "${<%= config[:name] %>::params::configfile_owner}",
104
- group => "${<%= config[:name] %>::params::configfile_group}",
105
- mode => "${<%= config[:name] %>::params::configfile_mode}",
106
- ensure => "${<%= config[:name] %>::ensure}",
107
- #content => template("<%= config[:name] %>/<%= config[:name] %>conf.erb"),
108
- #source => "puppet:///modules/<%= config[:name] %>/<%= config[:name] %>.conf",
109
- #notify => Service['<%= config[:name] %>'],
110
- require => [
111
- #File["${<%= config[:name] %>::params::configdir}"],
112
- Package['<%= config[:name] %>']
113
- ],
114
- }
115
-
116
- # # Concat version
117
- # include concat::setup
118
- # concat { "${<%= config[:name] %>::params::configfile}":
119
- # warn => false,
120
- # owner => "${<%= config[:name] %>::params::configfile_owner}",
121
- # group => "${<%= config[:name] %>::params::configfile_group}",
122
- # mode => "${<%= config[:name] %>::params::configfile_mode}",
123
- # #notify => Service['<%= config[:name] %>'],
124
- # require => Package['<%= config[:name] %>'],
125
- # }
126
- # # Populate the configuration file
127
- # concat::fragment { "${<%= config[:name] %>::params::configfile}_header":
128
- # target => "${<%= config[:name] %>::params::configfile}",
129
- # ensure => "${<%= config[:name] %>::ensure}",
130
- # content => template("<%= config[:name] %>/<%= config[:name] %>_header.conf.erb"),
131
- # #source => "puppet:///modules/<%= config[:name] %>/<%= config[:name] %>_header.conf",
132
- # order => '01',
133
- # }
134
- # concat::fragment { "${<%= config[:name] %>::params::configfile}_footer":
135
- # target => "${<%= config[:name] %>::params::configfile}",
136
- # ensure => "${<%= config[:name] %>::ensure}",
137
- # content => template("<%= config[:name] %>/<%= config[:name] %>_footer.conf.erb"),
138
- # #source => "puppet:///modules/<%= config[:name] %>/<%= config[:name] %>_footer.conf",
139
- # order => '99',
140
- # }
141
-
142
- # PID file directory
143
- # file { "${<%= config[:name] %>::params::piddir}":
144
- # ensure => 'directory',
145
- # owner => "${<%= config[:name] %>::params::piddir_user}",
146
- # group => "${<%= config[:name] %>::params::piddir_group}",
147
- # mode => "${<%= config[:name] %>::params::piddir_mode}",
148
- # }
149
-
150
- file { "${<%= config[:name] %>::params::configfile_init}":
151
- owner => "${<%= config[:name] %>::params::configfile_owner}",
152
- group => "${<%= config[:name] %>::params::configfile_group}",
153
- mode => "${<%= config[:name] %>::params::configfile_mode}",
154
- ensure => "${<%= config[:name] %>::ensure}",
155
- #content => template("<%= config[:name] %>/default/<%= config[:name] %>.erb"),
156
- #source => "puppet:///modules/<%= config[:name] %>/default/<%= config[:name] %>.conf",
157
- notify => Service['<%= config[:name] %>'],
158
- require => Package['<%= config[:name] %>']
159
- }
160
-
161
- service { '<%= config[:name] %>':
162
- name => "${<%= config[:name] %>::params::servicename}",
163
- enable => true,
164
- ensure => running,
165
- hasrestart => "${<%= config[:name] %>::params::hasrestart}",
166
- pattern => "${<%= config[:name] %>::params::processname}",
167
- hasstatus => "${<%= config[:name] %>::params::hasstatus}",
168
- require => [
169
- Package['<%= config[:name] %>'],
170
- File["${<%= config[:name] %>::params::configfile_init}"]
171
- ],
172
- subscribe => File['<%= config[:name] %>.conf'],
173
- }
174
- }
175
- else
176
- {
177
- # Here $<%= config[:name] %>::ensure is 'absent'
178
-
179
- }
180
-
181
- }
182
-
183
-
184
- # ------------------------------------------------------------------------------
185
- # = Class: <%= config[:name] %>::debian
186
- #
187
- # Specialization class for Debian systems
188
- class <%= config[:name] %>::debian inherits <%= config[:name] %>::common { }
189
-
190
- # ------------------------------------------------------------------------------
191
- # = Class: <%= config[:name] %>::redhat
192
- #
193
- # Specialization class for Redhat systems
194
- class <%= config[:name] %>::redhat inherits <%= config[:name] %>::common { }
195
-
196
62
 
197
63
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: falkorlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastien Varrette
@@ -422,7 +422,11 @@ files:
422
422
  - templates/puppet/modules/Rakefile
423
423
  - templates/puppet/modules/Vagrantfile
424
424
  - templates/puppet/modules/doc/contributing.md.erb
425
+ - templates/puppet/modules/doc/vagrant.md.erb
425
426
  - templates/puppet/modules/files/README.md.erb
427
+ - templates/puppet/modules/manifests/common.pp.erb
428
+ - templates/puppet/modules/manifests/common/debian.pp.erb
429
+ - templates/puppet/modules/manifests/common/redhat.pp.erb
426
430
  - templates/puppet/modules/manifests/init.pp.erb
427
431
  - templates/puppet/modules/manifests/mydef.pp.erb
428
432
  - templates/puppet/modules/manifests/params.pp.erb