From 40bd468685963abc9cb7cfccc50026cfdf51d177 Mon Sep 17 00:00:00 2001 From: Marcus Philip Date: Tue, 5 Aug 2014 15:26:31 +0200 Subject: [PATCH 1/2] Add possibility to set http_proxy in environment for rbenv install --- .gitignore | 1 + Modulefile | 1 + manifests/compile.pp | 9 ++++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b5d2ac9..88240c2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ pkg/* tmp/* bin/* +/.project diff --git a/Modulefile b/Modulefile index 554a356..1e8e97a 100644 --- a/Modulefile +++ b/Modulefile @@ -5,3 +5,4 @@ license 'MIT' summary 'rbenv Ruby Version Manager module' description 'Puppet module for rbenv Ruby Version Manager' project_page 'https://github.com/alup/puppet-rbenv' +dependency 'puppetlabs/stdlib', '4.3.2' diff --git a/manifests/compile.pp b/manifests/compile.pp index feac8da..e568728 100644 --- a/manifests/compile.pp +++ b/manifests/compile.pp @@ -1,6 +1,8 @@ # The following part compiles and installs the chosen ruby version, # using the "ruby-build" rbenv plugin. # +# You may define a web proxy using $http_proxy if necessary. +# define rbenv::compile( $user, $ruby = $title, @@ -14,6 +16,11 @@ $bundler = present, ) { + $http_proxy_env = $::http_proxy ? { + undef => [], + default => [ "HTTP_PROXY=${::http_proxy}", "http_proxy=${::http_proxy}", "HTTPS_PROXY=${::https_proxy}", "https_proxy=${::https_proxy}" ], + } + # Workaround http://projects.puppetlabs.com/issues/9848 $home_path = $home ? { '' => "/home/${user}", default => $home } $root_path = $root ? { '' => "${home_path}/.rbenv", default => $root } @@ -72,7 +79,7 @@ user => $user, group => $group, cwd => $home_path, - environment => [ "HOME=${home_path}", "CONFIGURE_OPTS=${configure_opts}" ], + environment => concat([ "HOME=${home_path}", "CONFIGURE_OPTS=${configure_opts}" ], $http_proxy_env), creates => "${versions}/${ruby}", path => $path, logoutput => 'on_failure', From 3a30f986c972da96adf159368d33d596043bd9be Mon Sep 17 00:00:00 2001 From: Marcus Philip Date: Tue, 5 Aug 2014 15:26:31 +0200 Subject: [PATCH 2/2] Add possibility to set http_proxy in environment for rbenv install --- .gitignore | 1 + Modulefile | 1 + manifests/compile.pp | 9 ++++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b5d2ac9..88240c2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ pkg/* tmp/* bin/* +/.project diff --git a/Modulefile b/Modulefile index 554a356..1e8e97a 100644 --- a/Modulefile +++ b/Modulefile @@ -5,3 +5,4 @@ license 'MIT' summary 'rbenv Ruby Version Manager module' description 'Puppet module for rbenv Ruby Version Manager' project_page 'https://github.com/alup/puppet-rbenv' +dependency 'puppetlabs/stdlib', '4.3.2' diff --git a/manifests/compile.pp b/manifests/compile.pp index feac8da..e568728 100644 --- a/manifests/compile.pp +++ b/manifests/compile.pp @@ -1,6 +1,8 @@ # The following part compiles and installs the chosen ruby version, # using the "ruby-build" rbenv plugin. # +# You may define a web proxy using $http_proxy if necessary. +# define rbenv::compile( $user, $ruby = $title, @@ -14,6 +16,11 @@ $bundler = present, ) { + $http_proxy_env = $::http_proxy ? { + undef => [], + default => [ "HTTP_PROXY=${::http_proxy}", "http_proxy=${::http_proxy}", "HTTPS_PROXY=${::https_proxy}", "https_proxy=${::https_proxy}" ], + } + # Workaround http://projects.puppetlabs.com/issues/9848 $home_path = $home ? { '' => "/home/${user}", default => $home } $root_path = $root ? { '' => "${home_path}/.rbenv", default => $root } @@ -72,7 +79,7 @@ user => $user, group => $group, cwd => $home_path, - environment => [ "HOME=${home_path}", "CONFIGURE_OPTS=${configure_opts}" ], + environment => concat([ "HOME=${home_path}", "CONFIGURE_OPTS=${configure_opts}" ], $http_proxy_env), creates => "${versions}/${ruby}", path => $path, logoutput => 'on_failure',