@@ -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
@@ -128,6 +130,10 @@ func New(watch watches.Watch, runnerArgs string) (Runner, error) {
128
130
return nil , err
129
131
}
130
132
133
+ if _ , err := exec .LookPath (ansibleRunnerBin ); err != nil {
134
+ return nil , err
135
+ }
136
+
131
137
switch {
132
138
case watch .Playbook != "" :
133
139
path = watch .Playbook
@@ -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 doesn't exist" )
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