Skip to content

Commit 1ed696b

Browse files
David HollingerDavid Hollinger
authored andcommitted
MODULES-4753 Add swapon command to filesystem provider
When the exec resources were removed from the lvm::logical_volume defined type, it created a gap wherein a NEW swap lvm would not be loaded into swap after being created. To solve this issue, I added the swapon command and logic that will run that command against the filesystem resource if the fs_type parameter is set to 'swap'
1 parent f9bda67 commit 1ed696b

File tree

1 file changed

+7
-4
lines changed
  • lib/puppet/provider/filesystem

1 file changed

+7
-4
lines changed

lib/puppet/provider/filesystem/lvm.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Puppet::Type.type(:filesystem).provide :lvm do
22
desc "Manages filesystem of a logical volume"
33

4-
commands :blkid => 'blkid'
4+
commands :blkid => 'blkid', :swapon => 'swapon'
55

66
def create
7-
mkfs(@resource[:fs_type])
7+
mkfs(@resource[:fs_type], @resource[:name])
88
end
99

1010
def exists?
@@ -21,7 +21,7 @@ def fstype
2121
nil
2222
end
2323

24-
def mkfs(fs_type)
24+
def mkfs(fs_type, name)
2525
mkfs_params = { "reiserfs" => "-q" }
2626

2727
mkfs_cmd = @resource[:mkfs_cmd] != nil ?
@@ -33,7 +33,7 @@ def mkfs(fs_type)
3333
["mkfs.#{fs_type}"]
3434
end
3535

36-
mkfs_cmd << @resource[:name]
36+
mkfs_cmd << name
3737

3838
if mkfs_params[fs_type]
3939
mkfs_cmd << mkfs_params[fs_type]
@@ -45,6 +45,9 @@ def mkfs(fs_type)
4545
end
4646

4747
execute mkfs_cmd
48+
if fs_type == 'swap'
49+
swapon(name)
50+
end
4851
end
4952

5053
end

0 commit comments

Comments
 (0)