diff --git a/manifests/certonly.pp b/manifests/certonly.pp index ab571bf8..54bca3bc 100644 --- a/manifests/certonly.pp +++ b/manifests/certonly.pp @@ -21,7 +21,7 @@ # [*additional_args*] # An array of additional command line arguments to pass to the # `letsencrypt-auto` command. -# [*environment*] +# [*venv_vars*] # An optional array of environment variables (in addition to VENV_PATH). # [*manage_cron*] # Boolean indicating whether or not to schedule cron job for renewal. @@ -39,7 +39,7 @@ Array[Stdlib::Unixpath] $webroot_paths = [], String[1] $letsencrypt_command = $letsencrypt::command, Array[String[1]] $additional_args = [], - Array[String[1]] $environment = [], + Array[String[1]] $venv_vars = [], Boolean $manage_cron = false, Boolean $suppress_cron_output = false, Optional[String[1]] $cron_before_command = undef, @@ -82,7 +82,7 @@ $command = "${command_start}${command_domains}${command_end}" $live_path = "${config_dir}/live/${domains[0]}/cert.pem" - $execution_environment = [ "VENV_PATH=${letsencrypt::venv_path}", ] + $environment + $execution_environment = [ "VENV_PATH=${letsencrypt::venv_path}", ] + $venv_vars $verify_domains = join($domains, ' -d ') exec { "letsencrypt certonly ${title}": command => $command, diff --git a/manifests/init.pp b/manifests/init.pp index 75dd27c1..7a0cc21d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -9,7 +9,7 @@ # precedence over an 'email' setting defined in $config. # [*path*] # The path to the letsencrypt installation. -# [*environment*] +# [*venv_vars*] # An optional array of environment variables (in addition to VENV_PATH) # [*repo*] # A Git URL to install the Let's encrypt client from. @@ -54,8 +54,8 @@ class letsencrypt ( Optional[String] $email = undef, String $path = $letsencrypt::params::path, - $venv_path = $letsencrypt::params::venv_path, - Array $environment = [], + $venv_path = [], + Array $venv_vars = $letsencrypt::params::venv_vars, String $repo = $letsencrypt::params::repo, String $version = $letsencrypt::params::version, String $package_name = $letsencrypt::params::package_name, @@ -98,7 +98,7 @@ exec { 'initialize letsencrypt': command => "${command_init} -h", path => $::path, - environment => concat([ "VENV_PATH=${venv_path}" ], $environment), + environment => concat([ "VENV_PATH=${venv_path}" ], $venv_vars), refreshonly => true, } } diff --git a/spec/classes/letsencrypt_spec.rb b/spec/classes/letsencrypt_spec.rb index eb20be4d..1d2b2840 100644 --- a/spec/classes/letsencrypt_spec.rb +++ b/spec/classes/letsencrypt_spec.rb @@ -41,8 +41,7 @@ end describe 'with custom environment variables' do - let(:additional_params) { { environment: ['FOO=bar', 'FIZZ=buzz'] } } - + let(:additional_params) { { venv_vars: ['FOO=bar', 'FIZZ=buzz'] } } it { is_expected.to contain_exec('initialize letsencrypt').with_environment(['VENV_PATH=/opt/letsencrypt/.venv', 'FOO=bar', 'FIZZ=buzz']) } end diff --git a/spec/defines/letsencrypt_certonly_spec.rb b/spec/defines/letsencrypt_certonly_spec.rb index e78709be..addd6bc3 100644 --- a/spec/defines/letsencrypt_certonly_spec.rb +++ b/spec/defines/letsencrypt_certonly_spec.rb @@ -137,14 +137,13 @@ describe 'when specifying custom environment variables' do let(:title) { 'foo.example.com' } - let(:params) { { environment: ['FOO=bar', 'FIZZ=buzz'] } } - + let(:params) { { venv_vars: ['FOO=bar', 'FIZZ=buzz'] } } it { is_expected.to contain_exec('letsencrypt certonly foo.example.com').with_environment(['VENV_PATH=/opt/letsencrypt/.venv', 'FOO=bar', 'FIZZ=buzz']) } end context 'with custom environment variables and manage cron' do let(:title) { 'foo.example.com' } - let(:params) { { environment: ['FOO=bar', 'FIZZ=buzz'], manage_cron: true } } + let(:params) { { venv_vars: ['FOO=bar', 'FIZZ=buzz'], manage_cron: true } } it { is_expected.to contain_file('/var/lib/puppet/letsencrypt/renew-foo.example.com.sh').with_content "#!/bin/sh\nexport VENV_PATH=/opt/letsencrypt/.venv\nexport FOO=bar\nexport FIZZ=buzz\nletsencrypt --text --agree-tos --non-interactive certonly -a standalone --keep-until-expiring --cert-name foo.example.com -d foo.example.com\n" } end