Skip to content

Commit

Permalink
Fix #16 by specifying VENV_PATH when running letsencrypt.
Browse files Browse the repository at this point in the history
Issue copy-paste from
#16

When you install letsencrypt using the VCS method, it will create a
virtualenv, which would normally be located in
~/.local/share/letsencrypt:

Excerpt from letsencrypt-auto:
```
XDG_DATA_HOME=${XDG_DATA_HOME:-~/.local/share}
VENV_NAME="letsencrypt"
VENV_PATH=${VENV_PATH:-"$XDG_DATA_HOME/$VENV_NAME"}
```
However, puppet exec's will not set $HOME, which will stop Debian's
/bin/sh, dash, from expanding ~, so it creates a literal '~' folder.
  • Loading branch information
mheistermann committed Mar 3, 2016
1 parent 70eb3eb commit 49fe775
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
19 changes: 11 additions & 8 deletions manifests/certonly.pp
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,25 @@
$command = "${command_start}${command_domains}${command_end}"
$live_path = inline_template('/etc/letsencrypt/live/<%= @domains.first %>/cert.pem')

$venv_path_var = "VENV_PATH=${letsencrypt::venv_path}"
exec { "letsencrypt certonly ${title}":
command => $command,
path => $::path,
creates => $live_path,
require => Class['letsencrypt'],
command => $command,
path => $::path,
environment => [$venv_path_var],
creates => $live_path,
require => Class['letsencrypt'],
}

if $manage_cron {
$renewcommand = "${command_start}--keep-until-expiring ${command_domains}${command_end}"
$cron_hour = fqdn_rand(24, $title) # 0 - 23, seed is title plus fqdn
$cron_minute = fqdn_rand(60, $title ) # 0 - 59, seed is title plus fqdn
cron { "letsencrypt renew cron ${title}":
command => $renewcommand,
user => root,
hour => $cron_hour,
minute => $cron_minute,
command => $renewcommand,
environment => $venv_path_var,
user => root,
hour => $cron_hour,
minute => $cron_minute,
}
}
}
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
class letsencrypt (
$email = undef,
$path = $letsencrypt::params::path,
$venv_path = $letsencrypt::params::venv_path,
$repo = $letsencrypt::params::repo,
$version = $letsencrypt::params::version,
$package_ensure = $letsencrypt::params::package_ensure,
Expand Down Expand Up @@ -81,6 +82,7 @@
exec { 'initialize letsencrypt':
command => "${command} -h",
path => $::path,
environment => ["VENV_PATH=${venv_path}"],
refreshonly => true,
}
}
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
$package_ensure = 'installed'
$config_file = '/etc/letsencrypt/cli.ini'
$path = '/opt/letsencrypt'
$venv_path = '/opt/letsencrypt/.venv' # virtualenv path for vcs-installed letsencrypt
$repo = 'git://github.com/letsencrypt/letsencrypt.git'
$version = 'v0.4.0'
$config = {
Expand Down

0 comments on commit 49fe775

Please sign in to comment.