Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

Fixes #20239 - Add upgrade script for qpid path #518

Merged
merged 1 commit into from Jul 11, 2017
Merged

Fixes #20239 - Add upgrade script for qpid path #518

merged 1 commit into from Jul 11, 2017

Conversation

chris1984
Copy link
Member

No description provided.

@theforeman-bot
Copy link

Issues: #20239

# rubocop:disable Style/MultipleComparison
def upgrade_qpid_paths
qpid_dir = '/var/lib/qpidd'
qpid_data_dir = "#{qpid_dir}/.qpidd"
Copy link
Member

Choose a reason for hiding this comment

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

This works well on RHEL7. For RHEL6:

qpid_data_dir = "#{qpid_dir}"

Copy link
Member Author

Choose a reason for hiding this comment

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

Going to address this with a downstream MR since upstream is only supporting EL7

next if item == '.' || item == '..'
Kafo::Helpers.execute("puts Moving #{item}")
Kafo::Helpers.execute("mv #{qpid_dir}/#{item} #{qpid_linearstore}/p001/efp/2048k/in_use/#{item}")
Kafo::Helpers.execute("ln -s #{qpid_linearstore}/p001/efp/2048k/in_use/#{item} #{qpid_linearstore}/jrnl2/#{item}")
Copy link
Member

Choose a reason for hiding this comment

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

These two lines need to be performed in a loop over the #{qpid_linearstore}/jrnl/#{item} directory - for every file in this directory, move it to in_use dir, and create a symlink to it. So something like:

Dir.foreach("#{qpid_linearstore}/jrnl/#{item}") do |jrnlfile|
    Kafo::Helpers.execute("mv #{qpid_linearstore}/jrnl/#{item}/#{jrnlfile} #{qpid_linearstore}/p001/efp/2048k/in_use/#{jrnlfile}")
    Kafo::Helpers.execute("ln -s #{qpid_linearstore}/p001/efp/2048k/in_use/#{jrnlfile} #{qpid_linearstore}/jrnl2/#{item}/#{jrnlfile}")
end

@@ -157,6 +187,7 @@ def fail_and_exit(message)
upgrade_step :start_httpd, :run_always => true
upgrade_step :start_qpidd, :run_always => true
upgrade_step :start_pulp, :run_always => true
upgrade_step :upgrade_qpid_paths
Copy link
Member

Choose a reason for hiding this comment

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

I dont know how the upgrade steps are ordered, but the upgrade_qpid_paths must be run when qpidd is stopped (so when it is recommended to have stopped also pulp or candlepin and so).

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah ok, will change that around to have it done before anything is running

# Move qpid jrnl files
Dir.foreach("#{qpid_linearstore}/jrnl") do |item|
next if item == '.' || item == '..'
Kafo::Helpers.execute("puts Moving #{item}")
Copy link
Member

Choose a reason for hiding this comment

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

I think you want the puts to just be a line and not wrapped in execute

@ehelms
Copy link
Member

ehelms commented Jul 7, 2017

What happens if any step fails? Should we consider a rescue to catch errors and spit out a more friendly error followed by any backtrace associated to a failure?

@chris1984
Copy link
Member Author

@pmoravec @ehelms can I get another review please when you get a chance.

@pmoravec
Copy link
Member

Looks good.

@ehelms ehelms merged commit 8e1e780 into Katello:master Jul 11, 2017
zjhuntin pushed a commit to zjhuntin/katello-installer that referenced this pull request Oct 30, 2018
Commit enables passing --kickstart-repository and --content-source
options to
hammer host create/update
hammer hostgroup create/update
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants