Skip to content

Commit

Permalink
Adds migrate-specific error message
Browse files Browse the repository at this point in the history
  • Loading branch information
seans3 committed Nov 10, 2020
1 parent 999487e commit 50b4756
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions pkg/live/dual-delegating-provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,29 @@ func (cp *DualDelegatingProvider) ManifestReader(reader io.Reader, args []string
return nil, inventory.NoInventoryObjError{}
}
if rgInv != nil && cmInv != nil {
return nil, inventory.MultipleInventoryObjError{
InventoryObjectTemplates: []*unstructured.Unstructured{rgInv, cmInv},
return nil, MultipleInventoryObjError{
InvObjs: []*unstructured.Unstructured{rgInv, cmInv},
}
}
cp.calcInventory = true
return &CachedManifestReader{objs: objs}, nil
}

// MultipleInventoryObjError is thrown when more than one inventory
// objects is detected.
type MultipleInventoryObjError struct {
InvObjs []*unstructured.Unstructured
}

const multipleInventoryErrorStr = `Detected ResourceGroup (Kptfile) and deprecated ConfigMap (inventory-template.yaml)
inventory objects. Please run "kpt live migrate" to complete upgrade to
ResourceGroup inventory object.
`

func (g MultipleInventoryObjError) Error() string {
return multipleInventoryErrorStr
}

// CachedManifestReader implements ManifestReader, storing objects to return.
type CachedManifestReader struct {
objs []*unstructured.Unstructured
Expand Down

0 comments on commit 50b4756

Please sign in to comment.