Matches ctl version to upstream
This commit is contained in:
@@ -5,15 +5,19 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
const DefaultSecond = 1_000_000_000
|
||||
|
||||
func EnsureServiceRunning(ctx context.Context, r *Runner, svc string) error {
|
||||
|
||||
if _, err := r.Run(ctx, " rc-service", svc, "status"); err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
klog.Infof("Starting service: %q", svc)
|
||||
_, err := r.RunRetry(ctx, RetryOptions{
|
||||
Attempts: 3,
|
||||
Delay: 2 * DefaultSecond,
|
||||
|
||||
12
clitools/pkg/system/hostname_linux.go
Normal file
12
clitools/pkg/system/hostname_linux.go
Normal file
@@ -0,0 +1,12 @@
|
||||
//go:build linux
|
||||
|
||||
package system
|
||||
|
||||
import "golang.org/x/sys/unix"
|
||||
|
||||
func SetHostname(hostname string) error {
|
||||
if hostname == "" {
|
||||
return nil
|
||||
}
|
||||
return unix.Sethostname([]byte(hostname))
|
||||
}
|
||||
8
clitools/pkg/system/hostname_stub.go
Normal file
8
clitools/pkg/system/hostname_stub.go
Normal file
@@ -0,0 +1,8 @@
|
||||
//go:build !linux
|
||||
|
||||
package system
|
||||
|
||||
func SetHostname(hostname string) error {
|
||||
// intentionally a no-op
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user