mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilbert Song <songzihao1...@gmail.com>
Subject Re: Review Request 49661: Ignore null entries for Docker inspect's 'HostConfig.Devices' field.
Date Tue, 05 Jul 2016 23:00:04 GMT

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




src/docker/docker.cpp (line 365)
<https://reviews.apache.org/r/49661/#comment206238>

    This patch should work correctly, but using a `json.find` here seems a little not accurate
to me.
    
    The reason is that we do a `json.find<JSON::Array>` above and `JSON::Null` would
be regarded as an error case, but actually it isn't. We just want to skip it.
    
    More pratically, could we consider doing `json.find<JSON::Value>` first and then
convert it to be a JSON array if it is not null.
    
    ```
    Result<JSON::Value> devicesArray =
      json.find<JSON::Value>("HostConfig.Devices");
      
    if (devicesArray.isError()) {
      return Error();
    }
    
    if (devicesArray.isSome() && !devicesArray.get().is<JSON::NULL>()) {
      if (!devicesArray.is<JSON::Array>()) {
        return Error();
      }
      
      const vector<JSON::Value>& values =
        devicesArray.get().as<JSON::Array>().values;
        
      ...
    }
    ```
    
    Can follow examples on docker/docker.cpp `Docker::Image::create()`.


- Gilbert Song


On July 5, 2016, 3:15 p.m., Benjamin Mahler wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/49661/
> -----------------------------------------------------------
> 
> (Updated July 5, 2016, 3:15 p.m.)
> 
> 
> Review request for mesos, Gilbert Song and Kevin Klues.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This now contains an empty array when no devices are present.
> However, it appears that Docker previously used null entries
> to represent the same scenario.
> 
> 
> Diffs
> -----
> 
>   src/docker/docker.cpp aad5380f5848f1b49d5524032f3b5b18c2aa1c56 
> 
> Diff: https://reviews.apache.org/r/49661/diff/
> 
> 
> Testing
> -------
> 
> sudo ./bin/mesos-tests.sh --gtest_filter="*DockerTest.*"
> 
> 
> Thanks,
> 
> Benjamin Mahler
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message