Skip to content
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

refs #37923 - Bug fixes & improvements for the Default HTTP proxy #11266

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ module V2
module HttpProxiesControllerExtensions
extend ::Apipie::DSL::Concern

update_api(:create) do
update_api(:create, :show) do
param :http_proxy, Hash do
param :default_content_proxy, :bool, :required => false, :desc => N_('Set this HTTP proxy as the default content HTTP proxy')
param :content_default_http_proxy, :bool, :required => false, :desc => N_('Set this HTTP proxy as the default content HTTP proxy')
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module HttpProxiesControllerExtensions

def update_content_default_http_proxy
return unless @http_proxy.persisted?
return unless ActiveRecord::Type::Boolean.new.deserialize(params.dig('http_proxy', 'default_content'))
return unless ActiveRecord::Type::Boolean.new.deserialize(params.dig('http_proxy', 'content_default_http_proxy'))

Setting[:content_default_http_proxy] = @http_proxy.name
end
Expand Down
4 changes: 4 additions & 0 deletions app/models/katello/concerns/http_proxy_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ def name_and_url
uri.user = nil
"#{name} (#{uri})"
end

def content_default_http_proxy?
Setting[:content_default_http_proxy] == name
end
end
end
end
1 change: 1 addition & 0 deletions app/views/katello/api/v2/http_proxies/show.json.rabl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node(:content_default_http_proxy) { |sp| sp.content_default_http_proxy? }
30 changes: 16 additions & 14 deletions app/views/overrides/http_proxies/_update_setting_input.html.erb
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<% if @http_proxy.new_record? %>
<div class="clearfix">
<div class="form-group ">
<label class="col-md-2 control-label" for="http_proxy_default_content">
Default content HTTP proxy
</label>
<div class="col-md-4">
<%= check_box_tag 'http_proxy[default_content]',
'1',
params.dig('http_proxy', 'default_content') == '1',
id: 'http_proxy_default_content' %>
Set this proxy as the default for content, updating the 'Default HTTP Proxy' setting.
</div>
<div class="clearfix">
<div class="form-group ">
<label class="col-md-2 control-label" for="http_proxy_content_default_http_proxy">
Default content HTTP proxy
</label>
<div class="col-md-4">
<% if @http_proxy.new_record? %>
<%= check_box_tag 'http_proxy[content_default_http_proxy]',
'1',
params.dig('http_proxy', 'content_default_http_proxy') == '1',
id: 'content_default_http_proxy' %>
Set this proxy as the default for content, updating the 'Default HTTP Proxy' setting.
<% else %>
<%= @http_proxy.content_default_http_proxy? ? _('Yes') : _('No') %>
<% end %>
</div>
</div>
<% end %>
</div>
1 change: 1 addition & 0 deletions lib/katello/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@
extend_rabl_template 'api/v2/smart_proxies/main', 'katello/api/v2/smart_proxies/pulp_info'
extend_rabl_template 'api/v2/hosts/show', 'katello/api/v2/hosts/host_collections'
extend_rabl_template 'api/v2/hosts/show', 'katello/api/v2/hosts/show'
extend_rabl_template 'api/v2/http_proxies/show', 'katello/api/v2/http_proxies/show'

# Katello variables for Host Registration
extend_allowed_registration_vars :activation_keys
Expand Down
Loading