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

Fixes #37204 - Move proxy params to correct location in virt-who.conf #189

Merged
merged 1 commit into from
Feb 27, 2024
Merged
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
5 changes: 3 additions & 2 deletions app/models/foreman_virt_who_configure/output_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,10 @@ def virt_who_output(format = nil)
### manual edits will be deleted.
[global]
debug=#{config.debug? ? 1 : 0}
interval=#{config.interval * 60}#{proxy_strings}
interval=#{config.interval * 60}
oneshot=False

[system_environment]#{proxy_strings}
EOF
if [ $? -ne 0 ]; then result_code=$(($result_code|#{error_code(:virt_who_sysconfig_file_issue)})); fi

Expand Down Expand Up @@ -289,7 +291,6 @@ def proxy_strings
output = ''
output << "\n#{proxy_type}=#{sanitize_proxy(proxy.full_url)}" if proxy.present?
output << "\nno_proxy=#{sanitize_proxy(no_proxy)}" if no_proxy.present?
output << "\nno_proxy=*" if proxy.blank? && no_proxy.blank?
output
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<%= textarea_f f, :exclude_host_parents, inline_help_popover(_('Exclude hosts which cluster ID is specified in comma-separated list in this option will <b>NOT</b> be reported. PowerCLI command to find the domain names in VMware <code>Get-Cluster “ClusterName” | Select ID</code>. Wildcards and regular expressions are supported, multiple records must be separated by comma. Put the value into the double-quotes if it contains special characters like comma. All new line characters will be removed in resulting configuration file, white spaces are removed from beginning and end.')).merge(:label => _('Exclude host parents')) %>

<%= checkbox_f f, :debug, { :label => _('Enable debugging output') }.merge(inline_help_popover(_("Different debug value can't be set per hypervisor, therefore it will affect all other deployed configurations on the host on which this configuration will be deployed."))) %>
<%= select_f f, :http_proxy_id, HttpProxy.all, :id, :full_url, {:include_blank => true}, { :label => _('HTTP Proxy') }.merge(
<%= select_f f, :http_proxy_id, HttpProxy.all, :id, :name, {:include_blank => true}, { :label => _('HTTP Proxy') }.merge(
inline_help_popover(_('HTTP proxy that should be used for communication between the server on which virt-who is running and the hypervisors and virtualization managers. Leave this blank if no proxy is used.').html_safe)) %>
<%= text_f f, :no_proxy, inline_help_popover(_('A comma-separated list of hostnames or domains or ip addresses to ignore proxy settings for. Optionally this may be set to <code>*</code> to bypass proxy settings for all hostnames domains or ip addresses.')).merge(:label => _('Ignore proxy')) %>
<%= text_f f, :kubeconfig_path, inline_help_popover(_('Configuration file containing details about how to connect to the cluster and authentication details')).merge(:label => _('Path to kubeconfig file')) %>
Expand Down
6 changes: 3 additions & 3 deletions test/unit/output_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class OutputGeneratorTest < ActiveSupport::TestCase

describe 'proxy attributes' do
test 'it does not set any proxy attributes by default and set no_proxy to * to bypass sub-man proxy' do
assert_nil config.http_proxy
assert_nil config.no_proxy
config.http_proxy = nil
config.no_proxy = '*'
assert_not_includes output, 'http_proxy'
assert_includes output, 'no_proxy=*'
end
Expand Down Expand Up @@ -86,7 +86,7 @@ class OutputGeneratorTest < ActiveSupport::TestCase
config.http_proxy = nil
config.no_proxy = ''
assert_not_includes generator.proxy_strings, 'http_proxy'
assert_includes generator.proxy_strings, 'no_proxy=*'
assert_not_includes generator.proxy_strings, 'no_proxy=*'
end

test 'proxy_strings removes any new line chars' do
Expand Down
Loading