def ImagePull(self, image, storage, reg_type): p = Pull() args = self.Args() args.image = image args.storage = storage if reg_type != "": args.reg_type = reg_type p.set_args(args) return p.pull_image()
def ImagePull(self, image, storage='', reg_type=''): p = Pull() args = self.Args() args.image = image args.storage = None if storage == '' else storage args.reg_type = None if reg_type == '' else reg_type p.set_args(args) try: return p.pull_image() except Exception as e: raise dbus.DBusException(str(e))
def test_pull_by_digest_already_present(self): image_name = "docker.io/busybox@sha256:29f5d56d12684887bdfa50dcd29fc31eea4aaf4ad3bec43daf19026a7ce69912" db = DockerBackend() remote_img_obj = db._make_remote_image(image_name) remote_img_obj.remote_inspect = MagicMock(return_value=remote_inspect_info) remote_img_obj.populate_remote_inspect_info() db.make_remote_image = MagicMock(return_value=remote_img_obj) db._inspect_image = MagicMock(return_value=local_inspect_info) local_image_obj = db.inspect_image(image_name) db.has_image = MagicMock(return_value=local_image_obj) args = self.Args() args.image = image_name args.storage = 'docker' pull = Pull() pull.set_args(args) pull.be_utils.get_backend_from_string = MagicMock(return_value=db) pull.pull_image()