X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=rwlaunchpad%2Fplugins%2Frwlaunchpadtasklet%2Frift%2Ftasklets%2Frwlaunchpad%2Fimage.py;h=8566d164b0f39bf6057b5bd3b0fd5804c0affa55;hb=refs%2Fchanges%2F77%2F5477%2F1;hp=b18e304df0f56210c8867fab36bb20535b859177;hpb=6364d016e7f819903ff29a2ce160cb4cea61bf8f;p=osm%2FSO.git diff --git a/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/image.py b/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/image.py index b18e304d..8566d164 100644 --- a/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/image.py +++ b/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/image.py @@ -43,7 +43,7 @@ class ImageUploader(object): self._client = client.UploadJobClient(self._log, self._loop, self._dts) - def upload_image(self, image_name, image_checksum, image_hdl): + def upload_image(self, image_name, image_checksum, image_hdl, set_image_property=None): endpoint = "http://127.0.0.1:9292" glance_client = glanceclient.Client('1', endpoint, token="asdf") @@ -60,15 +60,15 @@ class ImageUploader(object): image = glance_client.images.create(name=image_name, data=image_hdl, is_public="False", disk_format="qcow2", container_format="bare", - checksum=image_checksum) + checksum=image_checksum, properties=set_image_property) self._log.debug('Image upload complete: %s', image) except Exception as e: raise ImageUploadError("Failed to upload image to catalog: %s" % str(e)) from e - def upload_image_to_cloud_accounts(self, image_name, image_checksum, cloud_accounts=None): + def upload_image_to_cloud_accounts(self, image_name, image_checksum, project, cloud_accounts=None): self._log.debug("uploading image %s to all cloud accounts", image_name) - upload_job = self._client.create_job_threadsafe(image_name, image_checksum, cloud_accounts) + upload_job = self._client.create_job_threadsafe(image_name, image_checksum, project, cloud_accounts) try: upload_job.wait_until_complete_threadsafe() except client.UploadJobError as e: - raise ImageUploadError("Failed to upload image (image_name) to cloud accounts") from e + raise ImageUploadError("Failed to upload image " + image_name + " to cloud accounts") from e