Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop wait argument from image create #622

Merged
merged 4 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -113,7 +113,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
Loading