Skip to content

Commit 1fa1ba1

Browse files
committed
move more setup to initializejoin func
1 parent e9126ce commit 1fa1ba1

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

cmd/installer/cli/install.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,7 @@ func printSuccessMessage(license *kotsv1beta1.License, networkInterface string)
12901290
divider := strings.Repeat("-", maxLength)
12911291

12921292
bold := "\033[1m"
1293-
logrus.Infof("\n%s%s\n%s\n%s%s%s", bold, divider, message, divider, resetFormatting)
1293+
logrus.Infof("\n%s%s\n%s\n%s%s", bold, divider, message, divider, resetFormatting)
12941294

12951295
return nil
12961296
}

cmd/installer/cli/join.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ func preRunJoin(flags *JoinCmdFlags) error {
9797

9898
flags.isAirgap = flags.airgapBundle != ""
9999

100-
// set the umask to 022 so that we can create files/directories with 755 permissions
101-
// this does not return an error - it returns the previous umask
102-
_ = syscall.Umask(0o022)
103-
104100
return nil
105101
}
106102

@@ -234,12 +230,6 @@ func runJoinVerifyAndPrompt(name string, flags JoinCmdFlags, jcmd *kotsadm.JoinC
234230
return fmt.Errorf("unable to write runtime config: %w", err)
235231
}
236232

237-
if err := os.Chmod(runtimeconfig.EmbeddedClusterHomeDirectory(), 0755); err != nil {
238-
// don't fail as there are cases where we can't change the permissions (bind mounts, selinux, etc...),
239-
// and we handle and surface those errors to the user later (host preflights, checking exec errors, etc...)
240-
logrus.Debugf("unable to chmod embedded-cluster home dir: %s", err)
241-
}
242-
243233
// check to make sure the version returned by the join token is the same as the one we are running
244234
if strings.TrimPrefix(jcmd.EmbeddedClusterVersion, "v") != strings.TrimPrefix(versions.Version, "v") {
245235
return fmt.Errorf("embedded cluster version mismatch - this binary is version %q, but the cluster is running version %q", versions.Version, jcmd.EmbeddedClusterVersion)
@@ -266,6 +256,16 @@ func initializeJoin(ctx context.Context, name string, flags JoinCmdFlags, jcmd *
266256
spinner := spinner.Start()
267257
spinner.Infof("Initializing")
268258

259+
// set the umask to 022 so that we can create files/directories with 755 permissions
260+
// this does not return an error - it returns the previous umask
261+
_ = syscall.Umask(0o022)
262+
263+
if err := os.Chmod(runtimeconfig.EmbeddedClusterHomeDirectory(), 0755); err != nil {
264+
// don't fail as there are cases where we can't change the permissions (bind mounts, selinux, etc...),
265+
// and we handle and surface those errors to the user later (host preflights, checking exec errors, etc...)
266+
logrus.Debugf("unable to chmod embedded-cluster home dir: %s", err)
267+
}
268+
269269
logrus.Debugf("materializing %s binaries", name)
270270
if err := materializeFiles(flags.airgapBundle); err != nil {
271271
spinner.Errorf("Initialization failed")

0 commit comments

Comments
 (0)