> On May 10, 2016, 5:50 p.m., Kevin Klues wrote:
> > src/docker/spec.cpp, line 164
> > <https://reviews.apache.org/r/47199/diff/1/?file=1378944#file1378944line164>
> >
> >     Is there always a "config" and a "container_config" (below) in every 
> > image? If not, won't we error out unnecessarily here?

I would say yes here, depending on docker image v1 spec.

And actually in our code base, this assumption has been there for a while:
https://github.com/apache/mesos/blob/c5bbd5af061a663ba4488a180fede3549e8082fa/src/docker/docker.cpp#L359~#L401

Please note that inside config or container_config, some fields should always 
have their sections, they can be `JSON::Null` or just `{}` or `[]`, but some 
fields are added after v1.0 spec so they may not be included in some old images.


> On May 10, 2016, 5:50 p.m., Kevin Klues wrote:
> > src/docker/spec.cpp, lines 171-174
> > <https://reviews.apache.org/r/47199/diff/1/?file=1378944#file1378944line171>
> >
> >     There are certainly not labels in every image. Is there always a 
> > section for them though, even if they are not present?  Maybe not, because 
> > you call `isSome()` later on, but then the error message here is confusing.

The error msg is a little confusing. Good catch, thanks!

How about `Failed to parse 'Labels' as a JSON object: ...`? 

For most images I inspected they all have the labels section, if no labels 
presented they will be `"Labels": {}` , and in docker they are defined as 
string-string map. Since `Labels` is not introduced in docker image v1.0 spec, 
so for some old images they may not show up.


- Gilbert


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/47199/#review132576
-----------------------------------------------------------


On May 10, 2016, 4:21 p.m., Gilbert Song wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/47199/
> -----------------------------------------------------------
> 
> (Updated May 10, 2016, 4:21 p.m.)
> 
> 
> Review request for mesos, Ben Mahler, Artem Harutyunyan, Jie Yu, and Kevin 
> Klues.
> 
> 
> Bugs: MESOS-5272
>     https://issues.apache.org/jira/browse/MESOS-5272
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Implemented parsing docker labels in v1 spec.
> 
> 
> Diffs
> -----
> 
>   src/docker/spec.cpp ac28331a17edb8c2ff81d5a2f79a794f869a3e5d 
> 
> Diff: https://reviews.apache.org/r/47199/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Gilbert Song
> 
>

Reply via email to