Class: ForemanMaintain::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/foreman_maintain/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Config

Returns a new instance of Config.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/foreman_maintain/config.rb', line 10

def initialize(options)
  @pre_setup_log_messages = []
  @config_file = options.fetch(:config_file, config_file_path)
  @options = load_config
  @definitions_dirs = @options.fetch(:definitions_dirs,
                                     [File.join(source_path, 'definitions')])
  load_log_configs
  load_backup_dir_paths
  load_cron_option
  @foreman_proxy_cert_path = @options.fetch(:foreman_proxy_cert_path, '/etc/foreman')
  @completion_cache_file = File.expand_path(
    @options.fetch(:completion_cache_file, '~/.cache/foreman_maintain_completion.yml')
  )
  @disable_commands = @options.fetch(:disable_commands, [])
  @foreman_url = @options.fetch(:foreman_url, `hostname -f`.chomp)
  @foreman_port = @options.fetch(:foreman_port, 443)
end

Instance Attribute Details

#backup_dirObject

Returns the value of attribute backup_dir.



4
5
6
# File 'lib/foreman_maintain/config.rb', line 4

def backup_dir
  @backup_dir
end

#completion_cache_fileObject

Returns the value of attribute completion_cache_file.



4
5
6
# File 'lib/foreman_maintain/config.rb', line 4

def completion_cache_file
  @completion_cache_file
end

#config_fileObject

Returns the value of attribute config_file.



4
5
6
# File 'lib/foreman_maintain/config.rb', line 4

def config_file
  @config_file
end

#db_backup_dirObject

Returns the value of attribute db_backup_dir.



4
5
6
# File 'lib/foreman_maintain/config.rb', line 4

def db_backup_dir
  @db_backup_dir
end

#definitions_dirsObject

Returns the value of attribute definitions_dirs.



4
5
6
# File 'lib/foreman_maintain/config.rb', line 4

def definitions_dirs
  @definitions_dirs
end

#disable_commandsObject

Returns the value of attribute disable_commands.



4
5
6
# File 'lib/foreman_maintain/config.rb', line 4

def disable_commands
  @disable_commands
end

#foreman_portObject

Returns the value of attribute foreman_port.



4
5
6
# File 'lib/foreman_maintain/config.rb', line 4

def foreman_port
  @foreman_port
end

#foreman_proxy_cert_pathObject

Returns the value of attribute foreman_proxy_cert_path.



4
5
6
# File 'lib/foreman_maintain/config.rb', line 4

def foreman_proxy_cert_path
  @foreman_proxy_cert_path
end

#foreman_urlObject

Returns the value of attribute foreman_url.



4
5
6
# File 'lib/foreman_maintain/config.rb', line 4

def foreman_url
  @foreman_url
end

#log_dirObject

Returns the value of attribute log_dir.



4
5
6
# File 'lib/foreman_maintain/config.rb', line 4

def log_dir
  @log_dir
end

#log_file_sizeObject

Returns the value of attribute log_file_size.



4
5
6
# File 'lib/foreman_maintain/config.rb', line 4

def log_file_size
  @log_file_size
end

#log_filenameObject

Returns the value of attribute log_filename.



4
5
6
# File 'lib/foreman_maintain/config.rb', line 4

def log_filename
  @log_filename
end

#log_levelObject

Returns the value of attribute log_level.



4
5
6
# File 'lib/foreman_maintain/config.rb', line 4

def log_level
  @log_level
end

#manage_crondObject

Returns the value of attribute manage_crond.



4
5
6
# File 'lib/foreman_maintain/config.rb', line 4

def manage_crond
  @manage_crond
end

#pre_setup_log_messagesObject

Returns the value of attribute pre_setup_log_messages.



4
5
6
# File 'lib/foreman_maintain/config.rb', line 4

def pre_setup_log_messages
  @pre_setup_log_messages
end

#storage_fileObject

Returns the value of attribute storage_file.



4
5
6
# File 'lib/foreman_maintain/config.rb', line 4

def storage_file
  @storage_file
end