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

blueprint: add cacert customization #4487

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions internal/blueprint/blueprint.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,13 @@ func Convert(bp Blueprint) iblueprint.Blueprint {

customizations.RHSM = &irhsm
}

if ca := c.CACerts; ca != nil {
ica := iblueprint.CACustomization{
PEMCerts: ca.PEMCerts,
}
customizations.CACerts = &ica
}
}

ibp := iblueprint.Blueprint{
Expand Down
6 changes: 6 additions & 0 deletions internal/blueprint/blueprint_convert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ func TestConvert(t *testing.T) {
},
},
},
CACerts: &CACustomization{
PEMCerts: []string{"pem-cert"},
},
},
Distro: "distro",
},
Expand Down Expand Up @@ -401,6 +404,9 @@ func TestConvert(t *testing.T) {
},
},
},
CACerts: &iblueprint.CACustomization{
PEMCerts: []string{"pem-cert"},
},
},
Distro: "distro",
},
Expand Down
5 changes: 5 additions & 0 deletions internal/blueprint/customizations.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type Customizations struct {
Installer *InstallerCustomization `json:"installer,omitempty" toml:"installer,omitempty"`
RPM *RPMCustomization `json:"rpm,omitempty" toml:"rpm,omitempty"`
RHSM *RHSMCustomization `json:"rhsm,omitempty" toml:"rhsm,omitempty"`
CACerts *CACustomization `json:"cacerts,omitempty" toml:"cacerts,omitempty"`
}

type IgnitionCustomization struct {
Expand Down Expand Up @@ -135,6 +136,10 @@ type OpenSCAPJSONTailoringCustomizations struct {
Filepath string `json:"filepath,omitempty" toml:"filepath,omitempty"`
}

type CACustomization struct {
PEMCerts []string `json:"pem_certs,omitempty" toml:"pem_certs,omitempty"`
}

type CustomizationError struct {
Message string
}
Expand Down
6 changes: 6 additions & 0 deletions internal/cloudapi/v2/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,12 @@ func (request *ComposeRequest) GetBlueprintFromCustomizations() (blueprint.Bluep
bp.Customizations.RHSM = bpRhsm
}

if cacerts := request.Customizations.Cacerts; cacerts != nil {
bp.Customizations.CACerts = &blueprint.CACustomization{
PEMCerts: cacerts.PemCerts,
}
}

// Did bp.Customizations get set at all? If not, set it back to nil
if reflect.DeepEqual(*bp.Customizations, blueprint.Customizations{}) {
bp.Customizations = nil
Expand Down
Loading
Loading