Skip to content

Commit 5971606

Browse files
drich10claude
andcommitted
refactor: rename jobMFConsumes → boshConsumes
The jobMF prefix is overly specific to where the struct is used. boshConsumes better names what it represents: the BOSH job spec consumes schema (name/type/optional only). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 24e6670 commit 5971606

2 files changed

Lines changed: 11 additions & 12 deletions

File tree

internal/carvel/baker.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,9 @@ type boshLinkConsumer struct {
322322
Deployment string `yaml:"deployment,omitempty"`
323323
}
324324

325-
// jobMFConsumes is the subset of boshLinkConsumer fields that are valid in a
326-
// BOSH job.MF spec consumes list. From/Deployment are runtime-config-only and
327-
// must not appear in job.MF.
328-
type jobMFConsumes struct {
325+
// boshConsumes is the BOSH job spec consumes schema: name, type, and optional only.
326+
// From/Deployment are runtime-config-only and must not appear in the job spec.
327+
type boshConsumes struct {
329328
Name string `yaml:"name"`
330329
Type string `yaml:"type"`
331330
Optional bool `yaml:"optional"`
@@ -476,11 +475,11 @@ files:
476475
}
477476
deduped := b.deduplicateConsumes(allConsumes)
478477

479-
jobMFLinks := make([]jobMFConsumes, len(deduped))
478+
boshLinks := make([]boshConsumes, len(deduped))
480479
for i, c := range deduped {
481-
jobMFLinks[i] = jobMFConsumes{Name: c.Name, Type: c.Type, Optional: c.Optional}
480+
boshLinks[i] = boshConsumes{Name: c.Name, Type: c.Type, Optional: c.Optional}
482481
}
483-
registryDataSpec, err := buildRegistryDataSpec(registryDataTemplates, registryDataProperties, jobMFLinks)
482+
registryDataSpec, err := buildRegistryDataSpec(registryDataTemplates, registryDataProperties, boshLinks)
484483
if err != nil {
485484
return err
486485
}
@@ -496,7 +495,7 @@ files:
496495
// buildRegistryDataSpec constructs the job.MF content for the registry-data BOSH job.
497496
// It always includes the hardcoded cluster-info link and appends any additional links
498497
// collected from *.job-spec-overlay.yml sidecars in the packageinstalls/ directory.
499-
func buildRegistryDataSpec(templates, properties string, additionalLinks []jobMFConsumes) (string, error) {
498+
func buildRegistryDataSpec(templates, properties string, additionalLinks []boshConsumes) (string, error) {
500499
extraLinks := ""
501500
if len(additionalLinks) > 0 {
502501
data, err := yaml.Marshal(additionalLinks)

internal/carvel/baker_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ var _ = Describe("Carvel Baker", func() {
124124

125125
Context("buildRegistryDataSpec", func() {
126126
It("includes user-declared additional links after cluster-info", func() {
127-
links := []jobMFConsumes{
127+
links := []boshConsumes{
128128
{Name: "binding_cache", Type: "binding_cache", Optional: false},
129129
}
130130
spec, err := buildRegistryDataSpec("", "", links)
@@ -136,7 +136,7 @@ var _ = Describe("Carvel Baker", func() {
136136
})
137137

138138
It("marks optional links correctly", func() {
139-
links := []jobMFConsumes{
139+
links := []boshConsumes{
140140
{Name: "optional-link", Type: "some-type", Optional: true},
141141
}
142142
spec, err := buildRegistryDataSpec("", "", links)
@@ -154,7 +154,7 @@ var _ = Describe("Carvel Baker", func() {
154154
It("safely encodes link names containing YAML-special characters", func() {
155155
// yaml.Marshal quotes/blocks the value so it cannot inject extra YAML keys.
156156
// The real type field ("legit-type") must still appear at the correct level.
157-
links := []jobMFConsumes{
157+
links := []boshConsumes{
158158
{Name: "name: injected\ntype: evil", Type: "legit-type", Optional: false},
159159
}
160160
spec, err := buildRegistryDataSpec("", "", links)
@@ -163,7 +163,7 @@ var _ = Describe("Carvel Baker", func() {
163163
})
164164

165165
It("emits each unique link name only once given pre-deduplicated input", func() {
166-
links := []jobMFConsumes{
166+
links := []boshConsumes{
167167
{Name: "binding_cache", Type: "binding_cache", Optional: false},
168168
}
169169
spec, err := buildRegistryDataSpec("", "", links)

0 commit comments

Comments
 (0)