sregistry/main/docker/api.py
def get_config(self, key="Entrypoint", delim=None):
    '''get_config returns a particular key (default is Entrypoint)
        from a VERSION 1 manifest obtained with get_manifest.

        Parameters
        ==========
        key: the key to return from the manifest config
        delim: Given a list, the delim to use to join the entries.
        Default is newline

    '''
    if not hasattr(self,'manifests'):
        bot.error('Please retrieve manifests for an image first.')
        sys.exit(1)

    cmd = None

    # If we didn't find the config value in version 2
    for version in ['config', 'v1']:
        if cmd is None and 'config' in self.manifests:
            
            # First try, version 2.0 manifest config has upper level config
            manifest = self.manifests['config']
            if "config" in manifest:
                if key in manifest['config']:
                    cmd = manifest['config'][key]

            # Second try, config manifest (not from verison 2.0 schema blob)

            if cmd is None and "history" in manifest:
                for entry in manifest['history']:
                    if 'v1Compatibility' in entry:
                        entry = json.loads(entry['v1Compatibility'])
                        if "config" in entry:
                            if key in entry["config"]:
                                cmd = entry["config"][key]

    # Standard is to include commands like ['/bin/sh']
    if isinstance(cmd, list):
        if delim is not None:
            cmd = delim.join(cmd)
    bot.verbose("Found Docker config (%s) %s" % (key, cmd))
    return cmd
def get_config(self, key="Entrypoint", delim=None):
    '''get_config returns a particular key (default is Entrypoint)
        from a VERSION 1 manifest obtained with get_manifest.

        Parameters
        ==========
        key: the key to return from the manifest config
        delim: Given a list, the delim to use to join the entries.
        Default is newline

    '''
    if not hasattr(self,'manifests'):
        bot.error('Please retrieve manifests for an image first.')
        sys.exit(1)

    cmd = None

    # If we didn't find the config value in version 2
    for version in ['config', 'v1']:
        if cmd is None and 'config' in self.manifests:
            
            # First try, version 2.0 manifest config has upper level config
            manifest = self.manifests['config']
            if "config" in manifest:
                if key in manifest['config']:
                    cmd = manifest['config'][key]

            # Second try, config manifest (not from verison 2.0 schema blob)

            if cmd is None and "history" in manifest:
                for entry in manifest['history']:
                    if 'v1Compatibility' in entry:
                        entry = json.loads(entry['v1Compatibility'])
                        if "config" in entry:
                            if key in entry["config"]:
                                cmd = entry["config"][key]

    # Standard is to include commands like ['/bin/sh']
    if isinstance(cmd, list):
        if delim is not None:
            cmd = delim.join(cmd)
    bot.verbose("Found Docker config (%s) %s" % (key, cmd))
    return cmd
def get_config ( self , key = "Entrypoint" , delim = None ) : if not hasattr ( self , 'manifests' ) : bot . error ( 'Please retrieve manifests for an image first.' ) sys . exit ( 1 ) cmd = None # If we didn't find the config value in version 2 for version in [ 'config' , 'v1' ] : if cmd is None and 'config' in self . manifests : # First try, version 2.0 manifest config has upper level config manifest = self . manifests [ 'config' ] if "config" in manifest : if key in manifest [ 'config' ] : cmd = manifest [ 'config' ] [ key ] # Second try, config manifest (not from verison 2.0 schema blob) if cmd is None and "history" in manifest : for entry in manifest [ 'history' ] : if 'v1Compatibility' in entry : entry = json . loads ( entry [ 'v1Compatibility' ] ) if "config" in entry : if key in entry [ "config" ] : cmd = entry [ "config" ] [ key ] # Standard is to include commands like ['/bin/sh'] if isinstance ( cmd , list ) : if delim is not None : cmd = delim . join ( cmd ) bot . verbose ( "Found Docker config (%s) %s" % ( key , cmd ) ) return cmd
get_config returns a particular key (default is Entrypoint)
        from a VERSION 1 manifest obtained with get_manifest.

        Parameters
        ==========
        key: the key to return from the manifest config
        delim: Given a list, the delim to use to join the entries.
        Default is newline
get_config returns a particular key ( default is Entrypoint ) from a VERSION 1 manifest obtained with get_manifest .