From 626d43b5883492e860f25b0f8708ab2d60942ddf Mon Sep 17 00:00:00 2001 From: "@aleksandr.sosnov" Date: Wed, 25 Jan 2023 20:47:48 +0300 Subject: [PATCH] add fix for binary name --- README.md | 6 ++++++ manifests/init.pp | 1 + manifests/params.pp | 2 +- templates/oauth2_proxy.init.erb | 4 ++-- templates/oauth2_proxy.initd.erb | 2 +- templates/oauth2_proxy@.service.erb | 4 ++-- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3f3842e..8ed3a2f 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,12 @@ to be in `tar.gz` format. The sha1 format checksum of the `source` file. +##### `binary_path` + +`String` defaults to: `bin/oauth2_proxy` + +Path to binary execution filename in archive. + ### Defines #### `oauth2_proxy::instance` diff --git a/manifests/init.pp b/manifests/init.pp index 52bc8db..f7d4dc0 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -7,6 +7,7 @@ $manage_group = $::oauth2_proxy::params::manage_group, $install_root = $::oauth2_proxy::params::install_root, $source = $::oauth2_proxy::params::source, + $binary_path = $::oauth2_proxy::params::binary_path, $checksum = $::oauth2_proxy::params::checksum, $systemd_path = $::oauth2_proxy::params::systemd_path, $shell = $::oauth2_proxy::params::shell, diff --git a/manifests/params.pp b/manifests/params.pp index 376855c..423d77e 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -16,7 +16,7 @@ $tarball = "oauth2_proxy-${version}.linux-amd64.go1.6.tar.gz" $source = "https://github.com/bitly/oauth2_proxy/releases/download/v${version}/${tarball}" $checksum = '7a74b361f9edda0400d02602eacd70596d85b453' - + $binary_path = 'bin/oauth2_proxy' # in theory, this module should work on any linux distro that uses systemd # but it has only been tested on el7 case $::osfamily { diff --git a/templates/oauth2_proxy.init.erb b/templates/oauth2_proxy.init.erb index e80f1dd..a82e63a 100644 --- a/templates/oauth2_proxy.init.erb +++ b/templates/oauth2_proxy.init.erb @@ -9,8 +9,8 @@ respawn limit 10 5 console log script - exec start-stop-daemon --start --make-pidfile --pidfile /var/run/oauth2_proxy@<%= @title %>.pid --chuid <%= scope['::oauth2_proxy::user'] %>:<%= scope['::oauth2_proxy::group'] %> --chdir /opt/oauth2_proxy --startas /bin/bash -- -c "exec <%= scope['::oauth2_proxy::install_root'] %>/bin/oauth2_proxy -config="/etc/oauth2_proxy/<%= @title %>.conf" &>> /var/log/oauth2_proxy/<%= @title %>.log" - #exec <%= scope['::oauth2_proxy::install_root'] %>/bin/oauth2_proxy -config="/etc/oauth2_proxy/<%= @title %>.conf" &>> /var/log/oauth2_proxy/<%= @title %>.log + exec start-stop-daemon --start --make-pidfile --pidfile /var/run/oauth2_proxy@<%= @title %>.pid --chuid <%= scope['::oauth2_proxy::user'] %>:<%= scope['::oauth2_proxy::group'] %> --chdir /opt/oauth2_proxy --startas /bin/bash -- -c "exec <%= scope['::oauth2_proxy::install_root'] %>/<%= scope['::oauth2_proxy::binary_path'] %> -config="/etc/oauth2_proxy/<%= @title %>.conf" &>> /var/log/oauth2_proxy/<%= @title %>.log" + #exec <%= scope['::oauth2_proxy::install_root'] %>/<%= scope['::oauth2_proxy::binary_path'] %> -config="/etc/oauth2_proxy/<%= @title %>.conf" &>> /var/log/oauth2_proxy/<%= @title %>.log end script pre-start script diff --git a/templates/oauth2_proxy.initd.erb b/templates/oauth2_proxy.initd.erb index 7111eb0..6271c98 100644 --- a/templates/oauth2_proxy.initd.erb +++ b/templates/oauth2_proxy.initd.erb @@ -19,7 +19,7 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DESC="oauth2_proxy@<%= @title %>" NAME="oauth2_proxy@<%= @title %>" -DAEMON="<%= scope['::oauth2_proxy::install_root'] %>/bin/oauth2_proxy" +DAEMON="<%= scope['::oauth2_proxy::install_root'] %>/<%= scope['::oauth2_proxy::binary_path'] %>" PIDFILE=/var/run/$NAME.pid LOGFILE=/var/log/oauth2_proxy/<%= @title %>.log SCRIPTNAME=/etc/init.d/$NAME diff --git a/templates/oauth2_proxy@.service.erb b/templates/oauth2_proxy@.service.erb index 04a0526..18ca09d 100644 --- a/templates/oauth2_proxy@.service.erb +++ b/templates/oauth2_proxy@.service.erb @@ -1,10 +1,10 @@ [Unit] -Description=OAuth2 Proxy +Description=OAuth2 Proxy %i [Service] User=<%= scope['::oauth2_proxy::user'] %> Group=<%= scope['::oauth2_proxy::group'] %> -ExecStart=<%= scope['::oauth2_proxy::install_root'] %>/bin/oauth2_proxy --config=/etc/oauth2_proxy/%i.conf +ExecStart=<%= scope['::oauth2_proxy::install_root'] %>/<%= scope['::oauth2_proxy::binary_path'] %> --config=/etc/oauth2_proxy/%i.conf Restart=always [Install]