Skip to content

Commit

Permalink
Local mkdir rootdir (#2245)
Browse files Browse the repository at this point in the history
* make sure rootDir exists

* mv it to proper location

* it's done before the start
  • Loading branch information
arturrez authored Oct 15, 2024
1 parent c44c41b commit de1a9f5
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions cmd/nodecmd/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit de1a9f5

Please sign in to comment.