Skip to content
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
1 change: 1 addition & 0 deletions stemcell/stemcell.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type Manifest struct {
AgentFeatures []string `yaml:"agent_features,omitempty"`
ApiVersion int `yaml:"api_version,omitempty"`
CloudProperties biproperty.Map `yaml:"cloud_properties"`
ExtraFields map[string]any `yaml:",inline" json:"-"`
Comment thread
mkocher marked this conversation as resolved.
Resolved
}

// SupportsAgentFeature reports capabilities advertised for the packaged agent.
Expand Down
22 changes: 22 additions & 0 deletions stemcell/stemcell_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
boshcmdfakes "github.com/cloudfoundry/bosh-utils/fileutil/fakes"
biproperty "github.com/cloudfoundry/bosh-utils/property"
fakesys "github.com/cloudfoundry/bosh-utils/system/fakes"
"gopkg.in/yaml.v2"
)

var _ = Describe("Stemcell", func() {
Expand Down Expand Up @@ -47,6 +48,27 @@ var _ = Describe("Stemcell", func() {
Expect(stemcell.Manifest()).To(Equal(manifest))
})

It("round-trips unrecognized top-level manifest fields", func() {
const contents = `
name: test-stemcell
version: '1234'
operating_system: ubuntu-resolute
sha1: test-checksum
bosh_protocol: '1'
cloud_properties: {infrastructure: azure}
example_metadata:
items: [one, two]
options: {enabled: false, revision: 3}
example_null: null
example_empty: []
`
Expect(yaml.Unmarshal([]byte(contents), &manifest)).To(Succeed())

encoded, err := yaml.Marshal(manifest)
Expect(err).NotTo(HaveOccurred())
Expect(encoded).To(MatchYAML(contents))
})

Context("when stemcell.MF contains api_version", func() {
BeforeEach(func() {
manifest = Manifest{
Expand Down
Loading