puppet-swift/manifests/storage/mount.pp
Mathieu Gagné 178f4b18dc Various Puppet lint fixes
* Fix following warnings:
    * double quoted string containing no variables
    * indentation of => is not properly aligned
    * mode should be represented as a 4 digit octal value or symbolic mode
    * string containing only a variable
    * top-scope variable being used without an explicit namespace
    * unquoted file mode
    * variable not enclosed in {}
* Fix following errors:
    * trailing whitespace found
    * two-space soft tabs not used
* Remove quotes around class in include/require statements

Change-Id: Ia920d848e1955612a6486ec8731309e6d3a70f63
2013-08-02 11:51:57 -04:00

58 lines
1.3 KiB
Puppet

#
# Usage
# swift::storage::mount
#
#
define swift::storage::mount(
$device,
$mnt_base_dir = '/srv/node',
$loopback = false,
$fstype = 'xfs'
) {
if($loopback){
$options = 'noatime,nodiratime,nobarrier,loop'
} else {
$options = 'noatime,nodiratime,nobarrier'
}
if($fstype == 'xfs'){
$fsoptions = 'logbufs=8'
} else {
$fsoptions = 'user_xattr'
}
# the directory that represents the mount point
# needs to exist
file { "${mnt_base_dir}/${name}":
ensure => directory,
owner => 'swift',
group => 'swift',
}
mount { "${mnt_base_dir}/${name}":
ensure => present,
device => $device,
fstype => $fstype,
options => "${options},${fsoptions}",
require => File["${mnt_base_dir}/${name}"]
}
# double checks to make sure that things are mounted
exec { "mount_${name}":
command => "mount ${mnt_base_dir}/${name}",
path => ['/bin'],
require => Mount["${mnt_base_dir}/${name}"],
unless => "grep ${mnt_base_dir}/${name} /etc/mtab",
# TODO - this needs to be removed when I am done testing
logoutput => true,
}
exec { "fix_mount_permissions_${name}":
command => "chown -R swift:swift ${mnt_base_dir}/${name}",
path => ['/usr/sbin', '/bin'],
subscribe => Exec["mount_${name}"],
refreshonly => true,
}
}