-
Notifications
You must be signed in to change notification settings - Fork 2k
added check for empty source in bind mount #824
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
added check for empty source in bind mount #824
Conversation
8c3ab9d to
a4f863b
Compare
Codecov Report
@@ Coverage Diff @@
## master #824 +/- ##
=========================================
- Coverage 52.95% 51.7% -1.26%
=========================================
Files 244 244
Lines 15828 15827 -1
=========================================
- Hits 8382 8183 -199
- Misses 6892 7100 +208
+ Partials 554 544 -10 |
a4f863b to
28b7d94
Compare
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.
Small nits
cli/compose/loader/loader.go
Outdated
| } | ||
|
|
||
| if volume.Source == "" { | ||
| return errors.New("invalid mount config for type \"bind\": field Source must not be empty") |
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.
return errors.New(`invalid mount config for type "bind": field Source must not be empty`)is simpler 😄
cli/compose/loader/loader_test.go
Outdated
| - type: bind | ||
| target: /app | ||
| `) | ||
| require.Error(t, err) |
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.
require.EqualError(t, err, `invalid mount config for type "bind": field Source must not be empty`)28b7d94 to
1bafe67
Compare
Signed-off-by: Ethan Haynes <ethanhaynes@alumni.harvard.edu> fixed error by removing punctuation Signed-off-by: Ethan Haynes <ethanhaynes@alumni.harvard.edu> removed period Signed-off-by: Ethan Haynes <ethanhaynes@alumni.harvard.edu> backtick string to escape double quotes in error messages Signed-off-by: Ethan Haynes <ethanhaynes@alumni.harvard.edu> simplified test for bind no source error message Signed-off-by: Ethan Haynes <ethanhaynes@alumni.harvard.edu>
1bafe67 to
e76d8c9
Compare
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.
LGTM
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.
LGTM 🌮
cc @dnephin

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

Provides a fix for #820
fixes #820
- What I did
Fixed the bug that allowed a user to use a bind mount without a source in the compose file. Without providing a source the loader would add the path of the compose file.
- How I did it
Added error handing and explicit check for empty source in compose file. The loader now throws an error if it detects a bind mount without a source.
- How to verify it
1: make a docker-compose.yml file
2: run stack deploy commands
The output should be the following error:
invalid mount config for type "bind": field Source must not be empty