This commit is contained in:
Alexey Berezhok
2026-05-16 00:10:12 +03:00
parent af9e6bfb82
commit 6ff9d67909
2 changed files with 208 additions and 8 deletions

View File

@@ -77,6 +77,10 @@ class File
end
end
def hestia_print_info_message_to_cli(error_message)
puts "Info: #{error_message}"
end
def hestia_print_error_message_to_cli(error_message)
puts "Error: #{error_message}"
end
@@ -323,7 +327,7 @@ def hestia_change_sys_config_value(key, value)
config_file = "/usr/local/hestia/conf/hestia.conf"
if File.exist?(config_file)
File.open(config_file, File::RDWR | File::LOCK_SH) do |f|
File.open(config_file, File::RDWR) do |f|
# Check if key exists in the configuration file
existing_line_index = -1
@@ -343,7 +347,6 @@ def hestia_change_sys_config_value(key, value)
if existing_line_index.nil? || existing_line_index == -1
# Key doesn't exist - append new line to file
File.open(config_file, "a") do |append_f|
append_f.flock(File::LOCK_EX)
append_f.puts("#{key}='#{value}'")
end
OK
@@ -370,7 +373,6 @@ def hestia_change_sys_config_value(key, value)
end
File.open(temp_file, "w") do |output_f|
output_f.flock(File::LOCK_EX)
lines.each { |l| output_f.puts(l) }
end