@@ -48,6 +48,8 @@ const (
48
48
// to the ansible-runner command. This will override the value for a particular CR.
49
49
// Example usage "ansible.sdk.operatorframework.io/verbosity: 5"
50
50
AnsibleVerbosityAnnotation = "ansible.sdk.operatorframework.io/verbosity"
51
+
52
+ ansibleRunnerBin = "ansible-runner"
51
53
)
52
54
53
55
// Runner - a runnable that should take the parameters and name and namespace
@@ -180,6 +182,10 @@ type runner struct {
180
182
}
181
183
182
184
func (r * runner ) Run (ident string , u * unstructured.Unstructured , kubeconfig string ) (RunResult , error ) {
185
+ if _ , err := exec .LookPath (ansibleRunnerBin ); err != nil {
186
+ return nil , err
187
+ }
188
+
183
189
timer := metrics .ReconcileTimer (r .GVK .String ())
184
190
defer timer .ObserveDuration ()
185
191
@@ -277,11 +283,16 @@ func (r *runner) Run(ident string, u *unstructured.Unstructured, kubeconfig stri
277
283
// link the current run to the `latest` directory under artifacts
278
284
currentRun := filepath .Join (inputDir .Path , "artifacts" , ident )
279
285
latestArtifacts := filepath .Join (inputDir .Path , "artifacts" , "latest" )
280
- if _ , err = os .Lstat (latestArtifacts ); err == nil {
281
- if err = os .Remove (latestArtifacts ); err != nil {
282
- logger .Error (err , "Error removing the latest artifacts symlink" )
286
+ if _ , err = os .Lstat (latestArtifacts ); err != nil {
287
+ if ! errors .Is (err , os .ErrNotExist ) {
288
+ logger .Error (err , "Latest artifacts dir has error" )
289
+ return
283
290
}
291
+ } else if err = os .Remove (latestArtifacts ); err != nil {
292
+ logger .Error (err , "Error removing the latest artifacts symlink" )
293
+ return
284
294
}
295
+
285
296
if err = os .Symlink (currentRun , latestArtifacts ); err != nil {
286
297
logger .Error (err , "Error symlinking latest artifacts" )
287
298
}
0 commit comments