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

Commit

Permalink
Merge pull request #53 from lattwood/master
Browse files Browse the repository at this point in the history
Enable version selection for vagrant plugins
  • Loading branch information
jhaals committed Sep 7, 2014
2 parents 2f0e977 + f866f1f commit b092b16
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ vagrant::plugin { 'vagrant-vmware-fusion':
}
```

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:

```puppet
vagrant::plugin { 'vagrant-berkshelf':
version => '2.0.1'
}
```

Boxes
--

Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/vagrant_plugin/vagrant_plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def create
@resource[:name]
]

cmd << '--plugin-version' << @resource[:version] unless @resource[:version] == 'latest'

execute cmd, opts
end

Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/vagrant_plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
end
end

newparam :version

autorequire :package do
%w(Vagrant_1_4_2 vagrant)
end
Expand Down
4 changes: 3 additions & 1 deletion manifests/plugin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
$ensure = 'present',
$force = false,
$license = undef,
$version = latest
) {
require vagrant

Expand All @@ -29,6 +30,7 @@
}

vagrant_plugin { $plugin_name:
ensure => $ensure
ensure => $ensure,
version => $version
}
}
13 changes: 13 additions & 0 deletions spec/defines/vagrant__plugin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@
end
end

context 'version specified' do
let(:title) { 'vagrant-berkshelf' }
let(:params) do
{
:version => '2.0.1'
}
end

it do
should contain_vagrant_plugin('vagrant-berkshelf').with_version('2.0.1')
end
end

context 'with license' do
let(:title) { 'vmware-fusion' }

Expand Down

0 comments on commit b092b16

Please sign in to comment.