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

Convert ports before parsing. #1965

Closed
wants to merge 1 commit into from
Closed

Convert ports before parsing. #1965

wants to merge 1 commit into from

Conversation

piotrowski
Copy link
Contributor

@piotrowski piotrowski commented Jun 21, 2019

Refactor code to allow mixing notation with -p
Closes #1962

Signed-off-by: Aleksander Piotrowski apiotrowski312@gmail.com

- What I did
After refactoring and bug fixing. Docker provides better error message with invalid port:
docker run --rm -p 8080:87888888 busybox

and works with mixed notation like:
docker run --rm -p 8080:80 -p published=1500,target=444 busybox

- How I did it
I changed parsePortOpts, before it was iterating over all -p args and assuming that all of them are in the same notation. My fix is to iterate over all args and change every with = to short notation and then parse it.

- How to verify it
docker run --rm -p 8080:80 -p published=1500,target=444 busybox
docker run --rm -p 8080:87888888 busybox

- Description for the changelog
Fix a bug with parsing -p flag with mixed notation

- A picture of a cute animal (not mandatory but encouraged)

@codecov-io
Copy link

Codecov Report

Merging #1965 into master will increase coverage by 0.06%.
The diff coverage is 83.33%.

@@            Coverage Diff             @@
##           master    #1965      +/-   ##
==========================================
+ Coverage   56.72%   56.79%   +0.06%     
==========================================
  Files         310      310              
  Lines       21800    21802       +2     
==========================================
+ Hits        12367    12383      +16     
+ Misses       8518     8503      -15     
- Partials      915      916       +1

Refactor code to allow mixed notation with -p flag.
Closes #1962

Signed-off-by: Aleksander Piotrowski <apiotrowski312@gmail.com>
@thaJeztah
Copy link
Member

Thank you for contributing, and apologies for the delay: the original branch or repository for this PR was removed, so I carried your change in #2251, keeping your original sign-off. Thanks!

This was referenced Jan 16, 2020
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.

Port out of bounds gives error 'invalid publish opts format'
4 participants