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

Commit 6728b7b

Browse files
committed
Merge pull request #58 from mhaylock/support_plugins_without_prefix
Make prefixing of plugin names optional
2 parents 533a7c6 + b1a79c7 commit 6728b7b

File tree

4 files changed

+29
-8
lines changed

4 files changed

+29
-8
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@ vagrant::plugin { 'vagrant-berkshelf':
3737
}
3838
```
3939

40+
By default, the module will prefix any plugin name that is missing the `vagrant-` prefix. e.g:
41+
42+
```puppet
43+
vagrant::plugin { 'berkshelf': } # Resolves to vagrant-berkshelf
44+
```
45+
46+
Some plugins such as [sahara](https://github.com/jedi4ever/sahara) do not use this prefix. You can override the automatic prefix behaviour with the prefix parameter. The usage would look as follows:
47+
48+
```puppet
49+
vagrant::plugin { 'sahara':
50+
prefix => false
51+
}
52+
```
53+
4054
Boxes
4155
--
4256

lib/puppet/type/vagrant_plugin.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@
1818

1919
newparam :name do
2020
isnamevar
21-
22-
validate do |value|
23-
unless value =~ /\Avagrant-\w+(-\w+)*\z/
24-
raise Puppet::Error, "Invalid value for name: #{value}"
25-
end
26-
end
2721
end
2822

2923
newparam :user do

manifests/plugin.pp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
$ensure = 'present',
1111
$force = false,
1212
$license = undef,
13-
$version = latest
13+
$version = latest,
14+
$prefix = true
1415
) {
1516
require vagrant
1617

17-
if $name =~ /^vagrant-/ {
18+
if !$prefix or $name =~ /^vagrant-/ {
1819
$plugin_name = $name
1920
} else {
2021
$plugin_name = "vagrant-${name}"

spec/defines/vagrant__plugin_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@
1717
it do
1818
should contain_vagrant_plugin('vagrant-vmware-fusion')
1919
end
20+
21+
context 'prefix is false' do
22+
let(:params) do
23+
{
24+
:prefix => false
25+
}
26+
end
27+
28+
it do
29+
should contain_vagrant_plugin('vmware-fusion')
30+
end
31+
end
2032
end
2133

2234
context 'version specified' do

0 commit comments

Comments
 (0)