The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6266
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) ===
From a6847910e9a9d973a91d52761feb990431284ef1 Mon Sep 17 00:00:00 2001 From: Louise Montalvo <louanmonta...@gmail.com> Date: Mon, 30 Sep 2019 16:39:28 -0500 Subject: [PATCH 1/3] api: Add images_expiry API extension Signed-off-by: Louise Montalvo <louanmonta...@gmail.com> --- doc/api-extensions.md | 3 +++ shared/version/api.go | 1 + 2 files changed, 4 insertions(+) diff --git a/doc/api-extensions.md b/doc/api-extensions.md index 5708222afe..8016a5a5ea 100644 --- a/doc/api-extensions.md +++ b/doc/api-extensions.md @@ -838,3 +838,6 @@ Extends the disk resource API struct to include: - Block size - Firmware version - Serial number + +## images\_expiry +This allows for editing of the expiry date on images. diff --git a/shared/version/api.go b/shared/version/api.go index d6d182821d..7d457eda6d 100644 --- a/shared/version/api.go +++ b/shared/version/api.go @@ -167,6 +167,7 @@ var APIExtensions = []string{ "instances", "image_types", "resources_disk_sata", + "images_expiry", } // APIExtensionsCount returns the number of available API extensions. From 6193a7621e68e6ead8846ccc6f5ccd2df7c79d91 Mon Sep 17 00:00:00 2001 From: Oscar Ward <oscarwar...@gmail.com> Date: Mon, 30 Sep 2019 16:54:06 -0500 Subject: [PATCH 2/3] shared/api: Make image ExpiryDate modifiable Signed-off-by: Oscar Ward <oscarwar...@gmail.com> --- shared/api/image.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/api/image.go b/shared/api/image.go index eb0dac527b..9210a338a4 100644 --- a/shared/api/image.go +++ b/shared/api/image.go @@ -41,6 +41,7 @@ type ImagePut struct { AutoUpdate bool `json:"auto_update" yaml:"auto_update"` Properties map[string]string `json:"properties" yaml:"properties"` Public bool `json:"public" yaml:"public"` + ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"` } // Image represents a LXD image @@ -59,7 +60,6 @@ type Image struct { Type string `json:"type" yaml:"type"` CreatedAt time.Time `json:"created_at" yaml:"created_at"` - ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"` LastUsedAt time.Time `json:"last_used_at" yaml:"last_used_at"` UploadedAt time.Time `json:"uploaded_at" yaml:"uploaded_at"` } From 89dc10057ccb0897e4da69db3e5d4a884e8da7b7 Mon Sep 17 00:00:00 2001 From: Louise Montalvo <louanmonta...@gmail.com> Date: Mon, 30 Sep 2019 17:01:35 -0500 Subject: [PATCH 3/3] lxd: Make image ExpiryDate modifiable Signed-off-by: Louise Montalvo <louanmonta...@gmail.com> --- lxd/images.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lxd/images.go b/lxd/images.go index 6b29a5216b..cf728bbe89 100644 --- a/lxd/images.go +++ b/lxd/images.go @@ -1571,6 +1571,11 @@ func imagePut(d *Daemon, r *http.Request) response.Response { return response.BadRequest(err) } + // Get ExpiresAt + if !req.ExpiresAt.IsZero() { + info.ExpiresAt = req.ExpiresAt + } + err = d.cluster.ImageUpdate(id, info.Filename, info.Size, req.Public, req.AutoUpdate, info.Architecture, info.CreatedAt, info.ExpiresAt, req.Properties) if err != nil { return response.SmartError(err)
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel