From 1e491ca6a2f28d5a44d1a11430693fa88506951a Mon Sep 17 00:00:00 2001 From: Nick Baker Date: Sun, 21 Jan 2024 01:31:25 +0000 Subject: [PATCH] cleanup unused helpers coupled to systemd --- nodeadm/internal/daemon/darwin_stubs.go | 15 --------------- nodeadm/internal/daemon/systemd.go | 19 ------------------- 2 files changed, 34 deletions(-) delete mode 100644 nodeadm/internal/daemon/darwin_stubs.go diff --git a/nodeadm/internal/daemon/darwin_stubs.go b/nodeadm/internal/daemon/darwin_stubs.go deleted file mode 100644 index 7023fa87c..000000000 --- a/nodeadm/internal/daemon/darwin_stubs.go +++ /dev/null @@ -1,15 +0,0 @@ -//go:build darwin - -package daemon - -import "io/fs" - -// no-op implementations to keep the project buildable on macOS - -func WriteSystemdServiceUnitDropIn(serviceName, fileName, fileContent string, filePerms fs.FileMode) error { - return nil -} - -func WriteSystemdServiceUnit(serviceName, unitContent string, filePerms fs.FileMode) error { - return nil -} diff --git a/nodeadm/internal/daemon/systemd.go b/nodeadm/internal/daemon/systemd.go index eb8d5ded7..3955e03a5 100644 --- a/nodeadm/internal/daemon/systemd.go +++ b/nodeadm/internal/daemon/systemd.go @@ -5,10 +5,7 @@ package daemon import ( "context" "fmt" - "io/fs" - "path" - "github.com/awslabs/amazon-eks-ami/nodeadm/internal/util" "github.com/coreos/go-systemd/dbus" ) @@ -105,19 +102,3 @@ func (m *systemdDaemonManager) Close() { func getServiceUnitName(name string) string { return fmt.Sprintf("%s.service", name) } - -func getServiceUnitDropInDir(name string) string { - return fmt.Sprintf("%s.d", getServiceUnitName(name)) -} - -const servicesRoot = "/etc/systemd/system" - -func WriteSystemdServiceUnitDropIn(serviceName, fileName, fileContent string, filePerms fs.FileMode) error { - dropInPath := path.Join(servicesRoot, getServiceUnitDropInDir(serviceName), fileName) - return util.WriteFileWithDir(dropInPath, []byte(fileContent), filePerms) -} - -func WriteSystemdServiceUnit(serviceName, unitContent string, filePerms fs.FileMode) error { - serviceUnitPath := path.Join(servicesRoot, getServiceUnitName(serviceName)) - return util.WriteFileWithDir(serviceUnitPath, []byte(unitContent), filePerms) -}