Skip to content

Commit

Permalink
Drop wait argument from image create (#622)
Browse files Browse the repository at this point in the history
This removes a useless parameter that was supposed to be removed on 2.3
release.
  • Loading branch information
simondeziel authored Jan 9, 2025
2 parents bcc8f60 + 6f56d45 commit 2284441
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion doc/source/images.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ methods:
And create through the following methods, there's also a copy method on an
image:

- `create(data, public=False, wait=True)` - Create a new image. The first
- `create(data, public=False)` - Create a new image. The first
argument is the binary data of the image itself. If the image is public,
set `public` to `True`.
- `create_from_simplestreams(server, alias, public=False, auto_update=False, wait=False)` -
Expand Down
2 changes: 1 addition & 1 deletion integration/test_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_create(self):

with open(path, "rb") as f:
data = f.read()
image = self.client.images.create(data, wait=True)
image = self.client.images.create(data)

self.assertEqual(fingerprint, image.fingerprint)

Expand Down
2 changes: 1 addition & 1 deletion pylxd/models/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def create(

if wait is False: # pragma: no cover
warnings.warn(
"Image.create wait parameter ignored and will be removed in " "2.3",
"Image.create wait parameter ignored and will be removed",
DeprecationWarning,
)

Expand Down
8 changes: 3 additions & 5 deletions pylxd/models/tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,15 @@ def test_all(self):
def test_create(self):
"""An image is created."""
fingerprint = hashlib.sha256(b"").hexdigest()
a_image = models.Image.create(self.client, b"", public=True, wait=True)
a_image = models.Image.create(self.client, b"", public=True)

self.assertIsInstance(a_image, models.Image)
self.assertEqual(fingerprint, a_image.fingerprint)

def test_create_with_metadata(self):
"""An image with metadata is created."""
fingerprint = hashlib.sha256(b"").hexdigest()
a_image = models.Image.create(
self.client, b"", metadata=b"", public=True, wait=True
)
a_image = models.Image.create(self.client, b"", metadata=b"", public=True)

self.assertIsInstance(a_image, models.Image)
self.assertEqual(fingerprint, a_image.fingerprint)
Expand All @@ -128,7 +126,7 @@ def test_create_with_metadata_streamed(self):
"""An image with metadata is created."""
fingerprint = hashlib.sha256(b"").hexdigest()
a_image = models.Image.create(
self.client, StringIO(""), metadata=StringIO(""), public=True, wait=True
self.client, StringIO(""), metadata=StringIO(""), public=True
)

self.assertIsInstance(a_image, models.Image)
Expand Down

0 comments on commit 2284441

Please sign in to comment.