pkg/oc/cli/admin/release/extract_tools: Fix false "did not contain" when not hashing
Stop warning:
$ oc adm release extract --command=openshift-install registry.svc.ci.openshift.org/openshift/origin-release:v4.0
error: image did not contain usr/bin/openshift-install
despite successfully extracting the binary.  The bug was from
(release: Support extracting the 'oc' and
'openshift-install' binaries, 2019-03-30,
@@ -311,15 +311,14 @@ func (o *ExtractOptions) extractCommand(command string) error {
klog.V(2).Infof("Unable to set extracted file modification time: %v", err)
}
- // calculate hashes
- if hash != nil {
func() {
extractLock.Lock()
defer extractLock.Unlock()
- hashByTargetName[layer.Mapping.To] = hex.EncodeToString(hash.Sum(nil))
delete(targetsByName, layer.Mapping.Name)
- }()
+ if hash != nil {
+ hashByTargetName[layer.Mapping.To] = hex.EncodeToString(hash.Sum(nil))
}
+ }()
return false, nil
}
