Skip to content
Snippets Groups Projects
Unverified Commit 329e9304 authored by dlorenc's avatar dlorenc Committed by GitHub
Browse files

Remove the fetchedExternalEntities bool. (#551)


This didn't appear to actually be useful on any of our types - we also
check the actual fields that need to be hydrated directly.

Signed-off-by: default avatarDan Lorenc <lorenc.d@gmail.com>
parent 2164914b
No related branches found
No related tags found
No related merge requests found
......@@ -52,10 +52,9 @@ func init() {
}
type V001Entry struct {
AlpineModel models.AlpineV001Schema
fetchedExternalEntities bool
keyObj pki.PublicKey
apkObj *alpine.Package
AlpineModel models.AlpineV001Schema
keyObj pki.PublicKey
apkObj *alpine.Package
}
func (v V001Entry) APIVersion() string {
......@@ -113,10 +112,6 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error {
}
func (v V001Entry) hasExternalEntities() bool {
if v.fetchedExternalEntities {
return false
}
if v.AlpineModel.Package != nil && v.AlpineModel.Package.URL.String() != "" {
return true
}
......@@ -127,10 +122,6 @@ func (v V001Entry) hasExternalEntities() bool {
}
func (v *V001Entry) fetchExternalEntities(ctx context.Context) error {
if v.fetchedExternalEntities {
return nil
}
if err := v.validate(); err != nil {
return types.ValidationError(err)
}
......@@ -268,7 +259,6 @@ func (v *V001Entry) fetchExternalEntities(ctx context.Context) error {
v.AlpineModel.Package.Hash.Value = swag.String(computedSHA)
}
v.fetchedExternalEntities = true
return nil
}
......
......@@ -52,11 +52,10 @@ func init() {
}
type V001Entry struct {
HelmObj models.HelmV001Schema
fetchedExternalEntities bool
keyObj pki.PublicKey
sigObj pki.Signature
provenanceObj *helm.Provenance
HelmObj models.HelmV001Schema
keyObj pki.PublicKey
sigObj pki.Signature
provenanceObj *helm.Provenance
}
func (v V001Entry) APIVersion() string {
......@@ -120,10 +119,6 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error {
}
func (v V001Entry) hasExternalEntities() bool {
if v.fetchedExternalEntities {
return false
}
if v.HelmObj.PublicKey != nil && v.HelmObj.PublicKey.URL.String() != "" {
return true
}
......@@ -135,10 +130,6 @@ func (v V001Entry) hasExternalEntities() bool {
}
func (v *V001Entry) fetchExternalEntities(ctx context.Context) error {
if v.fetchedExternalEntities {
return nil
}
if err := v.validate(); err != nil {
return types.ValidationError(err)
}
......@@ -246,7 +237,6 @@ func (v *V001Entry) fetchExternalEntities(ctx context.Context) error {
return err
}
v.fetchedExternalEntities = true
return nil
}
......
......@@ -56,11 +56,10 @@ func init() {
}
type V001Entry struct {
JARModel models.JarV001Schema
fetchedExternalEntities bool
jarObj *jarutils.JarSignature
keyObj pki.PublicKey
sigObj pki.Signature
JARModel models.JarV001Schema
jarObj *jarutils.JarSignature
keyObj pki.PublicKey
sigObj pki.Signature
}
func (v V001Entry) APIVersion() string {
......@@ -116,10 +115,6 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error {
}
func (v V001Entry) hasExternalEntities() bool {
if v.fetchedExternalEntities {
return false
}
if v.JARModel.Archive != nil && v.JARModel.Archive.URL.String() != "" {
return true
}
......@@ -127,10 +122,6 @@ func (v V001Entry) hasExternalEntities() bool {
}
func (v *V001Entry) fetchExternalEntities(ctx context.Context) error {
if v.fetchedExternalEntities {
return nil
}
if err := v.validate(); err != nil {
return types.ValidationError(err)
}
......@@ -206,7 +197,6 @@ func (v *V001Entry) fetchExternalEntities(ctx context.Context) error {
v.JARModel.Archive.Hash.Value = swag.String(computedSHA)
}
v.fetchedExternalEntities = true
return nil
}
......
......@@ -51,10 +51,9 @@ func init() {
}
type V001Entry struct {
RekordObj models.RekordV001Schema
fetchedExternalEntities bool
keyObj pki.PublicKey
sigObj pki.Signature
RekordObj models.RekordV001Schema
keyObj pki.PublicKey
sigObj pki.Signature
}
func (v V001Entry) APIVersion() string {
......@@ -68,13 +67,6 @@ func NewEntry() types.EntryImpl {
func (v V001Entry) IndexKeys() []string {
var result []string
if v.HasExternalEntities() {
if err := v.FetchExternalEntities(context.Background()); err != nil {
log.Logger.Error(err)
return result
}
}
key, err := v.keyObj.CanonicalValue()
if err != nil {
log.Logger.Error(err)
......@@ -113,10 +105,6 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error {
}
func (v V001Entry) HasExternalEntities() bool {
if v.fetchedExternalEntities {
return false
}
if v.RekordObj.Data != nil && v.RekordObj.Data.URL.String() != "" {
return true
}
......@@ -130,10 +118,6 @@ func (v V001Entry) HasExternalEntities() bool {
}
func (v *V001Entry) FetchExternalEntities(ctx context.Context) error {
if v.fetchedExternalEntities {
return nil
}
if err := v.validate(); err != nil {
return types.ValidationError(err)
}
......@@ -291,7 +275,6 @@ func (v *V001Entry) FetchExternalEntities(ctx context.Context) error {
v.RekordObj.Data.Hash.Value = swag.String(computedSHA)
}
v.fetchedExternalEntities = true
return nil
}
......
......@@ -54,10 +54,9 @@ func init() {
}
type V001Entry struct {
RPMModel models.RpmV001Schema
fetchedExternalEntities bool
keyObj pki.PublicKey
rpmObj *rpmutils.PackageFile
RPMModel models.RpmV001Schema
keyObj pki.PublicKey
rpmObj *rpmutils.PackageFile
}
func (v V001Entry) APIVersion() string {
......@@ -115,9 +114,6 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error {
}
func (v V001Entry) HasExternalEntities() bool {
if v.fetchedExternalEntities {
return false
}
if v.RPMModel.Package != nil && v.RPMModel.Package.URL.String() != "" {
return true
......@@ -129,9 +125,6 @@ func (v V001Entry) HasExternalEntities() bool {
}
func (v *V001Entry) FetchExternalEntities(ctx context.Context) error {
if v.fetchedExternalEntities {
return nil
}
if err := v.validate(); err != nil {
return types.ValidationError(err)
......@@ -273,7 +266,6 @@ func (v *V001Entry) FetchExternalEntities(ctx context.Context) error {
v.RPMModel.Package.Hash.Value = swag.String(computedSHA)
}
v.fetchedExternalEntities = true
return nil
}
......
......@@ -63,10 +63,9 @@ type BaseSigned struct {
}
type V001Entry struct {
TufObj models.TUFV001Schema
fetchedExternalEntities bool
keyObj pki.PublicKey
sigObj pki.Signature
TufObj models.TUFV001Schema
keyObj pki.PublicKey
sigObj pki.Signature
}
func (v V001Entry) APIVersion() string {
......@@ -138,9 +137,6 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error {
}
func (v V001Entry) hasExternalEntities() bool {
if v.fetchedExternalEntities {
return false
}
if v.TufObj.Metadata != nil && v.TufObj.Metadata.URL.String() != "" {
return true
......@@ -278,7 +274,6 @@ func (v *V001Entry) fetchExternalEntities(ctx context.Context) error {
return err
}
v.fetchedExternalEntities = true
return nil
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment