Fixes Issue 9677: Docker client errors out, when daemon flags are passed to docker subcommands#11418
Fixes Issue 9677: Docker client errors out, when daemon flags are passed to docker subcommands#11418shishir-a412ed wants to merge 1 commit intomoby:masterfrom
Conversation
8282f75 to
57d46e3
Compare
pkg/mflag/flag.go
Outdated
There was a problem hiding this comment.
I wish there was another way to do this because this is begging for this list to be out of sync.
Could you put this list in alphabetical order so its easier to visually compare it with the help text to see if something is missing?
There was a problem hiding this comment.
actually.... I know our flag setup code is kind of weird, but I wonder if it would be possible to put all daemon flags into a struct/table and then we have code iterate over that table to set all of the flags. Then we can reference that same table in this code AND in a testcase to validate it all.
Just a thought
|
@duglin right now docker flag parsing relies on one hashmap to classify whether the incoming argument is a flag or not. That map includes both daemon and global flags. Unless we use two maps to store daemon and global args separately, I don't see a way to avoid this extra map. N Separating IMHO would not be easy, it has dependencies everywhere. I will reorder the entries according to the help menu. And also add the deprecated flags which I have not added. Shishir |
|
@shishir-a412ed sorry if I wasn't clear. I wasn't talking about a map during parsing, I was talking about a map/struct during flag setup time. For example, if you look at the InstallFlags() func, that is what will register all of our daemon-side flags. And it does it via a list of flag.XXX calls. A hard coded list of calls. So knowing when a new one (like perhaps "-log-driver" at the end) is added is hard to detect when you also want to have your new code work. So, I was wondering if we could take all of the flag definitions from InstallFlags() and put them into a struct. InstallFlags() would then look over that struct to make all of the appropriate flag.XXX calls. |
|
@duglin N use the same struct/map to do the look-up for my use-case to identify if it's a daemon flag or not. Few open questions:
Nways let other maintainers jump in, and see what they feel. Shishir |
4fc9f5a to
a18e133
Compare
|
@duglin I have reordered the flags according to the help menu. ping @tiborvass Shishir |
|
@shishir-a412ed to your questions:
|
d346428 to
5f87f98
Compare
|
@duglin I have re-factored the code. Does this solve your concern ? |
5f87f98 to
8eb668e
Compare
daemon/config.go
Outdated
There was a problem hiding this comment.
Sorry but 9 times the same block of code? Really?
0d5029a to
64b206a
Compare
|
@icecrime Thanks, I have made the changes. Please check now. |
|
@shishir-a412ed I'm afraid this also needs to be rebased. The code looks good to me except for a minor comment. |
64b206a to
0adcf4c
Compare
1d1792c to
2eb566b
Compare
|
sorry needs rebase |
2eb566b to
3c6a80c
Compare
|
@jfrazelle I have rebased the PR. |
3c6a80c to
ad92395
Compare
|
@calavera I have changed this |
|
@shishir-a412ed it makes sense, thanks for fixing it. I think it would make sense to add a few tests to validate this behavior. I was also wondering if it would make sense to have two completely different |
|
We are planning on a more extensive patch to break these flags apart. But we need to do a lot of hacking for backwards compatibility. Sadly if we could go back to original docker and just have docker daemon ... All of this would be unnecessary... |
ad92395 to
2083248
Compare
|
@calavera I ll add the test cases in 1-2 days. Thanks. |
2083248 to
29088ba
Compare
29088ba to
f7b34f7
Compare
f7b34f7 to
42d52ab
Compare
f6d7cee to
db8fffa
Compare
…sed to docker subcommands Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com>
db8fffa to
bfc53fa
Compare
|
@calavera I have added the test cases. |
|
@shishir-a412ed Thanks for your work Shishir, I'll carry this PR and #10535 to get it in asap. |
|
Where is this going to be carried? |
|
Carried in #13771 |
Fixes #9677