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

check if config comes from pipe and stat size is > 0 #306

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

pfeodrippe
Copy link

@pfeodrippe pfeodrippe commented May 25, 2017

Fixes #305

@pfeodrippe pfeodrippe changed the title check if the config comes from pipe and stat size > 0 check if the config comes from pipe and stat size is > 0 May 25, 2017
@pfeodrippe pfeodrippe changed the title check if the config comes from pipe and stat size is > 0 check if config comes from pipe and stat size is > 0 May 25, 2017
Copy link
Contributor

@Joshua-Anderson Joshua-Anderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the fix!
These changes didn't quite work for me though 😢

test.sh:

deis config:push -p filename
$ ./test.sh < test
# read from pipe, not filename

However, you could switch the order of checks, checking if there is a filename defined before reading from Stdin, and that should solve the problem

Also, deis config:pull uses very similar code, so it would be great if that was patched up too.

@pfeodrippe
Copy link
Author

@Joshua-Anderson Ok, I'll test better this weekend o/.
deis config:pull didn't give me any trouble, but I'll check on it too

@pfeodrippe
Copy link
Author

pfeodrippe commented May 27, 2017

@Joshua-Anderson You can see at this gist the test cli, it tests multiple cases for the deis config:push inputs.

You can download the dev deis binary zipped (it will be updated if needed) I've built for testing.

Maybe we could put these tests as part of the build tests (of course, changing the scripts accordingly for automation).

deis config:pull doesn't use stdin, so no need to modify it =)

@pfeodrippe
Copy link
Author

pfeodrippe commented May 27, 2017

And how could I give a default to docopt-go at the help doc and override it at code? Maybe it can say to us if the path came from the terminal or from the default value. You can see I'm using a hacked name for the path (.no-file)

@codecov-io
Copy link

codecov-io commented May 30, 2017

Codecov Report

Merging #306 into master will decrease coverage by 0.24%.
The diff coverage is 40%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #306      +/-   ##
==========================================
- Coverage   72.71%   72.47%   -0.25%     
==========================================
  Files          59       59              
  Lines        4109     4193      +84     
==========================================
+ Hits         2988     3039      +51     
- Misses        793      821      +28     
- Partials      328      333       +5
Impacted Files Coverage Δ
cmd/cmd.go 66.66% <ø> (ø) ⬆️
cmd/config.go 48.97% <0%> (+5.07%) ⬆️
parser/config.go 86.25% <100%> (+0.32%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7313b43...806f3ad. Read the comment docs.

-p <path>, --path=<path>
a path leading to an environment file [default: .env]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for giving you bad advice here about checking filepath first. I completely forgot about the .env default. It would be nice if we didn't have to go down this route, as it feels a little hacky.

So much for the easy solution 😄. I guess we do need to find the correct Sdin mode. If I have some time I'll help you experiment with this this week.

As for similar code in config:pull, here it is. It uses Stout, which means that redirecting a bash scripts output would likely run into similar issues to this.

Thanks so much for working on this and I apologize again for giving you bad advice 😢!

@pfeodrippe
Copy link
Author

Ok, man, no worries :) I'll try to work on it at the weekend.
Let's check at the config:pull too o/

@vdice vdice added this to the v2.16 milestone May 31, 2017
@vdice
Copy link
Member

vdice commented Jul 3, 2017

@pfeodrippe is work on this PR still in progress? The next release (v2.16) is currently scheduled for this week and would be great to get this fix in!

@pfeodrippe
Copy link
Author

@vdice I'll have more time only after 2017-07-17, sorry =, but I'll keep working at this PR, maybe it will enter at v2.17?

@mboersma mboersma modified the milestones: v2.17, v2.16 Jul 5, 2017
@vdice
Copy link
Member

vdice commented Jul 5, 2017

@pfeodrippe No problems; sounds great! 👍

@mboersma mboersma modified the milestones: v2.18, v2.17 Aug 1, 2017
@mboersma
Copy link
Member

mboersma commented Aug 9, 2017

@pfeodrippe do you think this is something you can finish up in time for the September v2.18 release, or should we close this?

@pfeodrippe
Copy link
Author

@mboersma ok, gonna work on it until the September version

@mboersma mboersma removed this from the v2.18 milestone Sep 7, 2017
@Cryptophobia
Copy link

Would you like to make this PR towards the fork of Deis - Hephy? Here is the link: https://github.com/teamhephy/workflow-cli

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

Successfully merging this pull request may close these issues.

6 participants