Class: ManageIQ::ApplianceConsole::LogfileConfiguration
- Inherits:
-
Object
- Object
- ManageIQ::ApplianceConsole::LogfileConfiguration
- Includes:
- Logging
- Defined in:
- lib/manageiq/appliance_console/logfile_configuration.rb
Constant Summary collapse
- LOGFILE_DIRECTORY =
Pathname.new("/var/www/miq/vmdb/log").freeze
- LOGFILE_NAME =
"miq_logs".freeze
- MIQ_LOGS_CONF =
Pathname.new("/etc/logrotate.d/miq_logs.conf").freeze
Instance Attribute Summary collapse
-
#current_logrotate_count ⇒ Object
Returns the value of attribute current_logrotate_count.
-
#disk ⇒ Object
Returns the value of attribute disk.
-
#evm_was_running ⇒ Object
Returns the value of attribute evm_was_running.
-
#new_logrotate_count ⇒ Object
Returns the value of attribute new_logrotate_count.
-
#size ⇒ Object
Returns the value of attribute size.
Instance Method Summary collapse
- #activate ⇒ Object
- #ask_questions ⇒ Object
-
#initialize(config = {}) ⇒ LogfileConfiguration
constructor
A new instance of LogfileConfiguration.
Methods included from Logging
#error_and_logging_from_command_result_error, #error_and_logging_from_standard_error, #interactive, #interactive=, interactive?, #interactive?, #log_and_feedback, #log_and_feedback_exception, #log_and_feedback_info, #log_error, #log_prefix, #logger, #logger=, #say_error, #say_info
Constructor Details
#initialize(config = {}) ⇒ LogfileConfiguration
Returns a new instance of LogfileConfiguration.
17 18 19 20 21 22 23 24 |
# File 'lib/manageiq/appliance_console/logfile_configuration.rb', line 17 def initialize(config = {}) self.disk = config[:disk] self.new_logrotate_count = nil self.size = Utilities.disk_usage(LOGFILE_DIRECTORY)[0][:total_bytes] self.current_logrotate_count = /rotate\s+(\d+)/.match(File.read(MIQ_LOGS_CONF))[1] self.evm_was_running = EvmServer.running? end |
Instance Attribute Details
#current_logrotate_count ⇒ Object
Returns the value of attribute current_logrotate_count.
13 14 15 |
# File 'lib/manageiq/appliance_console/logfile_configuration.rb', line 13 def current_logrotate_count @current_logrotate_count end |
#disk ⇒ Object
Returns the value of attribute disk.
13 14 15 |
# File 'lib/manageiq/appliance_console/logfile_configuration.rb', line 13 def disk @disk end |
#evm_was_running ⇒ Object
Returns the value of attribute evm_was_running.
13 14 15 |
# File 'lib/manageiq/appliance_console/logfile_configuration.rb', line 13 def evm_was_running @evm_was_running end |
#new_logrotate_count ⇒ Object
Returns the value of attribute new_logrotate_count.
13 14 15 |
# File 'lib/manageiq/appliance_console/logfile_configuration.rb', line 13 def new_logrotate_count @new_logrotate_count end |
#size ⇒ Object
Returns the value of attribute size.
13 14 15 |
# File 'lib/manageiq/appliance_console/logfile_configuration.rb', line 13 def size @size end |
Instance Method Details
#activate ⇒ Object
26 27 28 |
# File 'lib/manageiq/appliance_console/logfile_configuration.rb', line 26 def activate activate_new_disk && activate_new_logrotate_count end |
#ask_questions ⇒ Object
30 31 32 33 34 35 |
# File 'lib/manageiq/appliance_console/logfile_configuration.rb', line 30 def ask_questions clear_screen choose_disk if use_new_disk choose_logrotate_count if set_new_logrotate_count? confirm_selection end |