@@ -411,7 +411,10 @@ func createOrUpdateArgoCD(client dynamic.Interface, fullClient kubernetes.Interf
411411
412412 if ! haveArgo (client , name , namespace ) {
413413 // create it
414- obj , _ := runtime .DefaultUnstructuredConverter .ToUnstructured (argo )
414+ obj , errConvert := runtime .DefaultUnstructuredConverter .ToUnstructured (argo )
415+ if errConvert != nil {
416+ return fmt .Errorf ("failed to convert ArgoCD to unstructured for create: %v" , errConvert )
417+ }
415418 newArgo := & unstructured.Unstructured {Object : obj }
416419 _ , err = client .Resource (gvr ).Namespace (namespace ).Create (context .TODO (), newArgo , metav1.CreateOptions {})
417420 } else { // update it
@@ -420,7 +423,10 @@ func createOrUpdateArgoCD(client dynamic.Interface, fullClient kubernetes.Interf
420423 return fmt .Errorf ("failed to get existing ArgoCD %s/%s: %v" , namespace , name , err )
421424 }
422425 argo .SetResourceVersion (oldArgo .GetResourceVersion ())
423- obj , _ := runtime .DefaultUnstructuredConverter .ToUnstructured (argo )
426+ obj , errConvert := runtime .DefaultUnstructuredConverter .ToUnstructured (argo )
427+ if errConvert != nil {
428+ return fmt .Errorf ("failed to convert ArgoCD to unstructured for update: %v" , errConvert )
429+ }
424430 newArgo := & unstructured.Unstructured {Object : obj }
425431
426432 _ , err = client .Resource (gvr ).Namespace (namespace ).Update (context .TODO (), newArgo , metav1.UpdateOptions {})
@@ -708,9 +714,10 @@ func commonApplicationSourceHelm(p *api.Pattern, prefix string) *argoapi.Applica
708714 valueFiles := newApplicationValueFiles (p , prefix )
709715 sharedValueFiles , err := getSharedValueFiles (p , prefix )
710716 if err != nil {
711- fmt .Printf ("Could not fetch sharedValueFiles: %s" , err )
717+ log .Printf ("Could not fetch sharedValueFiles: %s" , err )
718+ } else {
719+ valueFiles = append (valueFiles , sharedValueFiles ... )
712720 }
713- valueFiles = append (valueFiles , sharedValueFiles ... )
714721
715722 return & argoapi.ApplicationSourceHelm {
716723 ValueFiles : valueFiles ,
@@ -913,9 +920,12 @@ func getApplication(client argoclient.Interface, name, namespace string) (*argoa
913920
914921func createApplication (client argoclient.Interface , app * argoapi.Application , namespace string ) error {
915922 saved , err := client .ArgoprojV1alpha1 ().Applications (namespace ).Create (context .Background (), app , metav1.CreateOptions {})
923+ if err != nil {
924+ return err
925+ }
916926 yamlOutput , _ := objectYaml (saved )
917927 log .Printf ("Created: %s\n " , yamlOutput )
918- return err
928+ return nil
919929}
920930
921931func updateApplication (client argoclient.Interface , target , current * argoapi.Application , namespace string ) (bool , error ) {
0 commit comments