Skip to content

Commit fc0bf4a

Browse files
committed
chore: lint
1 parent bc577fe commit fc0bf4a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

internal/cli/machine.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ import (
99
"github.com/psviderski/uncloud/internal/sshexec"
1010
)
1111

12-
// TODO: support pinning the script version to the CLI version.
13-
const installScriptURL = "https://raw.githubusercontent.com/psviderski/uncloud/refs/heads/main/scripts/install.sh"
12+
const (
13+
// TODO: support pinning the script version to the CLI version.
14+
installScriptURL = "https://raw.githubusercontent.com/psviderski/uncloud/refs/heads/main/scripts/install.sh"
15+
rootUser = "root"
16+
)
1417

1518
type RemoteMachine struct {
1619
User string
@@ -24,7 +27,7 @@ func installCmd(user string, version string) string {
2427
var env []string
2528

2629
// Add the SSH user (non-root) to the uncloud group to allow access to the Uncloud daemon unix socket.
27-
if user != "root" {
30+
if user != rootUser {
2831
sudoPrefix = "sudo"
2932
env = append(env, "UNCLOUD_GROUP_ADD_USER="+sshexec.Quote(user))
3033
}
@@ -46,7 +49,7 @@ func provisionMachine(ctx context.Context, exec sshexec.Executor, version string
4649
return fmt.Errorf("run whoami: %w", err)
4750
}
4851

49-
if user != "root" {
52+
if user != rootUser {
5053
// 'sudo -n' is not used because it fails with 'sudo: a password is required' when the user has no password
5154
// in /etc/shadow even though it may have valid sudo access.
5255
out, err := exec.Run(ctx, "sudo true")

0 commit comments

Comments
 (0)