Class: Simp::Cli::Config::Item::LdapMaster

Inherits:
Simp::Cli::Config::Item show all
Defined in:
lib/simp/cli/config/item/ldap_master.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, #os_value, #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

#initializeLdapMaster

Returns a new instance of LdapMaster.



10
11
12
13
14
# File 'lib/simp/cli/config/item/ldap_master.rb', line 10

def initialize
  super
  @key         = 'ldap::master'
  @description = %Q{This is the LDAP master in URI form (ldap://server)}
end

Instance Method Details



16
17
18
19
20
# File 'lib/simp/cli/config/item/ldap_master.rb', line 16

def recommended_value
  if item = @config_items.fetch( 'hostname', nil )
    "ldap://#{item.value}"
  end
end

#validate(item) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/simp/cli/config/item/ldap_master.rb', line 22

def validate item
  result = false
  if ( item =~ %r{^ldap://.+} ) ? true : false
    i = item.sub( %r{^ldap://}, '' )
    result = ( Simp::Cli::Config::Utils.validate_hostname( i ) ||
               Simp::Cli::Config::Utils.validate_fqdn( i )     ||
               Simp::Cli::Config::Utils.validate_ip( i ) )
  end
  result
end