Inspects a docker image

    Returns: Parsed JSON data
326756
def docker_inspect(image):
    '''
    '''
    args = ['docker', 'inspect', '--type', 'image', image]
    p = Popen(args, stdout = subprocess.PIPE, stderr = subprocess.PIPE)

    stdout, stderr = p.communicate()
    stdout = stdout.decode('utf-8')
    stderr = stderr.decode('utf-8')

    if not p.returncode == 0:
        if 'no such image' in stderr.lower():
            raise NoSuchImageError(image)
        raise DockerError('Failed to inspect image: {}'.format(stderr.strip()))

    return json.loads(stdout)[0]
289997
def _create_json(self):
        
        data_json = {
            "rclass": "local",
            "key": self.name,
            "description": self.description,
            "packageType": self.packageType,
            "notes": "",
            "includesPattern": "**/*",
            "excludesPattern": "",
            "repoLayoutRef": self.repoLayoutRef,
            "dockerApiVersion": self.dockerApiVersion,
            "checksumPolicyType": "client-checksums",
            "handleReleases": True,
            "handleSnapshots": True,
            "maxUniqueSnapshots": 0,
            "snapshotVersionBehavior": "unique",
            "suppressPomConsistencyChecks": True,
            "blackedOut": False,
            "propertySets": [],
            "archiveBrowsingEnabled": self.archiveBrowsingEnabled,
            "yumRootDepth": 0,
        }
        return data_json
560444
def show(uuid):
    '''
    
    '''
    ret = {}

    if _is_uuid(uuid) or _is_docker_uuid(uuid):
        cmd = 'imgadm show {0}'.format(uuid)
        res = __salt__['cmd.run_all'](cmd, python_shell=False)
        retcode = res['retcode']
        if retcode != 0:
            ret['Error'] = _exit_status(retcode, res['stderr'])
        else:
            ret = salt.utils.json.loads(res['stdout'])
    else:
        ret['Error'] = "{} is not a valid uuid.".format(uuid)

    return ret
707842
private static JSONArray parseDockers(ArrayList<Point> dockers) throws JSONException {
        if (dockers != null) {
            JSONArray dockersArray = new JSONArray();

            for (Point docker : dockers) {
                JSONObject dockerObject = new JSONObject();

                dockerObject.put("x",
                                 docker.getX().doubleValue());
                dockerObject.put("y",
                                 docker.getY().doubleValue());

                dockersArray.put(dockerObject);
            }

            return dockersArray;
        }

        return new JSONArray();
    }
1123195
def json_data(self, instance, default=[]):
        
        value = self.get(instance)
        out = map(api.get_url_info, value)
        return out or default
1238677
def parse_rc_json():
    
    fname = '.yasirc.json'
    path = os.path.expanduser('~/' + fname)
    if os.path.exists(fname):
        path = os.path.abspath(fname)
    elif not os.path.exists(path):
        path = ''
    content = ''
    if path:
        with open(path) as f:
            content = f.read()
    ret = {}
    if content:
        ret = json.loads(content)
    return collections.defaultdict(dict, ret)
1172814
def getJson(cls, url, method='GET', headers={}, data=None, socket=None, timeout=120):
        
        if not 'Content-Type' in headers:
            headers['Content-Type'] = ['application/json']

        body = yield cls().getBody(url, method, headers, data, socket, timeout)

        defer.returnValue(json.loads(body))
1137418
def json(self, *,  # type: ignore
             loads: Callable[[Any], Any]=json.loads) -> None:
        
        return loads(self.data)
352579
def parse_image_json(text):
    
    image_details = json.loads(text)
    if image_details.get('Images') is not None:
        try:
            image_details = image_details.get('Images')[0]
        except IndexError:
            image_details = None
    return image_details
1275715
def inspect(self):
        """"""
        results = {}
        for fname in dir(self):
            if not fname.startswith('_'):
                value = getattr(self, fname)
                if isinstance(value, collections.Callable):
                    continue
                results[fname] = value
        return results
1127268
def _get_image_information(self):
        
        result = yield from self.manager.query("GET", "images/{}/json".format(self._image))
        return result
860793
def json_data(self, instance, default=None):
        
        value = self.get(instance)
        if not value:
            return ""
        if callable(value):
            value = value()
        return api.to_iso_date(value, default=default)
455017
def inspect_built_image(self):
        
        logger.info("inspecting built image '%s'", self.image_id)
        self.ensure_is_built()
        # dict with lots of data, see man docker-inspect
        inspect_data = self.tasker.inspect_image(self.image_id)
        return inspect_data
15718
async def inspect(self, service_id: str) -> Mapping[str, Any]:
        

        response = await self.docker._query_json(
            "services/{service_id}".format(service_id=service_id), method="GET"
        )
        return response
300470
def read_json(self):
        
        with reading_ancillary_files(self):
            metadata = super(GenericLayerMetadata, self).read_json()

        return metadata
844943
public function inspectJson()
    {
        if (!empty($this->json_columns)) {
            foreach ($this->json_columns as $column_name) {
                if (!in_array($column_name, static::$protected_columns)) {
                    $this->processJson($column_name, $this->attributes[$column_name]);
                }
            }
        }
    }
1087254
def base_image_inspect(self):
        
        if self._base_image_inspect is None:

            if self.base_from_scratch:
                self._base_image_inspect = {}
            elif self.parents_pulled or self.custom_base_image:
                try:
                    self._base_image_inspect = self.tasker.inspect_image(self.base_image)

                except docker.errors.NotFound:
                    # If the base image cannot be found throw KeyError -
                    # as this property should behave like a dict
                    raise KeyError("Unprocessed base image Dockerfile cannot be inspected")
            else:
                self._base_image_inspect =\
                    atomic_reactor.util.get_inspect_for_image(self.base_image,
                                                              self.base_image.registry,
                                                              self.base_image_insecure,
                                                              self.base_image_dockercfg_path)

            base_image_str = str(self.base_image)
            if base_image_str not in self._parent_images_inspect:
                self._parent_images_inspect[base_image_str] = self._base_image_inspect

        return self._base_image_inspect