File tree Expand file tree Collapse file tree 3 files changed +20
-10
lines changed
Expand file tree Collapse file tree 3 files changed +20
-10
lines changed Original file line number Diff line number Diff line change 1- 3.1.3
1+ 3.1.4
Original file line number Diff line number Diff line change 1515
1616module Config_utils
1717
18+ LOG_DIRECTORY = '/var/log/rb-register-common'
19+ LOG_FILE_NAME = 'register.log'
1820
1921 @modelist_path = "/usr/lib/redborder/mode-list.yml"
22+
2023 #Function to check if mode is valid (if defined in mode-list.yml)
2124 #Returns true if it's valid and false if not
2225 #TODO: protect from exception like file not found
@@ -80,13 +83,15 @@ def self.replace_chef_server_url(cdomain)
8083 end
8184 end
8285
86+ def self . log_file
87+ File . join ( LOG_DIRECTORY , LOG_FILE_NAME )
88+ end
89+
8390 # Create log file for registration without rb-register
8491 def self . ensure_log_file_exists
85- log_directory = '/var/log/rb-register-common'
86- log_file = "#{ log_directory } /register.log"
8792
88- unless Dir . exist? ( log_directory )
89- system ( "mkdir -p #{ log_directory } " )
93+ unless Dir . exist? ( LOG_DIRECTORY )
94+ system ( "mkdir -p #{ LOG_DIRECTORY } " )
9095 end
9196
9297 if File . exist? ( log_file )
Original file line number Diff line number Diff line change @@ -344,18 +344,23 @@ def local_tty_warning_wizard
344344 end
345345 else
346346 system ( "sudo hostnamectl set-hostname #{ ips_node_name } " )
347- system ( "/usr/lib/redborder/scripts/rb_associate_sensor.rb -u #{ webui_user } -p #{ webui_pass } -i #{ Config_utils . get_ip_address } -m #{ webui_host } " )
347+ Config_utils . ensure_log_file_exists
348+ system ( "echo 'Sensor #{ ips_node_name } association in progress...' > #{ Config_utils . log_file } " )
349+ system ( "/usr/lib/redborder/scripts/rb_associate_sensor.rb -u #{ webui_user } -p #{ webui_pass } -i #{ Config_utils . get_ip_address } -m #{ webui_host } >> #{ Config_utils . log_file } 2>&1" )
348350 if $?. exitstatus == 0
349351 Config_utils . hook_hosts ( webui_host , cdomain )
350352 Config_utils . replace_chef_server_url ( cdomain )
351- Config_utils . ensure_log_file_exists
353+
352354 system ( "sed -i '/webui_pass/d' #{ INITCONF } " )
353355 puts "Sensor registered to the manager, please wait..."
354- puts "You can see logs in /var/log/rb-register-common/register.log "
355- system ( ' /usr/lib/redborder/bin/rb_register_finish.sh > /var/log/rb-register-common/register.log 2>&1' )
356+ puts "You can see logs in #{ Config_utils . log_file } "
357+ system ( " /usr/lib/redborder/bin/rb_register_finish.sh >> #{ Config_utils . log_file } 2>&1" )
356358 puts "Registration and configuration finished!"
357359 else
358- puts "Error: rb_associate_sensor.rb failed with exit status #{ $?. exitstatus } . Please review #{ INITCONF } file or network configuration..."
360+
361+ puts "Error: Sensor association failed with exit status #{ $?. exitstatus } ."
362+ puts "Please review #{ INITCONF } file or network configuration..."
363+ puts "See \" #{ Config_utils . log_file } \" for more details."
359364 end
360365 end
361366end
You can’t perform that action at this time.
0 commit comments