-
Notifications
You must be signed in to change notification settings - Fork 897
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
Fix MiqRegion#remote_*_url returning invalid URL on podified #22668
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -404,6 +404,74 @@ def logon_status_details | |
result.merge(:message => message) | ||
end | ||
|
||
def ui_hostname | ||
if MiqEnvironment::Command.is_podified? | ||
ENV.fetch("APPLICATION_DOMAIN") | ||
else | ||
hostname || ipaddress | ||
end | ||
end | ||
|
||
def ui_ipaddress | ||
if MiqEnvironment::Command.is_podified? | ||
nil | ||
else | ||
ipaddress | ||
end | ||
end | ||
|
||
def ui_address(contact_with = :hostname) | ||
if MiqEnvironment::Command.is_podified? | ||
ENV.fetch("APPLICATION_DOMAIN") | ||
else | ||
contact_with == :hostname ? ui_hostname : ui_ipaddress | ||
end | ||
Comment on lines
+424
to
+428
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NOTE it is a bit of duplication to check for is_podified? in both these methods and in ui_address, but with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem is it probably belongs in the kubernetes module for the There are these methods in worker_management though, although the interface is ugly from here: It feels like the worker_manager should know this answer for what type it is and cache the result. Alas, this code is fine for now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (it would have been nice to just override this method in kubernetes.rb but we include these modules regardless of what type of manager we are) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I didn't think that WorkerManagement was the right place for this since it is more appliance-level but I agree it would be much cleaner to have a k8s subclass for this. Maybe we do a similar model for EnvironmentManagement (aka convert from simple module to a class then have systemd/kubernetes subclasses)? |
||
end | ||
|
||
def ui_url(contact_with = :hostname) | ||
url_override = settings_for_resource.ui.url | ||
return url_override if url_override | ||
|
||
host = ui_address(contact_with) | ||
return if host.nil? | ||
|
||
URI::HTTPS.build(:host => host).to_s | ||
end | ||
|
||
def ws_hostname | ||
if MiqEnvironment::Command.is_podified? | ||
ENV.fetch("APPLICATION_DOMAIN") | ||
else | ||
hostname || ipaddress | ||
end | ||
end | ||
|
||
def ws_ipaddress | ||
if MiqEnvironment::Command.is_podified? | ||
nil | ||
else | ||
ipaddress | ||
end | ||
end | ||
|
||
def ws_address | ||
if MiqEnvironment::Command.is_podified? | ||
ENV.fetch("APPLICATION_DOMAIN") | ||
else | ||
::Settings.webservices.contactwith == 'hostname' ? ws_hostname : ws_ipaddress | ||
end | ||
end | ||
|
||
def ws_url | ||
url_override = settings_for_resource.webservices.url | ||
return url_override if url_override | ||
|
||
host = ws_address | ||
return if host.nil? | ||
|
||
URI::HTTPS.build(:host => host).to_s | ||
end | ||
|
||
# | ||
# Zone and Role methods | ||
# | ||
|
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.
NOTE these methods don't appear to be used outside of the remote_*_address/url methods but since they aren't private I don't want to remove them especially for something we might backport.
remote_ui_ipaddress
,remote_ui_hostname
,remote_ws_ipaddress
,remote_ws_hostname