def __call__(self, args, extra_args=None): log = logging.getLogger('ListImages') log.debug("args: '%s' extra_args: '%s'" % (args, extra_args)) #TODO: impliment sharedwith calls repo = RepomanClient(config.host, config.port, config.proxy) if args.all: func = repo.list_all_images kwargs = {} elif args.group and not args.user: func = repo.list_images_shared_with_group kwargs = {'group':args.group} elif args.user and not args.group: if args.sharedwith: func = repo.list_images_shared_with_user kwargs = {'user':args.user} else: func = repo.list_user_images kwargs = {'user':args.user} else: if args.sharedwith: # shared with you func = repo.list_images_shared_with_user kwargs = {} else: func = repo.list_current_user_images kwargs = {} log.debug("function: '%s'" % func) log.debug("kwargs: '%s'" % kwargs) try: images = func(**kwargs) display.display_image_list(images, long=args.long) except RepomanError, e: print e.message sys.exit(1)
def __call__(self, args, extra_args=None): log = logging.getLogger('ListImages') log.debug("args: '%s' extra_args: '%s'" % (args, extra_args)) #TODO: impliment sharedwith calls repo = RepomanClient(config.host, config.port, config.proxy) if args.all: func = repo.list_all_images kwargs = {} elif args.group and not args.user: func = repo.list_images_shared_with_group kwargs = {'group': args.group} elif args.user and not args.group: if args.sharedwith: func = repo.list_images_shared_with_user kwargs = {'user': args.user} else: func = repo.list_user_images kwargs = {'user': args.user} else: if args.sharedwith: # shared with you func = repo.list_images_shared_with_user kwargs = {} else: func = repo.list_current_user_images kwargs = {} log.debug("function: '%s'" % func) log.debug("kwargs: '%s'" % kwargs) try: images = func(**kwargs) display.display_image_list(images, long=args.long) except RepomanError, e: print e.message sys.exit(1)
def __call__(self, args, extra_args=None): #TODO: impliment sharedwith calls repo = RepomanClient(config.host, config.port, config.proxy) if args.all: kwargs = {'list_all':True} elif args.group and not args.user: kwargs = {'group':args.group} elif args.user and not args.group: if args.sharedwith: pass else: kwargs = {'user':args.user} else: if args.sharedwith: pass else: kwargs = {} try: images = repo.list_images(**kwargs) display.display_image_list(images, long=args.long) except RepomanError, e: print e.message sys.exit(1)
log.debug('Listing images owned by current user.') kwargs = {} images = self.get_repoman_client(args).list_current_user_images(**kwargs) # Get the metadata of each image. # TODO: This is a non-efficient hack that will be cleaned-up later. (Andre) log.debug('Images:\n%s\n' % (images)) for image in images: try: name = image.rsplit('/', 2) log.debug('Fetching image metadata for "%s" [%s]' % (image, name)) images_metadata.append(self.get_repoman_client(args).describe_image("%s/%s" % (name[-2], name[-1]))) except RepomanError, e: print "Warning: Error in retreiving information about image '%s'. Skipping..." % (image) except Exception, e: raise RepomanError(self, "Error in retreiving information about image '%s'." % (image), e) except RepomanError, e: raise SubcommandFailure(self, 'Error listing image(s).', e) # Remove duplicates first images_metadata_dedup = [] for i in images_metadata: if i not in images_metadata_dedup: images_metadata_dedup.append(i) display.display_image_list(images_metadata_dedup, short_output=args.short, full_output=full_output, urls=args.url)