Skip to content

Commit

Permalink
Bug 1625969 - Add metadata label check for local registry (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
dymurray authored Sep 7, 2018
1 parent 2033a32 commit 8f581fb
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion registries/adapters/local_openshift_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type containerConfig struct {

type imageMetadata struct {
ContainerConfig containerConfig `json:"ContainerConfig"`
Config containerConfig `json:"Config"`
}

const localOpenShiftName = "openshift-registry"
Expand Down Expand Up @@ -143,7 +144,17 @@ func (r LocalOpenShiftAdapter) loadSpec(image v1image.Image) (*bundle.Spec, erro
}
spec := &bundle.Spec{}

decodedSpecYaml, err := b64.StdEncoding.DecodeString(i.ContainerConfig.Labels.Spec)
metadataSpec := i.ContainerConfig.Labels.Spec
if metadataSpec == "" {
log.Debugf("Failed to find spec label in containerConfig metadata, checking Config")
if i.Config.Labels.Spec == "" {
log.Errorf("Failed to find spec label")
return nil, errors.New("spec label not found in metadata")
}
metadataSpec = i.Config.Labels.Spec
}

decodedSpecYaml, err := b64.StdEncoding.DecodeString(metadataSpec)
if err != nil {
log.Errorf("Failed to decode spec: %v", err)
return nil, err
Expand Down

0 comments on commit 8f581fb

Please sign in to comment.