Skip to content

Commit

Permalink
fix: don't regenerate passphrase if it already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
jyecusch authored Feb 20, 2024
1 parent 2b236ec commit 39dd965
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
9 changes: 1 addition & 8 deletions cmd/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ var stackUpdateCmd = &cobra.Command{
tui.CheckErr(err)

if len(stackFiles) == 0 {
// no stack files found
// print error with suggestion for user to run stack new
tui.CheckErr(fmt.Errorf("no stacks found in project, to create a new one run `nitric stack new`"))
}

Expand Down Expand Up @@ -325,12 +323,10 @@ nitric stack down -s aws -y`,
tui.CheckErr(err)

if len(stackFiles) == 0 {
// no stack files found
// print error with suggestion for user to run stack new
tui.CheckErr(fmt.Errorf("no stacks found in project root, to create a new one run `nitric stack new`"))
}

// Step 0. Get the stack file, or proomptyboi if more than 1.
// Step 0. Get the stack file, or prompt if more than 1.
stackSelection := stackFlag

if isNonInteractive() {
Expand Down Expand Up @@ -381,9 +377,6 @@ nitric stack down -s aws -y`,
proj, err := project.FromFile(fs, "")
tui.CheckErr(err)

// make provider from the provider name
// providerName := stackConfig.Provider

// Step 0a. Locate/Download provider where applicable.
prov, err := provider.NewProvider(stackConfig.Provider)
tui.CheckErr(err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/provider/pulumi/pulumi.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func EnsurePulumiPassphrase(fs afero.Fs) error {

func GetOrGeneratePassphraseFile(fs afero.Fs, isNonInteractive bool) (string, error) {
path := paths.NitricLocalPassphrasePath()
if _, err := afero.Exists(fs, path); err != nil {
if exists, err := afero.Exists(fs, path); err == nil && exists {
logger.Debugf("using existing passphrase file: %s", path)
return path, nil
}
Expand Down

0 comments on commit 39dd965

Please sign in to comment.