sregistry/main/google_build/query.py
def container_query(self, query, quiet=False):
    '''search for a specific container.
       This function would likely be similar to the above, but have different
       filter criteria from the user (based on the query)
    '''
    results = self._list_containers()

    matches = []
    for result in results:
        for key,val in result.metadata.items():
            if query in val and result not in matches:
                matches.append(result)

    if not quiet:
        bot.info("[gs://%s] Found %s containers" %(self._bucket_name,len(matches)))
        for image in matches:
            size = round(image.size / (1024*1024.0))
            bot.custom(prefix=image.name, color="CYAN")
            bot.custom(prefix='id:     ', message=image.id)
            bot.custom(prefix='uri:    ', message=image.metadata['name'])
            bot.custom(prefix='updated:', message=image.updated)
            bot.custom(prefix='size:  ',  message=' %s MB' %(size))
            bot.custom(prefix='md5:    ', message=image.md5_hash)
            if "public_url" in image.metadata:
                public_url = image.metadata['public_url']
                bot.custom(prefix='url:    ', message=public_url)
            bot.newline()
    return matches
def container_query(self, query, quiet=False):
    '''search for a specific container.
       This function would likely be similar to the above, but have different
       filter criteria from the user (based on the query)
    '''
    results = self._list_containers()

    matches = []
    for result in results:
        for key,val in result.metadata.items():
            if query in val and result not in matches:
                matches.append(result)

    if not quiet:
        bot.info("[gs://%s] Found %s containers" %(self._bucket_name,len(matches)))
        for image in matches:
            size = round(image.size / (1024*1024.0))
            bot.custom(prefix=image.name, color="CYAN")
            bot.custom(prefix='id:     ', message=image.id)
            bot.custom(prefix='uri:    ', message=image.metadata['name'])
            bot.custom(prefix='updated:', message=image.updated)
            bot.custom(prefix='size:  ',  message=' %s MB' %(size))
            bot.custom(prefix='md5:    ', message=image.md5_hash)
            if "public_url" in image.metadata:
                public_url = image.metadata['public_url']
                bot.custom(prefix='url:    ', message=public_url)
            bot.newline()
    return matches
search for a specific container.
       This function would likely be similar to the above, but have different
       filter criteria from the user (based on the query)