diff --git a/manifests/get.pp b/manifests/get.pp index 2d205db..9823e94 100644 --- a/manifests/get.pp +++ b/manifests/get.pp @@ -1,57 +1,62 @@ -# Definition: rsync::get -# -# get files via rsync -# -# Parameters: -# $source - source to copy from -# $path - path to copy to, defaults to $name -# $user - username on remote system -# $purge - if set, rsync will use '--delete' -# $exlude - string (or array) to be excluded -# $include - string (or array) to be included -# $exclude_first - if 'true' (default) then first exclude and then include; the other way around if 'false' -# $keyfile - path to ssh key used to connect to remote host, defaults to /home/${user}/.ssh/id_rsa -# $timeout - timeout in seconds, defaults to 900 -# $options - default options to pass to rsync (-a) -# $chown - ownership to pass to rsync (optional; requires rsync 3.1.0+) -# $chmod - permissions to pass to rsync (optional) -# $logfile - logname to pass to rsync (optional) -# $onlyif - Condition to run the rsync command -# -# Actions: +# @summary # get files via rsync # -# Requires: -# $source must be set -# -# Sample Usage: +# @param source +# source to copy from +# @param path +# path to copy to, defaults to $name +# @param user +# username on remote system +# @param purge +# if set, rsync will use '--delete' +# @param exclude +# Path or paths to be exclude +# @param include +# Path or paths to include +# @param exclude_first +# if 'true' (default) then first exclude and then include; the other way around if 'false' +# @param keyfile +# path to ssh key used to connect to remote host, defaults to /home/${user}/.ssh/id_rsa +# @param timeout +# timeout in seconds, defaults to 900 +# @param options +# default options to pass to rsync (-a) +# @param chown +# ownership to pass to rsync (requires rsync 3.1.0+) +# @param chmod +# permissions to pass to rsync +# @param logfile +# logname to pass to rsync +# @param onlyif +# Condition to run the rsync command # +# @example Sync from a source # rsync::get { '/foo': # source => "rsync://${rsyncServer}/repo/foo/", # require => File['/foo'], -# } # rsync +# } # define rsync::get ( - $source, - $path = $name, - $user = undef, - $purge = undef, - $recursive = undef, - $links = undef, - $hardlinks = undef, - $copylinks = undef, - $times = undef, - $include = undef, - $exclude = undef, - $exclude_first = true, - $keyfile = undef, - $timeout = '900', - $execuser = 'root', - $options = '-a', - $chown = undef, - $chmod = undef, - $logfile = undef, - $onlyif = undef, + String[1] $source, + String[1] $path = $name, + Optional[String[1]] $user = undef, + Boolean $purge = false, + Boolean $recursive = false, + Boolean $links = false, + Boolean $hardlinks = false, + Boolean $copylinks = false, + Boolean $times = false, + Variant[Array[String[1]], String[1]] $include = [], + Variant[Array[String[1]], String[1]] $exclude = [], + Boolean $exclude_first = true, + Optional[String[1]] $keyfile = undef, + Integer[0] $timeout = 900, + String[1] $execuser = 'root', + Array[String[1]] $options = ['-a'], + Optional[String[1]] $chown = undef, + Optional[String[1]] $chmod = undef, + Optional[String[1]] $logfile = undef, + Variant[Undef, String[1], Array[String[1]]] $onlyif = undef, ) { if $keyfile { $mykeyfile = $keyfile @@ -60,100 +65,89 @@ } if $user { - $myuser = "-e 'ssh -i ${mykeyfile} -l ${user}' ${user}@" + $myuseropt = ['-e', "'ssh -i ${mykeyfile} -l ${user}'"] + $myuser = "${user}@" } else { - $myuser = undef + $myuseropt = [] + $myuser = '' } if $purge { - $mypurge = '--delete' - } else { - $mypurge = undef - } - - if $exclude { - $myexclude = join(prefix(flatten([$exclude]), '--exclude='), ' ') + $mypurge = ['--delete'] } else { - $myexclude = undef + $mypurge = [] } - if $include { - $myinclude = join(prefix(flatten([$include]), '--include='), ' ') - } else { - $myinclude = undef - } + $myexclude = prefix(any2array($exclude), '--exclude=') + $myinclude = prefix(any2array($include), '--include=') if $recursive { - $myrecursive = '-r' + $myrecursive = ['-r'] } else { - $myrecursive = undef + $myrecursive = [] } if $links { - $mylinks = '--links' + $mylinks = ['--links'] } else { - $mylinks = undef + $mylinks = [] } if $hardlinks { - $myhardlinks = '--hard-links' + $myhardlinks = ['--hard-links'] } else { - $myhardlinks = undef + $myhardlinks = [] } if $copylinks { - $mycopylinks = '--copy-links' + $mycopylinks = ['--copy-links'] } else { - $mycopylinks = undef + $mycopylinks = [] } if $times { - $mytimes = '--times' + $mytimes = ['--times'] } else { - $mytimes = undef + $mytimes = [] } if $chown { - $mychown = "--chown=${chown}" + $mychown = ["--chown=${chown}"] } else { - $mychown = undef + $mychown = [] } if $chmod { - $mychmod = "--chmod=${chmod}" + $mychmod = ["--chmod=${chmod}"] } else { - $mychmod = undef + $mychmod = [] } if $logfile { - $mylogfile = "--log-file=${logfile}" + $mylogfile = ["--log-file=${logfile}"] } else { - $mylogfile = undef + $mylogfile = [] } - if $include or $exclude { - if $exclude_first { - $excludeandinclude = join(delete_undef_values([$myexclude, $myinclude]), ' ') - } else { - $excludeandinclude = join(delete_undef_values([$myinclude, $myexclude]), ' ') - } + if $exclude_first { + $excludeandinclude = $myexclude + $myinclude } else { - $excludeandinclude = undef + $excludeandinclude = $myinclude + $myexclude } - $rsync_options = join( - delete_undef_values([$options, $mypurge, $excludeandinclude, $mylinks, $myhardlinks, $mycopylinks, $mytimes, - $myrecursive, $mychown, $mychmod, $mylogfile, "${myuser}${source}", $path]), ' ') + $rsync_options = $options + $mypurge + $excludeandinclude + $mylinks + $myhardlinks + $mycopylinks + $mytimes + $myrecursive + $mychown + $mychmod + $mylogfile + $myuseropt + ["${myuser}${source}", $path] + $command = ['rsync' + '-q'] + $rsync_options + $rsync_options_str = join($rsync_options, ' ') - if !$onlyif { - $onlyif_real = "test `rsync --dry-run --itemize-changes ${rsync_options} | wc -l` -gt 0" - } else { + if $onlyif { $onlyif_real = $onlyif + } else { + # TODO: add dry run to $command? + $onlyif_real = "test `rsync --dry-run --itemize-changes ${rsync_options_str} | wc -l` -gt 0" } - exec { "rsync ${name}": - command => "rsync -q ${rsync_options}", + command => $command, path => ['/bin', '/usr/bin', '/usr/local/bin'], user => $execuser, # perform a dry-run to determine if anything needs to be updated diff --git a/manifests/init.pp b/manifests/init.pp index 22ca262..1657ddd 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,12 +1,19 @@ -# Class: rsync +# @summary manage rsync # -# This module manages rsync +# @param package_ensure +# ensure state of the rsync package +# @param manage_package +# if true, manage the rsync package +# @param puts +# create rsync::puts defined type resources +# @param gets +# create rsync::gets defined type resources # class rsync ( - $package_ensure = 'installed', - $manage_package = true, - $puts = {}, - $gets = {}, + String $package_ensure = 'installed', + Boolean $manage_package = true, + Hash $puts = {}, + Hash $gets = {}, ) { if $manage_package { package { 'rsync': diff --git a/manifests/put.pp b/manifests/put.pp index 53038d0..1c7da73 100644 --- a/manifests/put.pp +++ b/manifests/put.pp @@ -1,42 +1,44 @@ -# Definition: rsync::put -# -# put files via rsync -# -# Parameters: -# $source - source to copy from -# $path - path to copy to, defaults to $name -# $user - username on remote system -# $purge - if set, rsync will use '--delete' -# $exlude - string (or array) to be excluded -# $include - string (or array) to be included -# $exclude_first - if 'true' then first exclude and then include; the other way around if 'false' -# $keyfile - path to ssh key used to connect to remote host, defaults to /home/${user}/.ssh/id_rsa -# $timeout - timeout in seconds, defaults to 900 -# -# Actions: +# @summary # put files via rsync # -# Requires: -# $source must be set -# -# Sample Usage: +# @param source +# source to copy from +# @param path +# path to copy to, defaults to $name +# @param user +# username on remote system +# @param purge +# if set, rsync will use '--delete' +# @param exlude +# Path or paths to be exclude +# @param include +# Path or paths to be included +# @param exclude_first +# if 'true' (default) then first exclude and then include; the other way around if 'false' +# @param keyfile +# path to ssh key used to connect to remote host, defaults to /home/${user}/.ssh/id_rsa +# @param timeout +# timeout in seconds, defaults to 900 +# @param options +# default options to pass to rsync (-a) # +# @example Sync to remote # rsync::put { '${rsyncDestHost}:/repo/foo': # user => 'user', # source => "/repo/foo/", # } # rsync # define rsync::put ( - $source, - $path = undef, - $user = undef, - $purge = undef, - $exclude = undef, - $include = undef, - $exclude_first = true, - $keyfile = undef, - $timeout = '900', - $options = '-a' + String[1] $source, + String[1] $path = $name, + Optional[String[1]] $user = undef, + Boolean $purge = false, + Variant[Array[String[1]], String[1]] $exclude = [], + Variant[Array[String[1]], String[1]] $include = [], + Boolean $exclude_first = true, + Optional[String[1]] $keyfile = undef, + Integer[0] $timeout = 900, + Array[String[1]] $options = ['-a'], ) { if $keyfile { $mykeyfile = $keyfile @@ -45,52 +47,34 @@ } if $user { - $myuseropt = "-e 'ssh -i ${mykeyfile} -l ${user}'" + $myuseropt = ['-e', "'ssh -i ${mykeyfile} -l ${user}'"] $myuser = "${user}@" } else { - $myuseropt = undef - $myuser = undef + $myuseropt = [] + $myuser = '' } if $purge { - $mypurge = '--delete' - } else { - $mypurge = undef - } - - if $exclude { - $myexclude = join(prefix(flatten([$exclude]), '--exclude='), ' ') - } else { - $myexclude = undef - } - - if $include { - $myinclude = join(prefix(flatten([$include]), '--include='), ' ') + $mypurge = ['--delete'] } else { - $myinclude = undef + $mypurge = [] } - if $include or $exclude { - if $exclude_first { - $excludeandinclude = join(delete_undef_values([$myexclude, $myinclude]), ' ') - } else { - $excludeandinclude = join(delete_undef_values([$myinclude, $myexclude]), ' ') - } - } else { - $excludeandinclude = undef - } + $myexclude = prefix(flatten([$exclude]), '--exclude=') + $myinclude = prefix(flatten([$include]), '--include=') - if $path { - $mypath = $path + if $exclude_first { + $excludeandinclude = $myexclude + $myinclude } else { - $mypath = $name + $excludeandinclude = $myinclude + $myexclude } - $rsync_options = join( - delete_undef_values([$options, $mypurge, $excludeandinclude, $myuseropt, $source, "${myuser}${mypath}"]), ' ') + $rsync_options = $options + $mypurge + $excludeandinclude + $myuseropt + [$source, "${myuser}${path}"] + $command = ['rsync' + '-q'] + $rsync_options + $rsync_options_str = join($rsync_options, ' ') exec { "rsync ${name}": - command => "rsync -q ${rsync_options}", + command => $command, path => ['/bin', '/usr/bin'], # perform a dry-run to determine if anything needs to be updated # this ensures that we only actually create a Puppet event if something needs to @@ -98,7 +82,7 @@ # TODO - it may make senes to do an actual run here (instead of a dry run) # and relace the command with an echo statement or something to ensure # that we only actually run rsync once - onlyif => "test `rsync --dry-run --itemize-changes ${rsync_options} | wc -l` -gt 0", + onlyif => "test `rsync --dry-run --itemize-changes ${rsync_options_str} | wc -l` -gt 0", timeout => $timeout, } } diff --git a/manifests/repo.pp b/manifests/repo.pp index 2b88f9e..f599e30 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -1,9 +1,5 @@ -# Class: rsync::repo -# -# This module creates a rsync repository -# -# Requires: -# class rsync::server +# @summary +# Create a rsync repository # class rsync::repo { diff --git a/manifests/server.pp b/manifests/server.pp index 9496706..03ff58d 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -1,26 +1,51 @@ -# Class: rsync::server +# @sumnmary +# The rsync server. Supports both standard rsync as well as rsync over ssh # -# The rsync server. Supports both standard rsync as well as rsync over ssh -# -# Requires: -# class xinetd if use_xinetd is set to true -# class rsync +# @param use_xinetd +# use xinetd. If true the xinetd class is required. +# @param address +# the address to bind +# @param motd_file +# message of the day to display to clients on each connet. +# use 'UNSET' to disable the message +# @param pid_file +# path of the pid file. Use 'UNSET' to disable pid file +# @use_chroot +# chroot to the path before starting the file transfer +# @param uid +# user name or user id that file transfers to and from +# @param gid +# group name or group id that file transfers to and from +# @param modules +# create rsync::server::module defined type resources +# @param package_name +# name of the rsync server package +# @param conf_file +# path to the config file +# @param servicename +# name of the rsync server service +# @param service_ensure +# ensure status of the rsync server service +# @param service_enable +# enable the rsync server service +# @param manage_package +# manage the rsync server package # class rsync::server ( - Boolean $use_xinetd = true, - $address = '0.0.0.0', - $motd_file = 'UNSET', + Boolean $use_xinetd = true, + String[1] $address = '0.0.0.0', + String[1] $motd_file = 'UNSET', Variant[Enum['UNSET'], Stdlib::Absolutepath] $pid_file = '/var/run/rsyncd.pid', - $use_chroot = 'yes', - $uid = 'nobody', - $gid = 'nobody', - $modules = {}, - Optional[String[1]] $package_name = undef, - String[1] $conf_file = '/etc/rsync.conf', - String[1] $servicename = 'rsync', - Stdlib::Ensure::Service $service_ensure = 'running', - Variant[Boolean, Enum['mask']] $service_enable = true, - Boolean $manage_package = $rsync::manage_package, + Boolean $use_chroot = true, + String[1] $uid = 'nobody', + String[1] $gid = 'nobody', + Hash $modules = {}, + Optional[String[1]] $package_name = undef, + Stdlib::Absolutepath $conf_file = '/etc/rsync.conf', + String[1] $servicename = 'rsync', + Stdlib::Ensure::Service $service_ensure = 'running', + Variant[Boolean, Enum['mask']] $service_enable = true, + Boolean $manage_package = $rsync::manage_package, ) inherits rsync { if $use_xinetd { include xinetd diff --git a/manifests/server/module.pp b/manifests/server/module.pp index 972e4d6..9f198ec 100644 --- a/manifests/server/module.pp +++ b/manifests/server/module.pp @@ -1,84 +1,106 @@ -# Definition: rsync::server::module +# @summary +# sets up a rsync server # -# sets up a rsync server +# @param path +# path to data +# @param order +# order of concat resource +# @param comment +# rsync comment +# @param use_chroot +# use chroot during file transfer +# @param read_only +# whether clients will be able to upload files or not +# @param write_only +# whether clients will be able to download files or not +# @param list +# if the module should be listed when the client asks for a listing of available modules. +# @param uid +# uid of rsync server +# @param gid +# gid of rsync server +# @param numeric_ids +# Don't resolve uids to usernames +# @param ignore_nonreadable +# do not display files the daemon cannot read. +# @param incoming_chmod +# incoming file mode +# @param outgoing_chmod +# outgoing file mode +# @param max_connections +# maximum number of simultaneous connections allowed +# @param lock_file +# file used to support the max connections parameter +# only needed if max_connections > 0 +# @param secrets_file +# path to the file that contains the username:password pairs used for authenticating this module +# @param auth_users +# list of usernames that will be allowed to connect to this module (must be undef or an array) +# @param hosts_allow +# list of patterns allowed to connect to this module (man 5 rsyncd.conf for details, must be undef or an array) +# @param hosts_deny +# list of patterns allowed to connect to this module (man 5 rsyncd.conf for details, must be undef or an array) +# @param timeout +# disconnect client after X seconds of inactivity +# @param transfer_logging +# parameter enables per-file logging of downloads and +# uploads in a format somewhat similar to that used by ftp daemons. +# @param log_format +# This parameter allows you to specify the format used +# for logging file transfers when transfer logging is enabled. See the +# rsyncd.conf documentation for more details. +# @param log_file +# log messages to the indicated file rather than using syslog +# @param refuse_options +# list of rsync command line options that will be refused by your rsync daemon. +# @param include +# list of files to include +# @param include_from +# file containing a list of files to include +# @param exclude +# list of files to exclude +# @param exclude_from +# file containing a list of files to exclude +# @param dont_compress +# disable compression on matching files # -# Parameters: -# $path - path to data -# $comment - rsync comment -# $use_chroot - yes||no, defaults to undef -# $read_only - yes||no, defaults to yes -# $write_only - yes||no, defaults to no -# $list - yes||no, defaults to yes -# $uid - uid of rsync server -# $gid - gid of rsync server -# $numeric_ids - yes||no, don't resolve uids to usernames, defaults to undef -# $ignore_nonreadable - do not display files the daemon cannot read, defaults to yes -# $incoming_chmod - incoming file mode -# $outgoing_chmod - outgoing file mode -# $max_connections - maximum number of simultaneous connections allowed, defaults to 0 -# $lock_file - file used to support the max connections parameter, defaults to /var/run/rsyncd.lock -# only needed if max_connections > 0 -# $secrets_file - path to the file that contains the username:password pairs used for authenticating this module -# $auth_users - list of usernames that will be allowed to connect to this module (must be undef or an array) -# $hosts_allow - list of patterns allowed to connect to this module (man 5 rsyncd.conf for details, must be undef or an array) -# $hosts_deny - list of patterns allowed to connect to this module (man 5 rsyncd.conf for details, must be undef or an array) -# $timeout - disconnect client after X seconds of inactivity, defaults to 0 -# $transfer_logging - parameter enables per-file logging of downloads and -# uploads in a format somewhat similar to that used by ftp daemons. -# $log_format - This parameter allows you to specify the format used -# for logging file transfers when transfer logging is enabled. See the -# rsyncd.conf documentation for more details. -# $log_file - log messages to the indicated file rather than using syslog -# $refuse_options - list of rsync command line options that will be refused by your rsync daemon. -# $include - list of files to include -# $include_from - file containing a list of files to include -# $exclude - list of files to exclude -# $exclude_from - file containing a list of files to exclude -# $dont_compress - disable compression on matching files -# -# sets up an rsync server -# -# Requires: -# $path must be set -# -# Sample Usage: -# # setup default rsync repository +# @example setup default rsync repository # rsync::server::module { 'repo': # path => $base, # require => File[$base], # } # define rsync::server::module ( - $path, - $order = "10_${name}", - $comment = undef, - $use_chroot = undef, - $read_only = 'yes', - $write_only = 'no', - $list = 'yes', - $uid = undef, - $gid = undef, - $numeric_ids = undef, - $incoming_chmod = undef, - $outgoing_chmod = undef, - $max_connections = '0', - $timeout = '0', - $lock_file = '/var/run/rsyncd.lock', - $secrets_file = undef, - $auth_users = undef, - $hosts_allow = undef, - $hosts_deny = undef, - $transfer_logging = undef, - $log_file = undef, - $log_format = undef, - $refuse_options = undef, - $include = undef, - $include_from = undef, - $exclude = undef, - $exclude_from = undef, - $dont_compress = undef, - $ignore_nonreadable = undef) { - + String[1] $path, + String[1] $order = "10_${name}", + Optional[String[1]] $comment = undef, + Optional[Boolean] $use_chroot = undef, + Boolean $read_only = true, + Boolean $write_only = false, + Boolean $list = true, + Optional[String[1]] $uid = undef, + Optional[String[1]] $gid = undef, + Optional[Boolean] $numeric_ids = undef, + Optional[String[1]] $incoming_chmod = undef, + Optional[String[1]] $outgoing_chmod = undef, + Integer[0] $max_connections = 0, + Integer[0] $timeout = 0, + Stdlib::Absolutepath $lock_file = '/var/run/rsyncd.lock', + Optional[Stdlib::Absolutepath] $secrets_file = undef, + Optional[Array[String[1]]] $auth_users = undef, + Optional[Array[String[1]]] $hosts_allow = undef, + Optional[Array[String[1]]] $hosts_deny = undef, + Optional[Boolean] $transfer_logging = undef, + Optional[Stdlib::Absolutepath] $log_file = undef, + Optional[String[1]] $log_format = undef, + Optional[Array[String[1]]] $refuse_options = undef, + Optional[Array[String[1]]] $include = undef, + Optional[String[1]] $include_from = undef, + Optional[Array[String[1]]] $exclude = undef, + Optional[String[1]] $exclude_from = undef, + Optional[Array[String[1]]] $dont_compress = undef, + Optional[Boolean] $ignore_nonreadable = undef +) { concat::fragment { "frag-${name}": content => template('rsync/module.erb'), target => $rsync::server::conf_file, diff --git a/spec/classes/server_spec.rb b/spec/classes/server_spec.rb index 837b038..29a784a 100644 --- a/spec/classes/server_spec.rb +++ b/spec/classes/server_spec.rb @@ -42,7 +42,7 @@ describe 'when setting an motd' do let :params do - { motd_file: true } + { motd_file: 'foo' } end it { @@ -62,7 +62,7 @@ describe 'when overriding use_chroot' do let :params do - { use_chroot: 'no' } + { use_chroot: false } end it { diff --git a/spec/defines/server_module_spec.rb b/spec/defines/server_module_spec.rb index d5ec588..42b09d1 100644 --- a/spec/defines/server_module_spec.rb +++ b/spec/defines/server_module_spec.rb @@ -77,21 +77,21 @@ { comment: 'super module !', - read_only: 'no', - write_only: 'yes', - use_chroot: 'no', - list: 'no', + read_only: false, + write_only: true, + use_chroot: false, + list: false, uid: '4682', gid: '4682', - numeric_ids: 'no', + numeric_ids: false, incoming_chmod: '0777', outgoing_chmod: '0777', - max_connections: '10', - timeout: '10', + max_connections: 10, + timeout: 10, secrets_file: '/path/to/secrets', hosts_allow: ['localhost', '169.254.42.51'], hosts_deny: ['some-host.example.com', '10.0.0.128'], - transfer_logging: 'true', + transfer_logging: true, log_format: '%t %a %m %f %b', refuse_options: ['c', 'delete'], include: ['a', 'b'], @@ -99,7 +99,7 @@ include_from: '/path/to/file', exclude_from: '/path/to/otherfile', dont_compress: ['a', 'b'], - ignore_nonreadable: 'yes', + ignore_nonreadable: true, }.each_pair do |k, v| describe "when overriding #{k}" do let :params do diff --git a/templates/header.erb b/templates/header.erb index bd7756c..e325b9d 100644 --- a/templates/header.erb +++ b/templates/header.erb @@ -6,7 +6,7 @@ pid file = <%= @pid_file %> <% end -%> uid = <%= @uid %> gid = <%= @gid %> -use chroot = <%= @use_chroot %> +use chroot = <% if @use_chroot %>yes<% else %>no<% end %> log format = %t %a %m %f %b syslog facility = local3 timeout = 300 diff --git a/templates/module.erb b/templates/module.erb index f1dee10..53b8432 100644 --- a/templates/module.erb +++ b/templates/module.erb @@ -1,19 +1,19 @@ [ <%= @name %> ] path = <%= @path %> -read only = <%= @read_only %> -write only = <%= @write_only %> -list = <%= @list %> +read only = <% if @read_only %>yes<% else %>no<% end %> +write only = <% if @write_only %>yes<% else %>no<% end %> +list = <% if @list %>yes<% else %>no<% end %> <% if @uid -%> uid = <%= @uid %> <% end -%> <% if @gid -%> gid = <%= @gid %> <% end -%> -<% if @numeric_ids -%> -numeric ids = <%= @numeric_ids %> +<% if !@numeric_ids.nil? -%> +numeric ids = <% if @numeric_ids %>yes<% else %>no<% end %> <% end -%> -<% if @use_chroot -%> -use chroot = <%= @use_chroot %> +<% if !@use_chroot.nil? -%> +use chroot = <% if @use_chroot %>yes<% else %>no<% end %> <% end -%> <% if @incoming_chmod -%> incoming chmod = <%= @incoming_chmod %> @@ -27,7 +27,7 @@ max connections = <%= @max_connections %> <% if @timeout -%> timeout = <%= @timeout %> <% end -%> -<% if Integer(@max_connections) > 0 -%> +<% if @max_connections > 0 -%> lock file = <%= @lock_file %> <% end -%> <% if @comment -%> @@ -45,8 +45,8 @@ hosts allow = <%= Array(@hosts_allow).join(' ')%> <% if @hosts_deny -%> hosts deny = <%= Array(@hosts_deny).join(' ')%> <% end -%> -<% if @transfer_logging -%> -transfer logging = <%= @transfer_logging %> +<% if !@transfer_logging.nil? -%> +transfer logging = <% if @transfer_logging %>yes<% else %>no<% end %> <% end -%> <% if @log_format -%> log format = <%= @log_format %> @@ -54,8 +54,8 @@ log format = <%= @log_format %> <% if @refuse_options -%> refuse options = <%= Array(@refuse_options).join(' ')%> <% end -%> -<% if @ignore_nonreadable -%> -ignore nonreadable = <%= @ignore_nonreadable %> +<% if !@ignore_nonreadable.nil? -%> +ignore nonreadable = <% if @ignore_nonreadable %>yes<% else %>no<% end %> <% end -%> <% if @log_file -%> log file = <%= @log_file %>