Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local mkdir rootdir #2245

Merged
merged 3 commits into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
// 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 @@
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 Expand Up @@ -351,7 +350,7 @@
spinner := spinSession.SpinToUser("Booting Network. Wait until healthy...")
if _, err := cli.Start(ctx, avalancheGoBinPath, anrOpts...); err != nil {
ux.SpinFailWithError(spinner, "", err)
localDestroyNode(nil, []string{clusterName})

Check failure on line 353 in cmd/nodecmd/local.go

View workflow job for this annotation

GitHub Actions / Lint

Error return value is not checked (errcheck)
return fmt.Errorf("failed to start local avalanchego: %w", err)
}
ux.SpinComplete(spinner)
Expand Down Expand Up @@ -415,7 +414,7 @@
func localDestroyNode(_ *cobra.Command, args []string) error {
clusterName := args[0]

localStopNode(nil, nil)

Check failure on line 417 in cmd/nodecmd/local.go

View workflow job for this annotation

GitHub Actions / Lint

Error return value is not checked (errcheck)

rootDir := app.GetLocalDir(clusterName)
if err := os.RemoveAll(rootDir); err != nil {
Expand Down
Loading