Commit 96078cef authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Update management command to display user images

parent 8a931304
......@@ -36,9 +36,12 @@ from synnefo.plankton.backend import ImageBackend
class Command(BaseCommand):
help = "List public images or images available to a user."
option_list = BaseCommand.option_list + (
make_option('--user-id', dest='userid',
help="List all images available to that user"),
help="List all images available to that user."\
" If no user is specified, only public images"\
" are displayed."),
)
def handle(self, **options):
......
......@@ -29,6 +29,7 @@
#
from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
from synnefo.plankton.backend import ImageBackend
from pprint import pprint
......@@ -37,6 +38,10 @@ from pprint import pprint
class Command(BaseCommand):
args = "<image_id>"
help = "Display available information about an image"
option_list = BaseCommand.option_list + (
make_option('--user-id', dest='userid',
help="The ID of the owner of the Image."),
)
def handle(self, *args, **options):
......@@ -44,7 +49,8 @@ class Command(BaseCommand):
raise CommandError("Please provide an image ID")
image_id = args[0]
c = ImageBackend("")
userid = options['userid']
c = ImageBackend(userid) if userid else ImageBackend("")
image = c.get_image(image_id)
if not image:
......
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