Beispiel #1
0
 def post(self):
     args = reqparse.RequestParser() \
         .add_argument('repo_tag', required=True) \
         .add_argument('username') \
         .add_argument('password') \
         .parse_args()
     task_id = docker_client().pull_image(args.get('repo_tag'),
                                          username=args.get('username'),
                                          password=args.get('password'))
     return dict(task_id=task_id), 200
Beispiel #2
0
 def get(self):
     args = reqparse.RequestParser() \
         .add_argument('repo_tag', required=True) \
         .add_argument('with_cache', type=bool, default=False) \
         .parse_args()
     repo_tag = args.get('repo_tag')
     with_cache = args.get('with_cache')
     try:
         time = docker_client().estimate_image_hash_time(
             repo_tag, with_cache)
         return time, 200
     except docker.errors.NotFound as e:
         raise NotFound(json.loads(e.explanation))
Beispiel #3
0
 def post(self):
     args = reqparse.RequestParser() \
         .add_argument('repo_tag', required=True) \
         .add_argument('image_id', required=True) \
         .parse_args()
     repo_tag = args['repo_tag']
     image_id = args['image_id']
     d = DaoHubVerify()
     hash = docker_client().get_image_hash_with_cache(repo_tag)
     try:
         tx = d.registerImage(hash, repo_tag, image_id)
     except NotEnoughBalance:
         return dict(msg='not enough balance'), 402
     return dict(msg='ok', tx=tx), 200
Beispiel #4
0
 def get(self):
     args = reqparse.RequestParser() \
         .add_argument('task_id', required=True) \
         .parse_args()
     return docker_client().poll_pull_progress(
         task_id=args.get('task_id')), 200
Beispiel #5
0
 def post(self):
     args = reqparse.RequestParser() \
         .add_argument('repo_tag', required=True) \
         .parse_args()
     signed, verify = docker_client().verify_image_hash(args['repo_tag'])
     return dict(signed=signed, verify=verify)