-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Halt upgrades if evr is not owned by foreman #953
base: master
Are you sure you want to change the base?
Halt upgrades if evr is not owned by foreman #953
Conversation
def run | ||
# No check is needed if the evr extension does not exist | ||
evr_exists = find_evr_exists | ||
return if !evr_exists |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could just turn this into more of a evr_exists?
method, so that you can reduce these two lines to:
return unless evr_exists?
error_msg = 'The evr extension is not owned by the foreman DB owner. Please run the following command to fix it: ' \ | ||
"UPDATE pg_extension SET extowner = (SELECT oid FROM pg_authid WHERE rolname='foreman') WHERE extname='evr';" | ||
foreman_owns_evr = find_foreman_owns_evr | ||
fail!(error_msg) if !foreman_owns_evr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same idea here, switch to foreman_owns_evr?
method name and then do:
fail!(error_msg) unless foreman_own_evr?
fail!('Could not determine if the evr extension is owned by the foreman DB owner') | ||
end | ||
|
||
def self.query_for_evr_existence |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not need to be a class method
SQL | ||
end | ||
|
||
def self.query_to_find_evr_owner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not need to be a class method
end | ||
|
||
def run | ||
# No check is needed if the evr extension does not exist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can drop this, the code reads well enough to tell me what's happening.
Halts upgrades if the
evr
extension in Katello external DBs are not owned byforeman
. Skips the checks if theevr
extension does not exist.Related installer PR: theforeman/foreman-installer#984