vagrant-r10k 0.1.0 → 0.1.1
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/.ruby-version +1 -0
- data/README.md +65 -6
- data/Rakefile +7 -0
- data/lib/vagrant-r10k/config.rb +7 -0
- data/lib/vagrant-r10k/modulegetter.rb +25 -1
- data/lib/vagrant-r10k/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11ae37b7c28f43dcdd732d3b5515e4f2c0eadcc1
|
4
|
+
data.tar.gz: a7d31bd3f78eea85d5e1e0098471d26f6c08a477
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 336d24166bda7d40cd6a8c3a6ffecc8e6247aae15892fadb9ce8b887e8b36ec3b271f6ad1bf417d93c53f7738ae3054bf57c60eea49883541e4dea818e5d8a1c
|
7
|
+
data.tar.gz: 7a11489ace64e0edb07410b28740e4df80f6c952fb94243a59fe673024db027418b3e5b37b8be44484b6a92df8db3e3786075f77249a9d3e95163851d576aa12
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.1.1
|
data/README.md
CHANGED
@@ -22,7 +22,45 @@ conflicting Puppet installation.
|
|
22
22
|
Add the following to your Vagrantfile, before the puppet section:
|
23
23
|
|
24
24
|
config.r10k.puppet_dir = 'dir' # the parent directory that contains your module directory and Puppetfile
|
25
|
-
|
25
|
+
config.r10k.puppetfile_path = 'dir/Puppetfile' # the path to your Puppetfile, within the repo
|
26
|
+
|
27
|
+
For the following example directory structure:
|
28
|
+
|
29
|
+
.
|
30
|
+
├── README.md
|
31
|
+
├── Vagrantfile
|
32
|
+
├── docs
|
33
|
+
│ └── foo.md
|
34
|
+
├── puppet
|
35
|
+
│ ├── Puppetfile
|
36
|
+
│ ├── manifests
|
37
|
+
│ │ └── default.pp
|
38
|
+
│ └── modules
|
39
|
+
└── someproject
|
40
|
+
└── foo.something
|
41
|
+
|
42
|
+
The configuration for r10k and puppet would look like:
|
43
|
+
|
44
|
+
# r10k plugin to deploy puppet modules
|
45
|
+
config.r10k.puppet_dir = "puppet"
|
46
|
+
config.r10k.puppetfile_path = "puppet/Puppetfile"
|
47
|
+
|
48
|
+
# Provision the machine with the appliction
|
49
|
+
config.vm.provision "puppet" do |puppet|
|
50
|
+
puppet.manifests_path = "puppet/manifests"
|
51
|
+
puppet.manifest_file = "default.pp"
|
52
|
+
puppet.module_path = "puppet/modules"
|
53
|
+
end
|
54
|
+
|
55
|
+
If you provide an array of directories in puppet.module_path, vagrant-r10k will use the first directory listed for auto configuration. If you want to let r10k use a different directory, see below.
|
56
|
+
|
57
|
+
## Usage with explicit path to module installation directory
|
58
|
+
|
59
|
+
Add the following to your Vagrantfile, before the puppet section:
|
60
|
+
|
61
|
+
config.r10k.puppet_dir = 'dir' # the parent directory that contains your module directory and Puppetfile
|
62
|
+
config.r10k.puppetfile_path = 'dir/Puppetfile' # the path to your Puppetfile, within the repo
|
63
|
+
config.r10k.module_path = 'dir/moduledir' # the path where r10k should install its modules (should be same / one of those in puppet provisioner, will be checked)
|
26
64
|
|
27
65
|
For the following example directory structure:
|
28
66
|
|
@@ -35,21 +73,23 @@ For the following example directory structure:
|
|
35
73
|
│ ├── Puppetfile
|
36
74
|
│ ├── manifests
|
37
75
|
│ │ └── default.pp
|
38
|
-
│
|
76
|
+
│ ├── modules # your own modules
|
77
|
+
│ └── vendor # modules installed by r10k
|
39
78
|
└── someproject
|
40
|
-
|
79
|
+
└── foo.something
|
41
80
|
|
42
81
|
The configuration for r10k and puppet would look like:
|
43
82
|
|
44
83
|
# r10k plugin to deploy puppet modules
|
45
84
|
config.r10k.puppet_dir = "puppet"
|
46
85
|
config.r10k.puppetfile_path = "puppet/Puppetfile"
|
86
|
+
config.r10k.module_path = "puppet/vendor"
|
47
87
|
|
48
88
|
# Provision the machine with the appliction
|
49
89
|
config.vm.provision "puppet" do |puppet|
|
50
90
|
puppet.manifests_path = "puppet/manifests"
|
51
91
|
puppet.manifest_file = "default.pp"
|
52
|
-
puppet.module_path = "puppet/modules"
|
92
|
+
puppet.module_path = ["puppet/modules", "puppet/vendor"]
|
53
93
|
end
|
54
94
|
|
55
95
|
## Contributing
|
@@ -57,13 +97,32 @@ The configuration for r10k and puppet would look like:
|
|
57
97
|
1. Fork it ( https://github.com/jantman/vagrant-r10k/fork )
|
58
98
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
59
99
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
60
|
-
4.
|
61
|
-
5.
|
100
|
+
4. Increment the version number in `lib/vagrant-r10k/version.rb`
|
101
|
+
5. Add yourself to the "Contributors" list below.
|
102
|
+
6. Push to the branch (`git push origin my-new-feature`)
|
103
|
+
7. Create a new Pull Request
|
104
|
+
|
105
|
+
### Contributors
|
106
|
+
|
107
|
+
* Oliver Bertuch - [https://github.com/poikilotherm](https://github.com/poikilotherm)
|
62
108
|
|
63
109
|
## Testing
|
64
110
|
|
65
111
|
Still need to write tests... but they'll be using bundler and rspec.
|
66
112
|
|
113
|
+
__Note__ that developming vagrant plugins _requires_ ruby 2.0.0 or newer.
|
114
|
+
A `.ruby-version` is provided to get [rvm](https://rvm.io/workflow/projects)
|
115
|
+
to use 2.1.1.
|
116
|
+
|
117
|
+
For manual testing:
|
118
|
+
|
119
|
+
bundle install --path vendor
|
120
|
+
VAGRANT_LOG=debug bundle exec vagrant up
|
121
|
+
|
122
|
+
To use an existing project's Vagrantfile, you can just specify the directory that the Vagrantfile
|
123
|
+
is in using the ``VAGRANT_CWD`` environment variable (i.e. prepend ``VAGRANT_CWD=/path/to/project``
|
124
|
+
to the above command).
|
125
|
+
|
67
126
|
## Debugging
|
68
127
|
|
69
128
|
Exporting ``VAGRANT_LOG=debug`` will also turn on debug-level logging for r10k.
|
data/Rakefile
CHANGED
data/lib/vagrant-r10k/config.rb
CHANGED
@@ -3,10 +3,12 @@ module VagrantPlugins
|
|
3
3
|
class Config < Vagrant.plugin('2', :config)
|
4
4
|
attr_accessor :puppet_dir
|
5
5
|
attr_accessor :puppetfile_path
|
6
|
+
attr_accessor :module_path
|
6
7
|
|
7
8
|
def initialize
|
8
9
|
@puppet_dir = UNSET_VALUE
|
9
10
|
@puppetfile_path = UNSET_VALUE
|
11
|
+
@module_path = UNSET_VALUE
|
10
12
|
end
|
11
13
|
|
12
14
|
def validate(machine)
|
@@ -30,6 +32,11 @@ module VagrantPlugins
|
|
30
32
|
puppetfile = File.join(machine.env.root_path, puppetfile_path)
|
31
33
|
errors << "puppetfile '#{puppetfile}' does not exist" if !File.file?(puppetfile)
|
32
34
|
|
35
|
+
if module_path != UNSET_VALUE
|
36
|
+
module_path_path = File.join(machine.env.root_path, module_path)
|
37
|
+
errors << "module_path directory '#{module_path_path}' does not exist" if !File.directory?(module_path_path)
|
38
|
+
end
|
39
|
+
|
33
40
|
{ "vagrant-r10k" => errors }
|
34
41
|
end
|
35
42
|
|
@@ -50,17 +50,41 @@ module VagrantPlugins
|
|
50
50
|
end
|
51
51
|
|
52
52
|
puppetfile_path = File.join(env_dir, @env[:machine].config.r10k.puppetfile_path)
|
53
|
+
|
53
54
|
module_path = nil
|
55
|
+
# override the default mechanism for building a module_path with the optional config argument
|
56
|
+
if @env[:machine].config.r10k.module_path != unset
|
57
|
+
module_path = @env[:machine].config.r10k.module_path
|
58
|
+
end
|
59
|
+
|
54
60
|
manifest_file = nil
|
55
61
|
manifests_path = nil
|
56
62
|
@env[:machine].config.vm.provisioners.each do |prov|
|
57
63
|
if prov.name == :puppet
|
58
|
-
module_path
|
64
|
+
# if module_path has been set before, check if it fits to one defined in the provisioner config
|
65
|
+
if module_path != nil
|
66
|
+
if prov.config.module_path.is_a?(Array) and ! prov.config.module_path.include?(module_path)
|
67
|
+
@env[:ui].detail "vagrant-r10k: module_path \"#{module_path}\" is not within the ones defined in puppet provisioner; not running"
|
68
|
+
@app.call(env)
|
69
|
+
return
|
70
|
+
elsif ! prov.config.module_path.is_a?(Array) and prov.config.module_path != module_path
|
71
|
+
@env[:ui].detail "vagrant-r10k: module_path \"#{module_path}\" is not the same as in puppet provisioner; not running"
|
72
|
+
@app.call(env)
|
73
|
+
return
|
74
|
+
end
|
75
|
+
# no modulepath explict set in config, build one from the provisioner config
|
76
|
+
else
|
77
|
+
module_path = prov.config.module_path.is_a?(Array) ? prov.config.module_path[0] : prov.config.module_path
|
78
|
+
@env[:ui].info "vagrant-r10k: Building the r10k module path with puppet provisioner module_path \"#{module_path}\". (if module_path is an array, first element is used)"
|
79
|
+
end
|
80
|
+
|
59
81
|
manifest_file = File.join(env_dir, prov.config.manifest_file)
|
60
82
|
manifests_path = File.join(env_dir, prov.config.manifests_path[1])
|
61
83
|
end
|
62
84
|
end
|
63
85
|
|
86
|
+
# now join the module_path with the env_dir to have an absolute path
|
87
|
+
module_path = File.join(env_dir, module_path)
|
64
88
|
@env[:ui].info "vagrant-r10k: Beginning r10k deploy of puppet modules into #{module_path} using #{puppetfile_path}"
|
65
89
|
|
66
90
|
if ENV["VAGRANT_LOG"] == "debug"
|
data/lib/vagrant-r10k/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-r10k
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Antman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07
|
11
|
+
date: 2014-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: r10k
|
@@ -61,6 +61,7 @@ extensions: []
|
|
61
61
|
extra_rdoc_files: []
|
62
62
|
files:
|
63
63
|
- ".gitignore"
|
64
|
+
- ".ruby-version"
|
64
65
|
- Gemfile
|
65
66
|
- LICENSE.txt
|
66
67
|
- README.md
|