mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-06 21:36:30 +00:00
remove Warning from restore item action output (#1318)
Signed-off-by: Steve Kriss <krisss@vmware.com>
This commit is contained in:
1
changelogs/unreleased/1318-skriss
Normal file
1
changelogs/unreleased/1318-skriss
Normal file
@@ -0,0 +1 @@
|
||||
remove Warning field from restore item action output
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2018 the Velero contributors.
|
||||
Copyright 2018, 2019 the Velero contributors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -117,7 +117,6 @@ func TestRestartableRestoreItemActionDelegatedFunctions(t *testing.T) {
|
||||
"color": "green",
|
||||
},
|
||||
},
|
||||
Warning: errors.Errorf("delegate warning"),
|
||||
}
|
||||
|
||||
runRestartableDelegateTests(
|
||||
|
||||
@@ -100,11 +100,6 @@ func (c *RestoreItemActionGRPCClient) Execute(input *velero.RestoreItemActionExe
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
var warning error
|
||||
if res.Warning != "" {
|
||||
warning = errors.New(res.Warning)
|
||||
}
|
||||
|
||||
var additionalItems []velero.ResourceIdentifier
|
||||
for _, itm := range res.AdditionalItems {
|
||||
newItem := velero.ResourceIdentifier{
|
||||
@@ -121,7 +116,6 @@ func (c *RestoreItemActionGRPCClient) Execute(input *velero.RestoreItemActionExe
|
||||
|
||||
return &velero.RestoreItemActionExecuteOutput{
|
||||
UpdatedItem: &updatedItem,
|
||||
Warning: warning,
|
||||
AdditionalItems: additionalItems,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -125,14 +125,8 @@ func (s *RestoreItemActionGRPCServer) Execute(ctx context.Context, req *proto.Re
|
||||
}
|
||||
}
|
||||
|
||||
var warnMessage string
|
||||
if executeOutput.Warning != nil {
|
||||
warnMessage = executeOutput.Warning.Error()
|
||||
}
|
||||
|
||||
res := &proto.RestoreItemActionExecuteResponse{
|
||||
Item: updatedItemJSON,
|
||||
Warning: warnMessage,
|
||||
Item: updatedItemJSON,
|
||||
}
|
||||
|
||||
for _, item := range executeOutput.AdditionalItems {
|
||||
|
||||
@@ -59,8 +59,7 @@ func (m *RestoreItemActionExecuteRequest) GetItemFromBackup() []byte {
|
||||
|
||||
type RestoreItemActionExecuteResponse struct {
|
||||
Item []byte `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"`
|
||||
Warning string `protobuf:"bytes,2,opt,name=warning" json:"warning,omitempty"`
|
||||
AdditionalItems []*ResourceIdentifier `protobuf:"bytes,3,rep,name=additionalItems" json:"additionalItems,omitempty"`
|
||||
AdditionalItems []*ResourceIdentifier `protobuf:"bytes,2,rep,name=additionalItems" json:"additionalItems,omitempty"`
|
||||
}
|
||||
|
||||
func (m *RestoreItemActionExecuteResponse) Reset() { *m = RestoreItemActionExecuteResponse{} }
|
||||
@@ -77,13 +76,6 @@ func (m *RestoreItemActionExecuteResponse) GetItem() []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *RestoreItemActionExecuteResponse) GetWarning() string {
|
||||
if m != nil {
|
||||
return m.Warning
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *RestoreItemActionExecuteResponse) GetAdditionalItems() []*ResourceIdentifier {
|
||||
if m != nil {
|
||||
return m.AdditionalItems
|
||||
@@ -204,24 +196,23 @@ var _RestoreItemAction_serviceDesc = grpc.ServiceDesc{
|
||||
func init() { proto.RegisterFile("RestoreItemAction.proto", fileDescriptor3) }
|
||||
|
||||
var fileDescriptor3 = []byte{
|
||||
// 293 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x51, 0x4d, 0x4e, 0xf3, 0x30,
|
||||
0x10, 0x95, 0xbf, 0x56, 0xad, 0x32, 0x5f, 0x05, 0xc2, 0x0b, 0xb0, 0x02, 0x88, 0xa8, 0x0b, 0x14,
|
||||
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2, 0x41,
|
||||
0xfc, 0x7f, 0x76, 0x9a, 0xf4, 0x7b, 0x49, 0x38, 0x3a, 0x5d, 0xd9, 0x14, 0x97, 0x19, 0x2a, 0x2f,
|
||||
0x1f, 0x24, 0x5a, 0xbe, 0xdd, 0x35, 0xfb, 0x20, 0x70, 0xb0, 0x93, 0x8d, 0x2e, 0x20, 0x98, 0x1b,
|
||||
0x53, 0x48, 0x74, 0xf7, 0x9a, 0x1e, 0x7f, 0x91, 0xec, 0xd1, 0x6e, 0x93, 0xe1, 0xc9, 0xf7, 0x9f,
|
||||
0xdd, 0x50, 0x2b, 0x18, 0x77, 0x73, 0xd2, 0x8b, 0xcd, 0x60, 0xbf, 0x9d, 0x27, 0xbc, 0xfc, 0x13,
|
||||
0xb7, 0xf5, 0x58, 0x8d, 0x9a, 0xb3, 0x5f, 0x7d, 0x06, 0x00, 0x00, 0xff, 0xff, 0x18, 0xd0, 0x19,
|
||||
0x9b, 0x2a, 0x02, 0x00, 0x00,
|
||||
// 280 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x51, 0xdb, 0x4a, 0x03, 0x31,
|
||||
0x10, 0x25, 0x6d, 0x69, 0xe9, 0x58, 0x14, 0xf3, 0xa0, 0x61, 0x55, 0x5c, 0xfa, 0x20, 0x8b, 0xc2,
|
||||
0x3e, 0xd4, 0x2f, 0xa8, 0x60, 0xa5, 0xaf, 0xd1, 0x1f, 0xd8, 0x6e, 0xc6, 0x1a, 0xdc, 0x4d, 0x62,
|
||||
0x2e, 0xe0, 0x9b, 0x9f, 0xe0, 0x27, 0xf9, 0x6b, 0xb2, 0x17, 0x97, 0xda, 0xaa, 0xf8, 0x96, 0x39,
|
||||
0x73, 0xce, 0x9c, 0x33, 0x19, 0x38, 0xe6, 0xe8, 0xbc, 0xb6, 0xb8, 0xf4, 0x58, 0xce, 0x73, 0x2f,
|
||||
0xb5, 0x4a, 0x8d, 0xd5, 0x5e, 0xd3, 0xf1, 0x1a, 0x15, 0xda, 0xcc, 0xa3, 0x88, 0x26, 0xf7, 0x4f,
|
||||
0x99, 0x45, 0xd1, 0x34, 0xa6, 0xef, 0x04, 0xce, 0x77, 0x44, 0xb7, 0xaf, 0x98, 0x07, 0x8f, 0x1c,
|
||||
0x5f, 0x02, 0x3a, 0x4f, 0x8f, 0x60, 0x68, 0x8a, 0xb0, 0x96, 0x8a, 0x91, 0x98, 0x24, 0x63, 0xde,
|
||||
0x56, 0x94, 0xc2, 0x40, 0x7a, 0x2c, 0x59, 0x2f, 0x26, 0xc9, 0x84, 0xd7, 0x6f, 0xca, 0x60, 0x64,
|
||||
0x9b, 0x71, 0xac, 0x5f, 0xc3, 0x5f, 0x25, 0xbd, 0x80, 0xfd, 0x8a, 0xb1, 0xb0, 0xba, 0xbc, 0xc9,
|
||||
0xf2, 0xe7, 0x60, 0xd8, 0xa0, 0x26, 0x6c, 0xa1, 0xd3, 0x37, 0x88, 0x7f, 0x0f, 0xe4, 0x8c, 0x56,
|
||||
0x0e, 0x3b, 0x67, 0xb2, 0xe1, 0x7c, 0x07, 0x07, 0x99, 0x10, 0xb2, 0xa2, 0x67, 0x45, 0x25, 0x75,
|
||||
0xac, 0x17, 0xf7, 0x93, 0xbd, 0xd9, 0x59, 0xda, 0x2d, 0x9f, 0x72, 0x74, 0x3a, 0xd8, 0x1c, 0x97,
|
||||
0x02, 0x95, 0x97, 0x8f, 0x12, 0x2d, 0xdf, 0x56, 0xcd, 0x3e, 0x08, 0x1c, 0xee, 0x24, 0xa0, 0x0b,
|
||||
0x18, 0xcf, 0x8d, 0x29, 0x24, 0xba, 0x07, 0x4d, 0x4f, 0x36, 0x46, 0x76, 0x68, 0xfb, 0x5d, 0xd1,
|
||||
0xe9, 0xcf, 0xcd, 0x36, 0xfa, 0x0a, 0x46, 0xed, 0x36, 0xf4, 0xf2, 0x7b, 0xb0, 0xbf, 0x6e, 0x10,
|
||||
0x5d, 0xfd, 0x8b, 0xdb, 0x78, 0xac, 0x86, 0xf5, 0x6d, 0xaf, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff,
|
||||
0xef, 0xe4, 0xd1, 0x78, 0x0f, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
@@ -12,8 +12,7 @@ message RestoreItemActionExecuteRequest {
|
||||
|
||||
message RestoreItemActionExecuteResponse {
|
||||
bytes item = 1;
|
||||
string warning = 2;
|
||||
repeated ResourceIdentifier additionalItems = 3;
|
||||
repeated ResourceIdentifier additionalItems = 2;
|
||||
}
|
||||
|
||||
service RestoreItemAction {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2017 the Velero contributors.
|
||||
Copyright 2017, 2019 the Velero contributors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -53,9 +53,7 @@ type RestoreItemActionExecuteInput struct {
|
||||
type RestoreItemActionExecuteOutput struct {
|
||||
// UpdatedItem is the item being restored mutated by ItemAction.
|
||||
UpdatedItem runtime.Unstructured
|
||||
// Warning is an exceptional message returned from ItemAction
|
||||
// which is not preventing the item from being restored.
|
||||
Warning error
|
||||
|
||||
// AdditionalItems is a list of additional related items that should
|
||||
// be restored.
|
||||
AdditionalItems []ResourceIdentifier
|
||||
@@ -67,9 +65,3 @@ func NewRestoreItemActionExecuteOutput(item runtime.Unstructured) *RestoreItemAc
|
||||
UpdatedItem: item,
|
||||
}
|
||||
}
|
||||
|
||||
// WithWarning returns a warning for RestoreItemActionExecuteOutput
|
||||
func (r *RestoreItemActionExecuteOutput) WithWarning(err error) *RestoreItemActionExecuteOutput {
|
||||
r.Warning = err
|
||||
return r
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2017 the Velero contributors.
|
||||
Copyright 2017, 2019 the Velero contributors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -203,7 +203,6 @@ func TestPodActionExecute(t *testing.T) {
|
||||
ItemFromBackup: &unstructured.Unstructured{Object: unstructuredPod},
|
||||
Restore: nil,
|
||||
})
|
||||
assert.Nil(t, res.Warning)
|
||||
|
||||
if test.expectedErr {
|
||||
assert.NotNil(t, err, "expected an error")
|
||||
|
||||
@@ -891,9 +891,6 @@ func (ctx *context) restoreItem(obj *unstructured.Unstructured, groupResource sc
|
||||
ItemFromBackup: itemFromBackup,
|
||||
Restore: ctx.restore,
|
||||
})
|
||||
if executeOutput.Warning != nil {
|
||||
addToResult(&warnings, namespace, fmt.Errorf("warning preparing %s: %v", resourceID, executeOutput.Warning))
|
||||
}
|
||||
if err != nil {
|
||||
addToResult(&errs, namespace, fmt.Errorf("error preparing %s: %v", resourceID, err))
|
||||
return warnings, errs
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2018 the Velero contributors.
|
||||
Copyright 2018, 2019 the Velero contributors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -95,7 +95,6 @@ func TestServiceAccountActionExecute(t *testing.T) {
|
||||
ItemFromBackup: &unstructured.Unstructured{Object: saUnstructured},
|
||||
Restore: nil,
|
||||
})
|
||||
require.NoError(t, res.Warning)
|
||||
require.NoError(t, err)
|
||||
|
||||
var resSA *corev1.ServiceAccount
|
||||
|
||||
Reference in New Issue
Block a user