lib/backup/database/openldap.rb in backup-4.4.1 vs lib/backup/database/openldap.rb in backup-5.0.0.beta.1
- old
+ new
@@ -1,7 +1,5 @@
-# encoding: utf-8
-
module Backup
module Database
class OpenLDAP < Base
class Error < Backup::Error; end
@@ -31,36 +29,36 @@
# Takes the name of the archive and the configuration block
def initialize(model, database_id = nil, &block)
super
instance_eval(&block) if block_given?
- @name ||= 'ldap_backup'
+ @name ||= "ldap_backup"
@use_sudo ||= false
- @slapcat_args ||= Array.new
+ @slapcat_args ||= []
@slapcat_utility ||= utility(:slapcat)
- @slapcat_conf ||= '/etc/ldap/slapd.d'
+ @slapcat_conf ||= "/etc/ldap/slapd.d"
end
##
# Performs the slapcat command and outputs the
# data to the specified path based on the 'trigger'
def perform!
super
pipeline = Pipeline.new
- dump_ext = 'ldif'
+ dump_ext = "ldif"
pipeline << slapcat
if @model.compressor
@model.compressor.compress_with do |command, ext|
pipeline << command
dump_ext << ext
end
end
- pipeline << "#{ utility(:cat) } > " +
- "'#{ File.join(dump_path, dump_filename) }.#{ dump_ext }'"
+ pipeline << "#{utility(:cat)} > " \
+ "'#{File.join(dump_path, dump_filename)}.#{dump_ext}'"
pipeline.run
if pipeline.success?
log!(:finished)
else
@@ -71,11 +69,11 @@
private
##
# Builds the full slapcat string based on all attributes
def slapcat
- command = "#{ slapcat_utility } #{ slapcat_conf_option } #{ slapcat_conf } #{ user_options }"
+ command = "#{slapcat_utility} #{slapcat_conf_option} #{slapcat_conf} #{user_options}"
command.prepend("sudo ") if use_sudo
command
end
##
@@ -86,10 +84,10 @@
##
# Builds a compatible string for the additional options
# specified by the user
def user_options
- slapcat_args.join(' ')
+ slapcat_args.join(" ")
end
end
end
end