blob: 6f04bddd84e3d809823474973731b63c12ccabb2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
module Puppet
newtype(:zfs) do
@doc = "Manage zfs. Create destroy and set properties on zfs instances.
**Autorequires:** If Puppet is managing the zpool at the root of this zfs instance, the zfs resource will autorequire it. If Puppet is managing any parent zfs instances, the zfs resource will autorequire them."
ensurable
newparam(:name) do
desc "The full name for this filesystem. (including the zpool)"
end
newproperty(:mountpoint) do
desc "The mountpoint property."
end
newproperty(:compression) do
desc "The compression property."
end
newproperty(:copies) do
desc "The copies property."
end
newproperty(:quota) do
desc "The quota property."
end
newproperty(:reservation) do
desc "The reservation property."
end
newproperty(:sharenfs) do
desc "The sharenfs property."
end
newproperty(:snapdir) do
desc "The snapdir property."
end
autorequire(:zpool) do
#strip the zpool off the zfs name and autorequire it
[@parameters[:name].value.split('/')[0]]
end
autorequire(:zfs) do
#slice and dice, we want all the zfs before this one
names = @parameters[:name].value.split('/')
names.slice(1..-2).inject([]) { |a,v| a << "#{a.last}/#{v}" }.collect { |fs| names[0] + fs }
end
end
end
|