From de1a9f5e7d10fcf1d09d659b0e32792397eb3ca4 Mon Sep 17 00:00:00 2001 From: arturrez <56270896+arturrez@users.noreply.github.com> Date: Mon, 14 Oct 2024 18:13:13 -0700 Subject: [PATCH] Local mkdir rootdir (#2245) * make sure rootDir exists * mv it to proper location * it's done before the start --- cmd/nodecmd/local.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/cmd/nodecmd/local.go b/cmd/nodecmd/local.go index e7227e673..39803f5da 100644 --- a/cmd/nodecmd/local.go +++ b/cmd/nodecmd/local.go @@ -183,6 +183,14 @@ func localStartNode(_ *cobra.Command, args []string) error { // check if this is existing cluster rootDir := app.GetLocalDir(clusterName) pluginDir := filepath.Join(rootDir, "node1", "plugins") + // make sure rootDir exists + if err := os.MkdirAll(rootDir, 0o700); err != nil { + return fmt.Errorf("could not create root directory %s: %w", rootDir, err) + } + // make sure pluginDir exists + if err := os.MkdirAll(pluginDir, 0o700); err != nil { + return fmt.Errorf("could not create plugin directory %s: %w", pluginDir, err) + } ctx, cancel := utils.GetANRContext() defer cancel() @@ -299,15 +307,6 @@ func localStartNode(_ *cobra.Command, args []string) error { defer os.Remove(upgradePath) } - // make sure rootDir exists - if err := os.MkdirAll(rootDir, 0o700); err != nil { - return fmt.Errorf("could not create root directory %s: %w", rootDir, err) - } - // make sure pluginDir exists - if err := os.MkdirAll(pluginDir, 0o700); err != nil { - return fmt.Errorf("could not create plugin directory %s: %w", pluginDir, err) - } - if stakingTLSKeyPath != "" && stakingCertKeyPath != "" && stakingSignerKeyPath != "" { if err := os.MkdirAll(filepath.Join(rootDir, "node1", "staking"), 0o700); err != nil { return fmt.Errorf("could not create root directory %s: %w", rootDir, err)