attr_reader :identity, :daemonize, :connector, :securityprovider, :factsource
attr_reader :registration, :registerinterval, :classesfile
attr_reader :rpcauditprovider, :rpcaudit, :configdir, :rpcauthprovider
- attr_reader :rpcauthorization, :color, :configfile, :rpchelptemplate
+ attr_reader :rpcauthorization, :color, :configfile
attr_reader :rpclimitmethod, :logger_type, :fact_cache_time, :collectives
attr_reader :main_collective, :ssl_cipher, :registration_collective
- attr_reader :direct_addressing, :direct_addressing_threshold, :ttl, :helptemplatedir
+ attr_reader :direct_addressing, :direct_addressing_threshold, :ttl
attr_reader :default_discovery_method, :default_discovery_options
+ attr_reader :publish_timeout, :threaded
def initialize
@configured = false
unless line =~ /^#|^$/
if (line =~ /(.+?)\s*=\s*(.+)/)
- key = $1
+ key = $1.strip
val = $2
case key
when "identity"
@identity = val
when "direct_addressing"
- @direct_addressing = false unless val =~ /^1|y/i
+ @direct_addressing = Util.str_to_bool(val)
when "direct_addressing_threshold"
@direct_addressing_threshold = val.to_i
when "color"
- val =~ /^1|y/i ? @color = true : @color = false
+ @color = Util.str_to_bool(val)
when "daemonize"
- val =~ /^1|y/i ? @daemonize = true : @daemonize = false
+ @daemonize = Util.str_to_bool(val)
when "securityprovider"
@securityprovider = val.capitalize
when "factsource"
@classesfile = val
when /^plugin.(.+)$/
@pluginconf[$1] = val
+ when "publish_timeout"
+ @publish_timeout = val.to_i
when "rpcaudit"
- val =~ /^1|y/i ? @rpcaudit = true : @rpcaudit = false
+ @rpcaudit = Util.str_to_bool(val)
when "rpcauditprovider"
@rpcauditprovider = val.capitalize
when "rpcauthorization"
- val =~ /^1|y/i ? @rpcauthorization = true : @rpcauthorization = false
+ @rpcauthorization = Util.str_to_bool(val)
when "rpcauthprovider"
@rpcauthprovider = val.capitalize
- when "rpchelptemplate"
- @rpchelptemplate = val
when "rpclimitmethod"
@rpclimitmethod = val.to_sym
when "logger_type"
@fact_cache_time = val.to_i
when "ssl_cipher"
@ssl_cipher = val
+ when "threaded"
+ @threaded = Util.str_to_bool(val)
when "ttl"
@ttl = val.to_i
- when "helptemplatedir"
- @helptemplatedir = val
when "default_discovery_options"
@default_discovery_options << val
when "default_discovery_method"
@default_discovery_method = val
else
- raise("Unknown config parameter #{key}")
+ raise("Unknown config parameter '#{key}'")
end
end
end
@default_discovery_options = []
@ttl = 60
@mode = :client
-
- # look in the config dir for the template so users can provide their own and windows
- # with odd paths will just work more often, but fall back to old behavior if it does
- # not exist
- @rpchelptemplate = File.join(File.dirname(configfile), "rpc-help.erb")
- @rpchelptemplate = "/etc/mcollective/rpc-help.erb" unless File.exists?(@rpchelptemplate)
- @helptemplatedir = File.dirname(@rpchelptemplate)
+ @publish_timeout = 2
+ @threaded = false
end
def read_plugin_config_dir(dir)
line.gsub!(/\s*$/, "")
next if line =~ /^#|^$/
if (line =~ /(.+?)\s*=\s*(.+)/)
- key = $1
+ key = $1.strip
val = $2
@pluginconf["#{plugin}.#{key}"] = val
end