Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion definitions/features/foreman_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def export_csv(sql, file_name, state)
f.write(csv_output)
f.close
end
execute("bzip2 #{filepath} -c -9 > #{filepath}.bz2")
execute("pbzip2 #{filepath} -c -9 > #{filepath}.bz2")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the pbzip2 is not available? I could not find information about where it is installed by default, so maybe some checks in place would be a good idea:

compressor = system("which pbzip2 > /dev/null 2>&1") ? "pbzip2" : "bzip2"
execute("#{compressor} #{filepath} -c -9 > #{filepath}.bz2")

Second question:
By default, pbzip2 will use all available cores. This can make the Foreman instance unresponsive and can cause some access issues. Should we lower the process's priority or (somehow) limit the number of cores used for execution? So we don't exhaust the server's resources?

FileUtils.rm_rf(filepath)
end

Expand Down