[lxc-devel] [lxd/master] Fix yaml rendering of composite structs

stgraber on Github lxc-bot at linuxcontainers.org
Fri Dec 23 18:19:45 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20161223/7f769bae/attachment.bin>
-------------- next part --------------
From b002f66f86c4609c3d99f89b6dada2d997eb2512 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 23 Dec 2016 13:18:53 -0500
Subject: [PATCH] Fix yaml rendering of composite structs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 shared/api/certificate.go | 4 ++--
 shared/api/container.go   | 4 ++--
 shared/api/image.go       | 8 ++++----
 shared/api/network.go     | 4 ++--
 shared/api/profile.go     | 4 ++--
 shared/api/response.go    | 2 +-
 shared/api/server.go      | 4 ++--
 7 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/shared/api/certificate.go b/shared/api/certificate.go
index 53dff42..e8ec0f3 100644
--- a/shared/api/certificate.go
+++ b/shared/api/certificate.go
@@ -2,7 +2,7 @@ package api
 
 // CertificatesPost represents the fields of a new LXD certificate
 type CertificatesPost struct {
-	CertificatePut
+	CertificatePut `yaml:",inline"`
 
 	Certificate string `json:"certificate"`
 	Password    string `json:"password"`
@@ -16,7 +16,7 @@ type CertificatePut struct {
 
 // Certificate represents a LXD certificate
 type Certificate struct {
-	CertificatePut
+	CertificatePut `yaml:",inline"`
 
 	Certificate string `json:"certificate"`
 	Fingerprint string `json:"fingerprint"`
diff --git a/shared/api/container.go b/shared/api/container.go
index a803a88..9068c1d 100644
--- a/shared/api/container.go
+++ b/shared/api/container.go
@@ -6,7 +6,7 @@ import (
 
 // ContainersPost represents the fields available for a new LXD container
 type ContainersPost struct {
-	ContainerPut
+	ContainerPut `yaml:",inline"`
 
 	Name   string          `json:"name"`
 	Source ContainerSource `json:"source"`
@@ -30,7 +30,7 @@ type ContainerPut struct {
 
 // Container represents a LXD container
 type Container struct {
-	ContainerPut
+	ContainerPut `yaml:",inline"`
 
 	CreatedAt       time.Time                    `json:"created_at"`
 	ExpandedConfig  map[string]string            `json:"expanded_config"`
diff --git a/shared/api/image.go b/shared/api/image.go
index 9bc3d0e..7b63385 100644
--- a/shared/api/image.go
+++ b/shared/api/image.go
@@ -6,7 +6,7 @@ import (
 
 // ImagesPost represents the fields available for a new LXD image
 type ImagesPost struct {
-	ImagePut
+	ImagePut `yaml:",inline"`
 
 	CompressionAlgorithm string            `json:"compression_algorithm"`
 	Filename             string            `json:"filename"`
@@ -22,7 +22,7 @@ type ImagePut struct {
 
 // Image represents a LXD image
 type Image struct {
-	ImagePut
+	ImagePut `yaml:",inline"`
 
 	Aliases      []ImageAlias `json:"aliases"`
 	Architecture string       `json:"architecture"`
@@ -59,7 +59,7 @@ type ImageSource struct {
 
 // ImageAliasesPost represents a new LXD image alias
 type ImageAliasesPost struct {
-	ImageAliasesEntry
+	ImageAliasesEntry `yaml:",inline"`
 }
 
 // ImageAliasesEntryPost represents the required fields to rename a LXD image alias
@@ -75,7 +75,7 @@ type ImageAliasesEntryPut struct {
 
 // ImageAliasesEntry represents a LXD image alias
 type ImageAliasesEntry struct {
-	ImageAliasesEntryPut
+	ImageAliasesEntryPut `yaml:",inline"`
 
 	Name string `json:"name"`
 }
diff --git a/shared/api/network.go b/shared/api/network.go
index 6486d75..ef44bef 100644
--- a/shared/api/network.go
+++ b/shared/api/network.go
@@ -2,7 +2,7 @@ package api
 
 // NetworksPost represents the fields of a new LXD network
 type NetworksPost struct {
-	NetworkPut
+	NetworkPut `yaml:",inline"`
 
 	Managed bool   `json:"managed"`
 	Name    string `json:"name"`
@@ -21,7 +21,7 @@ type NetworkPut struct {
 
 // Network represents a LXD network
 type Network struct {
-	NetworkPut
+	NetworkPut `yaml:",inline"`
 
 	Managed bool     `json:"managed"`
 	Name    string   `json:"name"`
diff --git a/shared/api/profile.go b/shared/api/profile.go
index e03260b..fb52957 100644
--- a/shared/api/profile.go
+++ b/shared/api/profile.go
@@ -2,7 +2,7 @@ package api
 
 // ProfilesPost represents the fields of a new LXD profile
 type ProfilesPost struct {
-	ProfilePut
+	ProfilePut `yaml:",inline"`
 
 	Name string `json:"name"`
 }
@@ -21,7 +21,7 @@ type ProfilePut struct {
 
 // Profile represents a LXD profile
 type Profile struct {
-	ProfilePut
+	ProfilePut `yaml:",inline"`
 
 	Name   string   `json:"name"`
 	UsedBy []string `json:"used_by"`
diff --git a/shared/api/response.go b/shared/api/response.go
index 3e25e74..846343f 100644
--- a/shared/api/response.go
+++ b/shared/api/response.go
@@ -6,7 +6,7 @@ import (
 
 // ResponseRaw represents a LXD operation in its original form
 type ResponseRaw struct {
-	Response
+	Response `yaml:",inline"`
 
 	Metadata interface{} `json:"metadata"`
 }
diff --git a/shared/api/server.go b/shared/api/server.go
index 952bba4..4790cea 100644
--- a/shared/api/server.go
+++ b/shared/api/server.go
@@ -34,8 +34,8 @@ type ServerUntrusted struct {
 
 // Server represents a LXD server
 type Server struct {
-	ServerPut
-	ServerUntrusted
+	ServerPut       `yaml:",inline"`
+	ServerUntrusted `yaml:",inline"`
 
 	Environment ServerEnvironment `json:"environment"`
 }


More information about the lxc-devel mailing list