Updated shell.go

This commit is contained in:
Chris Stuurman 2024-04-19 22:58:45 +02:00
parent 6b58b5da3c
commit 1356c61fc0
4 changed files with 10 additions and 13 deletions

View File

@ -1,5 +1,5 @@
apiVersion: v1 apiVersion: v1
appVersion: v0.0.5-alpha.110 appVersion: v0.0.5-alpha.111
description: Cert-Manager webhook for sthome description: Cert-Manager webhook for sthome
name: sthome-webhook name: sthome-webhook
version: 0.0.5-alpha.110 version: 0.0.5-alpha.111

View File

@ -31,7 +31,7 @@ clusterIssuer:
image: image:
repository: stuurmcp/cert-manager-webhook-sthome repository: stuurmcp/cert-manager-webhook-sthome
#repository: wstat.sthome.net:5000/cert-manager-webhook-sthome #repository: wstat.sthome.net:5000/cert-manager-webhook-sthome
tag: 0.0.5-alpha.110 tag: 0.0.5-alpha.111
#pullPolicy should be IfNotPresent. Set to Always for testing purposes #pullPolicy should be IfNotPresent. Set to Always for testing purposes
pullPolicy: IfNotPresent pullPolicy: IfNotPresent

View File

@ -9,7 +9,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/jetstack/cert-manager/pkg/acme/webhook/apis/acme/v1alpha1" "github.com/cert-manager/cert-manager/pkg/acme/webhook/apis/acme/v1alpha1"
"k8s.io/klog/v2" "k8s.io/klog/v2"
) )
@ -32,8 +32,7 @@ const (
var ( var (
AcmeAuthCmd = AcmeDir + "/" + AuthScript AcmeAuthCmd = AcmeDir + "/" + AuthScript
wg sync.WaitGroup // wg is used to wait for the program to finish. mutex sync.Mutex // mutex is used to define a critical section of code.
mutex sync.Mutex // mutex is used to define a critical section of code.
) )
// CapturingPassThroughWriter is a writer that remembers // CapturingPassThroughWriter is a writer that remembers
@ -64,7 +63,6 @@ func SetChallenge(ch *v1alpha1.ChallengeRequest) (bool, error) {
SetupWorkdir() // update workdir if any of the copied files were updated on host SetupWorkdir() // update workdir if any of the copied files were updated on host
return Execute( return Execute(
Shell, Shell,
// "-c",
AcmeAuthCmd, AcmeAuthCmd,
"set", "set",
ch.DNSName, ch.DNSName,
@ -80,7 +78,6 @@ func UnsetChallenge(ch *v1alpha1.ChallengeRequest) (bool, error) {
SetupWorkdir() // update workdir if any of the copied files were updated on host SetupWorkdir() // update workdir if any of the copied files were updated on host
return Execute( return Execute(
Shell, Shell,
// "-c",
AcmeAuthCmd, AcmeAuthCmd,
"unset", "unset",
ch.DNSName, ch.DNSName,
@ -155,7 +152,7 @@ func updateWorkdir() {
func createWorkdir() error { func createWorkdir() error {
finfo, err := os.Stat(Workdir) finfo, err := os.Stat(Workdir)
if os.IsNotExist(err) { if os.IsNotExist(err) {
klog.Infof("Creating folder \"%s\".", Workdir) klog.Infof("Creating folder \"%s\"", Workdir)
err = os.Mkdir(Workdir, 0755) err = os.Mkdir(Workdir, 0755)
if err != nil { if err != nil {
panic(err) panic(err)
@ -173,7 +170,7 @@ func updateIfStale(filename string, mode os.FileMode) error {
if result > 0 { if result > 0 {
err = CopyFile(sourceFile, destFile, mode) err = CopyFile(sourceFile, destFile, mode)
if err == nil { if err == nil {
klog.Infof("Updated \"%s\" from \"%s\" folder.", destFile, AcmeDir) klog.Infof("Updated \"%s\" from \"%s\" folder", destFile, AcmeDir)
} }
} }
return err return err

View File

@ -1,3 +1,3 @@
0.0.5-alpha.110 0.0.5-alpha.111
20240419-2130 20240419-2247
110 111