@@ -114,13 +114,10 @@ func NewLocalUpdater(cfg LocalUpdaterConfig, ns *Namespace) (*Updater, error) {
114
114
}
115
115
validator := Validator {Log : cfg .Log }
116
116
debugClient := debug .NewClient (filepath .Join (ns .dataDir , debugSocketFileName ))
117
- ok , err := hasSystemD ()
118
- systemdUnavailable := err == nil && ! ok
119
117
return & Updater {
120
118
Log : cfg .Log ,
121
119
Pool : certPool ,
122
120
InsecureSkipVerify : cfg .InsecureSkipVerify ,
123
- SystemDUnavailable : systemdUnavailable ,
124
121
UpdateConfigFile : filepath .Join (ns .Dir (), updateConfigName ),
125
122
TeleportConfigFile : ns .configFile ,
126
123
DefaultProxyAddr : ns .defaultProxyAddr ,
@@ -203,8 +200,6 @@ type Updater struct {
203
200
Pool * x509.CertPool
204
201
// InsecureSkipVerify skips TLS verification.
205
202
InsecureSkipVerify bool
206
- // SystemDUnavailable is true if SystemD is not available.
207
- SystemDUnavailable bool
208
203
// UpdateConfigFile contains the path to the agent auto-updates configuration.
209
204
UpdateConfigFile string
210
205
// TeleportConfigFile contains the path to Teleport's configuration.
@@ -273,6 +268,8 @@ var (
273
268
ErrNotNeeded = errors .New ("not needed" )
274
269
// ErrNotSupported is returned when the operation is not supported on the platform.
275
270
ErrNotSupported = errors .New ("not supported on this platform" )
271
+ // ErrNotAvailable is returned when the operation is not available at the current version of the platform.
272
+ ErrNotAvailable = errors .New ("not available at this version" )
276
273
// ErrNoBinaries is returned when no binaries are available to be linked.
277
274
ErrNoBinaries = errors .New ("no binaries available to link" )
278
275
// ErrFilePresent is returned when a file is present.
@@ -892,16 +889,15 @@ func (u *Updater) Setup(ctx context.Context, path string, restart bool) error {
892
889
return trace .Wrap (err , "failed to setup updater" )
893
890
}
894
891
895
- if u .SystemDUnavailable {
896
- u .Log .WarnContext (ctx , "Skipping all systemd setup because systemd is not running." )
897
- return nil
898
- }
899
-
900
892
present , err := u .Process .IsPresent (ctx )
901
893
if errors .Is (err , context .Canceled ) {
902
894
return trace .Errorf ("config check canceled" )
903
895
}
904
896
if errors .Is (err , ErrNotSupported ) {
897
+ u .Log .WarnContext (ctx , "Skipping all systemd setup because systemd is not running." )
898
+ return nil
899
+ }
900
+ if errors .Is (err , ErrNotAvailable ) {
905
901
u .Log .DebugContext (ctx , "Systemd version is outdated. Skipping SELinux verification." )
906
902
} else if err != nil {
907
903
return trace .Wrap (err , "failed to determine if new version of Teleport has an installed systemd service" )
@@ -926,13 +922,13 @@ func (u *Updater) Setup(ctx context.Context, path string, restart bool) error {
926
922
927
923
// notices displays final notices after install or update.
928
924
func (u * Updater ) notices (ctx context.Context ) error {
929
- if u .SystemDUnavailable {
925
+ enabled , err := u .Process .IsEnabled (ctx )
926
+ if errors .Is (err , ErrNotSupported ) {
930
927
u .Log .WarnContext (ctx , "Teleport is installed, but systemd is not present to start it." )
931
928
u .Log .WarnContext (ctx , "After configuring teleport.yaml, your system must also be configured to start Teleport." )
932
929
return nil
933
930
}
934
- enabled , err := u .Process .IsEnabled (ctx )
935
- if errors .Is (err , ErrNotSupported ) {
931
+ if errors .Is (err , ErrNotAvailable ) {
936
932
u .Log .WarnContext (ctx , "Remember to use systemctl to enable and start Teleport." )
937
933
return nil
938
934
}
@@ -1027,7 +1023,7 @@ func (u *Updater) LinkPackage(ctx context.Context) error {
1027
1023
return trace .Wrap (err , "failed to sync systemd configuration" )
1028
1024
} else {
1029
1025
present , err := u .Process .IsPresent (ctx )
1030
- if errors .Is (err , ErrNotSupported ) {
1026
+ if errors .Is (err , ErrNotAvailable ) {
1031
1027
u .Log .DebugContext (ctx , "Systemd version is outdated. Skipping SELinux verification." )
1032
1028
} else if err != nil {
1033
1029
return trace .Wrap (err , "failed to determine if Teleport has an installed systemd service" )
0 commit comments