@@ -30,32 +30,32 @@ func NewGatewayFqdnDeployer(tfPluginClient *TFPluginClient) GatewayFQDNDeployer
30
30
func (d * GatewayFQDNDeployer ) Validate (ctx context.Context , gw * workloads.GatewayFQDNProxy ) error {
31
31
sub := d .tfPluginClient .SubstrateConn
32
32
if err := validateAccountBalanceForExtrinsics (sub , d .tfPluginClient .Identity ); err != nil {
33
- return err
33
+ return d . tfPluginClient . sentry . error ( err )
34
34
}
35
35
36
36
if err := gw .Validate (); err != nil {
37
- return err
37
+ return d . tfPluginClient . sentry . error ( err )
38
38
}
39
39
40
40
nodeClient , err := d .tfPluginClient .NcPool .GetNodeClient (sub , gw .NodeID )
41
41
if err != nil {
42
- return errors .Wrapf (err , "failed to get node client with ID %d" , gw .NodeID )
42
+ return d . tfPluginClient . sentry . error ( errors .Wrapf (err , "failed to get node client with ID %d" , gw .NodeID ) )
43
43
}
44
44
45
45
cfg , err := nodeClient .NetworkGetPublicConfig (ctx )
46
46
if err != nil {
47
- return errors .Wrapf (err , "couldn't get node %d public config" , gw .NodeID )
47
+ return d . tfPluginClient . sentry . error ( errors .Wrapf (err , "couldn't get node %d public config" , gw .NodeID ) )
48
48
}
49
49
50
50
if cfg .IPv4 .IP == nil {
51
- return errors .Errorf ("node %d doesn't contain a public IP in its public config" , gw .NodeID )
51
+ return d . tfPluginClient . sentry . error ( errors .Errorf ("node %d doesn't contain a public IP in its public config" , gw .NodeID ) )
52
52
}
53
53
54
- return client .AreNodesUp (ctx , sub , []uint32 {gw .NodeID }, d .tfPluginClient .NcPool )
54
+ return d . tfPluginClient . sentry . error ( client .AreNodesUp (ctx , sub , []uint32 {gw .NodeID }, d .tfPluginClient .NcPool ) )
55
55
}
56
56
57
57
// GenerateVersionlessDeployments generates deployments for gatewayFqdn deployer without versions
58
- func (d * GatewayFQDNDeployer ) GenerateVersionlessDeployments (ctx context.Context , gw * workloads.GatewayFQDNProxy ) (map [uint32 ]zosTypes.Deployment , error ) {
58
+ func (d * GatewayFQDNDeployer ) generateVersionlessDeployments (ctx context.Context , gw * workloads.GatewayFQDNProxy ) (map [uint32 ]zosTypes.Deployment , error ) {
59
59
deployments := make (map [uint32 ]zosTypes.Deployment )
60
60
var err error
61
61
@@ -74,12 +74,12 @@ func (d *GatewayFQDNDeployer) GenerateVersionlessDeployments(ctx context.Context
74
74
// Deploy deploys the GatewayFQDN deployments using the deployer
75
75
func (d * GatewayFQDNDeployer ) Deploy (ctx context.Context , gw * workloads.GatewayFQDNProxy ) error {
76
76
if err := d .Validate (ctx , gw ); err != nil {
77
- return err
77
+ return d . tfPluginClient . sentry . error ( err )
78
78
}
79
79
80
- newDeployments , err := d .GenerateVersionlessDeployments (ctx , gw )
80
+ newDeployments , err := d .generateVersionlessDeployments (ctx , gw )
81
81
if err != nil {
82
- return errors .Wrap (err , "could not generate deployments data" )
82
+ return d . tfPluginClient . sentry . error ( errors .Wrap (err , "could not generate deployments data" ) )
83
83
}
84
84
85
85
// TODO: solution providers
@@ -97,7 +97,7 @@ func (d *GatewayFQDNDeployer) Deploy(ctx context.Context, gw *workloads.GatewayF
97
97
}
98
98
}
99
99
100
- return err
100
+ return d . tfPluginClient . sentry . error ( err )
101
101
}
102
102
103
103
// BatchDeploy deploys multiple deployments using the deployer
@@ -107,12 +107,12 @@ func (d *GatewayFQDNDeployer) BatchDeploy(ctx context.Context, gws []*workloads.
107
107
108
108
for _ , gw := range gws {
109
109
if err := d .Validate (ctx , gw ); err != nil {
110
- return err
110
+ return d . tfPluginClient . sentry . error ( err )
111
111
}
112
112
113
- dls , err := d .GenerateVersionlessDeployments (ctx , gw )
113
+ dls , err := d .generateVersionlessDeployments (ctx , gw )
114
114
if err != nil {
115
- return errors .Wrap (err , "could not generate deployments data" )
115
+ return d . tfPluginClient . sentry . error ( errors .Wrap (err , "could not generate deployments data" ) )
116
116
}
117
117
118
118
for nodeID , dl := range dls {
@@ -133,23 +133,23 @@ func (d *GatewayFQDNDeployer) BatchDeploy(ctx context.Context, gws []*workloads.
133
133
// error is not returned immediately before updating state because of untracked failed deployments
134
134
for _ , gw := range gws {
135
135
if err := d .updateStateFromDeployments (gw , newDls ); err != nil {
136
- return errors .Wrapf (err , "failed to update gateway fqdn '%s' state" , gw .Name )
136
+ return d . tfPluginClient . sentry . error ( errors .Wrapf (err , "failed to update gateway fqdn '%s' state" , gw .Name ) )
137
137
}
138
138
}
139
139
140
- return err
140
+ return d . tfPluginClient . sentry . error ( err )
141
141
}
142
142
143
143
// Cancel cancels a gateway deployment
144
144
func (d * GatewayFQDNDeployer ) Cancel (ctx context.Context , gw * workloads.GatewayFQDNProxy ) (err error ) {
145
145
if err := d .Validate (ctx , gw ); err != nil {
146
- return err
146
+ return d . tfPluginClient . sentry . error ( err )
147
147
}
148
148
149
149
contractID := gw .NodeDeploymentID [gw .NodeID ]
150
150
err = d .deployer .Cancel (ctx , contractID )
151
151
if err != nil {
152
- return err
152
+ return d . tfPluginClient . sentry . error ( err )
153
153
}
154
154
155
155
// update state
@@ -198,12 +198,12 @@ func (d *GatewayFQDNDeployer) syncContracts(ctx context.Context, gw *workloads.G
198
198
// Sync syncs the gateway deployments
199
199
func (d * GatewayFQDNDeployer ) Sync (ctx context.Context , gw * workloads.GatewayFQDNProxy ) error {
200
200
if err := d .syncContracts (ctx , gw ); err != nil {
201
- return errors .Wrap (err , "could not sync contracts" )
201
+ return d . tfPluginClient . sentry . error ( errors .Wrap (err , "could not sync contracts" ) )
202
202
}
203
203
204
204
dls , err := d .deployer .GetDeployments (ctx , gw .NodeDeploymentID )
205
205
if err != nil {
206
- return errors .Wrap (err , "could not get deployment objects" )
206
+ return d . tfPluginClient . sentry . error ( errors .Wrap (err , "could not get deployment objects" ) )
207
207
}
208
208
209
209
dl := dls [gw .NodeID ]
@@ -225,7 +225,7 @@ func (d *GatewayFQDNDeployer) Sync(ctx context.Context, gw *workloads.GatewayFQD
225
225
gw .Network = gwWorkload .Network
226
226
227
227
if err != nil {
228
- return err
228
+ return d . tfPluginClient . sentry . error ( err )
229
229
}
230
230
}
231
231
0 commit comments