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

rename environment parameter to unbreak hiera #64

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
6 changes: 3 additions & 3 deletions manifests/certonly.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# precedence over an 'email' setting defined in $config.
# [*path*]
# The path to the letsencrypt installation.
# [*environment*]
# [*venv_vars*]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you like to add documentation for venv_path at the same time?

# An optional array of environment variables (in addition to VENV_PATH)
# [*repo*]
# A Git URL to install the Let's encrypt client from.
Expand Down Expand Up @@ -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 = [],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look like a correct rebase

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but now that i'm seeing this, we've already had $venv_vars — is this even still needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the answer is: potentially, but it needs to be rethought, rather than rebased.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we had venv_path so it's still useful to have I think

Array $venv_vars = $letsencrypt::params::venv_vars,
String $repo = $letsencrypt::params::repo,
String $version = $letsencrypt::params::version,
String $package_name = $letsencrypt::params::package_name,
Expand Down Expand Up @@ -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,
}
}
3 changes: 1 addition & 2 deletions spec/classes/letsencrypt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions spec/defines/letsencrypt_certonly_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down