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

porter credentials generate fails with no directory found #377

Closed
vdice opened this issue Jun 4, 2019 · 1 comment · Fixed by #381
Closed

porter credentials generate fails with no directory found #377

vdice opened this issue Jun 4, 2019 · 1 comment · Fixed by #381

Comments

@vdice
Copy link
Member

vdice commented Jun 4, 2019

On a fresh install of the latest porter release (via https://porter.sh/install/), when I go to generate credentials, say, for the examples/wordpress bundle in this repo, it fails with the following:

 $ porter credentials generate
Generating new credential wordpress from bundle wordpress
==> 1 credentials required for bundle wordpress
? How would you like to set credential "kubeconfig" environment variable
? Enter the environment variable that will be used to set credential "kubeconfig" foo
Saving credential to /Users/vdice/.porter/credentials/wordpress.yaml
Error: couldn't write credential file /Users/vdice/.porter/credentials/wordpress.yaml: open /Users/vdice/.porter/credentials/wordpress.yaml: no such file or directory

 $ ls -haltr ~/.porter
total 88M
drwxr-xr-x    7 vdice staff  224 May 31 16:35 mixins
drwxr-xr-x    5 vdice staff  160 Jun  4 13:11 bundles
drwxr-xr-x    3 vdice staff   96 Jun  4 13:11 claims
drwxr-xr-x    7 vdice staff  224 Jun  4 13:13 .
-rwxr-xr-x    1 vdice staff  41M Jun  4 13:26 porter
-rwxr-xr-x    1 vdice staff  46M Jun  4 13:26 porter-runtime
drwxr-xr-x+ 184 vdice staff 5.8K Jun  4 13:28 ..

 $ porter version
porter v0.7.0-ralpha.1+englishrose (83471fb)

It appears that the credentials sub-directory isn't auto-created... but may need to be. Does this sound like the right diagnosis?

@jeremyrickard
Copy link
Contributor

@vdice yeah, I think we should probably add a MkDir (or MkdirAll? it doesnt fail if it exists just does nothing) to make sure it exists?

jeremyrickard added a commit to jeremyrickard/porter that referenced this issue Jun 5, 2019
This adds a call to MkdirAll with the credentials path before we
attempt to write the credential file. This will ensure that the
credential directory exists before we try and write the file. If the
directory exists already, it's a NO-OP.

Fixes getporter#377
jeremyrickard added a commit that referenced this issue Jun 5, 2019
* Add a call to MkdirAll for the credentials directory path.

This adds a call to MkdirAll with the credentials path before we
attempt to write the credential file. This will ensure that the
credential directory exists before we try and write the file. If the
directory exists already, it's a NO-OP.

Fixes #377

* Oopps didn't handle the error

* Cleanup test for readability
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants