def do_show_boxes(self, args): """ Show all the boxes in the system """ from candelabra.boxes import boxes_storage_factory boxes_storage = boxes_storage_factory() for box_name, box in boxes_storage.boxes.iteritems(): logger.info('box info:') logger.info('%s = %s', box_name, box)
def run(self, args, command): """ Run the command """ logger.info('running command "%s"', command) boxes_storage = boxes_storage_factory() if args.box_name is None: raise ImportException('no name provided for the box') if boxes_storage.has_box(args.box_name): raise ImportException('there is already a box called "%s"', args.box_name) if args.box_url is None: raise ImportException('no URL provided for importing the box "%s"', args.box_name) box = boxes_storage.get_box(name=args.box_name, url=args.box_url) box.do_download()