-
Notifications
You must be signed in to change notification settings - Fork 295
Automatically creates the token auth file if it isn't present #439
Automatically creates the token auth file if it isn't present #439
Conversation
Codecov Report
@@ Coverage Diff @@
## master #439 +/- ##
==========================================
+ Coverage 40.75% 40.79% +0.04%
==========================================
Files 37 37
Lines 2660 2662 +2
==========================================
+ Hits 1084 1086 +2
Misses 1418 1418
Partials 158 158
Continue to review full report at Codecov.
|
|
||
// Auto-creates the auth token file, useful for those coming from previous versions of kube-aws | ||
if _, err := os.Stat(authTokenPath); os.IsNotExist(err) { | ||
os.OpenFile(authTokenPath, os.O_RDONLY|os.O_CREATE, 0600) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost nit but wouldn't it be safer to close the opened file afterwards?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argh, forgot to close it. 😓
@mumoshu just to let you know, feel free not to merge my PRs unless they are 100% according to your standards regarding code style, quality, and so on; just give me your feedback and I'll try to address them ASAP.
1 nit but LGTM overall 👍 |
Thanks! I just tend to merge a PR if it looks 90% ok so that contributors
won't suffer from potential conflicts and rebasing while making a tiny fix.
Of course there's no problem for me to adjust to you.
2017年3月23日(木) 22:12 Daniel Martins <[email protected]>:
… ***@***.**** commented on this pull request.
------------------------------
In core/controlplane/config/token_config.go
<#439 (comment)>
:
> @@ -152,6 +153,12 @@ func (r *EncryptedAuthTokensOnDisk) Compact() (*CompactAuthTokens, error) {
func ReadOrEncryptAuthTokens(dirname string, encryptor CachedEncryptor) (*EncryptedAuthTokensOnDisk, error) {
authTokenPath := filepath.Join(dirname, "tokens.csv")
+
+ // Auto-creates the auth token file, useful for those coming from previous versions of kube-aws
+ if _, err := os.Stat(authTokenPath); os.IsNotExist(err) {
+ os.OpenFile(authTokenPath, os.O_RDONLY|os.O_CREATE, 0600)
Argh, forgot to close it. 😓
@mumoshu <https://github.com/mumoshu> just to let you know, feel free not
to merge my PRs unless they are 100% according to your standards regarding
code style, quality, and so on; just give me your feedback and I'll try to
address them ASAP.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#439 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABV-UydaxSmodmykbxX2W6lww9_ySPGks5rom-2gaJpZM4Ml_kl>
.
|
…token-file Automatically creates the token auth file if it isn't present
This PR improves UX after #418, hopefully avoiding issues like this.