Permalink
Browse files

Make it possible to omit the file system type for lmv::volume

Even though one would probably want to omit the file system type more
often than the size, I didn't dare to change the order of the parameters
in order to preserve backwards compatibility
  • Loading branch information...
zyv committed Aug 2, 2011
1 parent d92be18 commit ef07be24d5f98064bb6dda32592ddc82d4aba6ed
Showing with 11 additions and 2 deletions.
  1. +5 −0 README.markdown
  2. +6 −2 manifests/init.pp
View
@@ -40,6 +40,11 @@ be shortened to be:
volume("myvg", "/dev/hdc", "mylv", "ext3", "20G")
+If you want to omit the file system type, but still specify the size of the
+logical volume, i.e. in the case if you are planning on using this logical
+volume as a swap partition or a block device for a virtual machine image, you
+need to use a hash to pass the parameters to the definition.
+
If you need a more complex configuration, you'll need to build the
resources out yourself.
View
@@ -1,4 +1,4 @@
-define lvm::volume($vg, $pv, $fstype, $size = undef, $ensure) {
+define lvm::volume($vg, $pv, $fstype = undef, $size = undef, $ensure) {
case $ensure {
#
# Clean up the whole chain.
@@ -21,7 +21,11 @@
physical_volume { $pv: ensure => present }
volume_group { $vg: ensure => present, physical_volumes => $pv, require => Physical_volume[$pv] }
logical_volume { $name: ensure => present, volume_group => $vg, size => $size, require => Volume_group[$vg] }
- filesystem { "/dev/${vg}/${name}": ensure => present, fs_type => $fstype, require => Logical_volume[$name] }
+
+ if $fstype != undef {
+ filesystem { "/dev/${vg}/${name}": ensure => present, fs_type => $fstype, require => Logical_volume[$name] }
+ }
+
}
default: {
fail ( 'puppet-lvm::volume: ensure parameter can only be set to cleaned, absent or present' )

0 comments on commit ef07be2

Please sign in to comment.