pkg/utils: Be more strict about what is acceptable
https://github.com/containers/toolbox/issues/1065
This commit is contained in:
parent
825c7e8594
commit
262c90e06f
1 changed files with 14 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright © 2019 – 2022 Red Hat Inc.
|
||||
* Copyright © 2019 – 2023 Red Hat Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -292,6 +292,19 @@ func GetEnvOptionsForPreservedVariables() []string {
|
|||
func GetFullyQualifiedImageFromDistros(image, release string) (string, error) {
|
||||
logrus.Debugf("Resolving fully qualified name for image %s from known registries", image)
|
||||
|
||||
if image == "" {
|
||||
panic("image not specified")
|
||||
}
|
||||
|
||||
if release == "" {
|
||||
panic("release not specified")
|
||||
}
|
||||
|
||||
if tag := ImageReferenceGetTag(image); tag != "" && release != tag {
|
||||
panicMsg := fmt.Sprintf("image %s does not match release %s", image, release)
|
||||
panic(panicMsg)
|
||||
}
|
||||
|
||||
if ImageReferenceHasDomain(image) {
|
||||
return image, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue