Commit 8af5f221 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

List all images in snf-manage image-list

Until now 'snf-manage image-list' management command printed only images
that were public, or accessible by a specific user. This commit changes
this command to print all images (regardless of the owner).
parent 96a3cbf6
......@@ -32,7 +32,7 @@ from django.core.management.base import BaseCommand
from optparse import make_option
from synnefo.webproject.management.utils import pprint_table
from synnefo.plankton.backend import ImageBackend
from synnefo.plankton.utils import image_backend
class Command(BaseCommand):
......@@ -41,17 +41,18 @@ class Command(BaseCommand):
make_option(
'--user-id',
dest='userid',
default=None,
help="List all images available to that user."
" If no user is specified, only public images"
" are displayed."),
)
def handle(self, **options):
userid = options['userid']
user = options['userid']
c = ImageBackend(userid) if userid else ImageBackend("")
images = c.list()
images.sort(key=lambda x: x['created_at'], reverse=True)
with image_backend(user) as backend:
images = backend._list_images(user)
images.sort(key=lambda x: x['created_at'], reverse=True)
headers = ("id", "name", "owner", "public")
table = []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment