Skip to content
This repository was archived by the owner on Dec 2, 2020. It is now read-only.

Commit b092b16

Browse files
committed
Merge pull request #53 from lattwood/master
Enable version selection for vagrant plugins
2 parents 2f0e977 + f866f1f commit b092b16

File tree

5 files changed

+28
-1
lines changed

5 files changed

+28
-1
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ vagrant::plugin { 'vagrant-vmware-fusion':
2929
}
3030
```
3131

32+
By default, the module will install the latest version of plugin. This behaviour can be overridden with the version paramter. The usage would look as follows:
33+
34+
```puppet
35+
vagrant::plugin { 'vagrant-berkshelf':
36+
version => '2.0.1'
37+
}
38+
```
39+
3240
Boxes
3341
--
3442

lib/puppet/provider/vagrant_plugin/vagrant_plugin.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ def create
3131
@resource[:name]
3232
]
3333

34+
cmd << '--plugin-version' << @resource[:version] unless @resource[:version] == 'latest'
35+
3436
execute cmd, opts
3537
end
3638

lib/puppet/type/vagrant_plugin.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
end
2525
end
2626

27+
newparam :version
28+
2729
autorequire :package do
2830
%w(Vagrant_1_4_2 vagrant)
2931
end

manifests/plugin.pp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
$ensure = 'present',
1111
$force = false,
1212
$license = undef,
13+
$version = latest
1314
) {
1415
require vagrant
1516

@@ -29,6 +30,7 @@
2930
}
3031

3132
vagrant_plugin { $plugin_name:
32-
ensure => $ensure
33+
ensure => $ensure,
34+
version => $version
3335
}
3436
}

spec/defines/vagrant__plugin_spec.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@
1919
end
2020
end
2121

22+
context 'version specified' do
23+
let(:title) { 'vagrant-berkshelf' }
24+
let(:params) do
25+
{
26+
:version => '2.0.1'
27+
}
28+
end
29+
30+
it do
31+
should contain_vagrant_plugin('vagrant-berkshelf').with_version('2.0.1')
32+
end
33+
end
34+
2235
context 'with license' do
2336
let(:title) { 'vmware-fusion' }
2437

0 commit comments

Comments
 (0)