From e3660af2f8e65f52ea6399d2606620111b729166 Mon Sep 17 00:00:00 2001 From: "Z. Cliffe Schreuders" Date: Fri, 6 Dec 2019 17:02:44 +0000 Subject: [PATCH] docker behind proxy to be configured in base --- .../utilities/unix/container/docker/docker.pp | 59 ++++++++++++------- .../etc/sysconfig/docker.systemd.erb | 7 +-- 2 files changed, 40 insertions(+), 26 deletions(-) diff --git a/modules/utilities/unix/container/docker/docker.pp b/modules/utilities/unix/container/docker/docker.pp index 6535255af..85100e5f3 100644 --- a/modules/utilities/unix/container/docker/docker.pp +++ b/modules/utilities/unix/container/docker/docker.pp @@ -9,29 +9,44 @@ include 'docker' # proxy => "http://172.22.0.51:3128", #} + +# remove proxy config (it's in the template, and this overrides) +# file_line { 'remove_docker_proxy1': +# ensure => absent, +# path => '/etc/default/docker', +# line => 'HTTP_PROXY=""', +# } -> +# file_line { 'remove_docker_proxy2': +# ensure => absent, +# path => '/etc/default/docker', +# line => 'http_proxy=""', +# } -> +# file_line { 'remove_docker_proxy3': +# ensure => absent, +# path => '/etc/default/docker', +# line => 'https_proxy=""', +# } -> +# file_line { 'remove_docker_proxy4': +# ensure => absent, +# path => '/etc/default/docker', +# line => 'HTTPS_PROXY=""', +# } -> +# file_line { 'remove_docker_proxy_settings': +# ensure => absent, +# path => '/etc/default/docker', +# match => '^HTTP*_PROXY=*', +# match_for_absence => true, +# multiple => true, +# notify => Service['docker'], # reload docker once changed +# } +# +# # remove proxy config (it's in the template, and this overrides) +# exec { 'docker_remove_config_and_restart': +# command => "mv /etc/default/docker /etc/default/docker.mv; systemctl daemon-reload; systemctl restart docker", +# provider => shell, +# } + # download (pull) a set of images $images.each |$image| { docker::image { "$image": } } - -# remove proxy config (it's in the template, and this overrides) -file_line { 'remove_docker_proxy1': - ensure => absent, - path => '/etc/default/docker', - line => 'HTTP_PROXY=""', -} -file_line { 'remove_docker_proxy2': - ensure => absent, - path => '/etc/default/docker', - line => 'http_proxy=""', -} -file_line { 'remove_docker_proxy3': - ensure => absent, - path => '/etc/default/docker', - line => 'https_proxy=""', -} -file_line { 'remove_docker_proxy4': - ensure => absent, - path => '/etc/default/docker', - line => 'HTTPS_PROXY=""', -} diff --git a/modules/utilities/unix/container/docker/templates/etc/sysconfig/docker.systemd.erb b/modules/utilities/unix/container/docker/templates/etc/sysconfig/docker.systemd.erb index 2ab65ea9d..c3f0d3391 100644 --- a/modules/utilities/unix/container/docker/templates/etc/sysconfig/docker.systemd.erb +++ b/modules/utilities/unix/container/docker/templates/etc/sysconfig/docker.systemd.erb @@ -29,10 +29,9 @@ OPTIONS="<% if @root_dir %><%= @root_dir_flag %> <%= @root_dir %><% end -%> <% if @labels %><% @labels_array.each do |label| %> --label <%= label %><% end %><% end -%> <% if @extra_parameters %><% @extra_parameters_array.each do |param| %> <%= param %><% end %><% end -%>" -<%# SecGen edit %> -<% if @proxy and @proxy != ''%>http_proxy='<%= @proxy %>' - https_proxy='<%= @proxy %>'<% end %> -<% if @no_proxy %>no_proxy='<%= @no_proxy %>'<% end %> +<%# SecGen %> +# SG edit -- removed proxy settings + # This is also a handy place to tweak where Docker's temporary files go. <% if @tmp_dir_config %>TMPDIR="<%= @tmp_dir %>"<% else %># TMPDIR="<%= @tmp_dir %>"<% end %> <% if @shell_values %><% @shell_values_array.each do |param| %> <%= param %><% end %><% end -%>