Class: Simp::Cli::Config::Item::RsyncBase

Inherits:
Simp::Cli::Config::Item show all
Defined in:
lib/simp/cli/config/item/rsync_base.rb

Instance Attribute Summary

Attributes inherited from Simp::Cli::Config::Item

#allow_user_apply, #config_items, #description, #die_on_apply_fail, #fact, #fail_on_missing_answer, #key, #next_items_tree, #silent, #skip_apply, #skip_query, #skip_yaml, #value

Instance Method Summary collapse

Methods inherited from Simp::Cli::Config::Item

#apply, #default_value, #highline_question_type, #next_items, #not_valid_message, #print_banner, #print_summary, #puppet_value, #query, #query_ask, #query_extras, #query_status, #safe_apply, #say_blue, #say_green, #say_red, #say_yellow, #to_yaml_s

Constructor Details

#initializeRsyncBase

Returns a new instance of RsyncBase.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/simp/cli/config/item/rsync_base.rb', line 9

def initialize
  super
  @key         = 'rsync::base'
  @description = <<-EOF.gsub(/^ {8}/,'')
    Several modules use rsync as a means of pulling down large
    collections of files. This provides a single point of configuration
    for the system defaults.

    Individual modules can be overridden as required.
  EOF
  if Facter.value('lsbmajdistrelease') < '7' then
    @base_dir = '/srv/rsync'
  else
    @base_dir = File.exists?( '/var/simp/' ) ? '/var/simp/rsync' : '/srv/simp/rsync'
    @base_dir = "#{@base_dir}/%{::operatingsystem}/%{::lsbmajdistrelease}"
  end
end

Instance Method Details

#os_valueObject



27
# File 'lib/simp/cli/config/item/rsync_base.rb', line 27

def os_value; nil; end


33
34
35
# File 'lib/simp/cli/config/item/rsync_base.rb', line 33

def recommended_value
  "#{@base_dir}"
end

#validate(x) ⇒ Object



29
30
31
# File 'lib/simp/cli/config/item/rsync_base.rb', line 29

def validate( x )
  x =~ %r{^/} ? true : false
end