Repository: apache/camel-k
Pull request #818 (2019-07-16 09:18:58)

chore(runtime): remove hardcoded log4j dependency
requires https://github.com/apache/camel-k-runtime/pull/106


Patch:
diff --git a/pkg/builder/builder_steps.go b/pkg/builder/builder_steps.go
index 113b6467e..ea34d529a 100644
--- a/pkg/builder/builder_steps.go
+++ b/pkg/builder/builder_steps.go
@@ -161,13 +161,6 @@ func generateProject(ctx *Context) error {
 		}
 	}
 
-	// Add Log4j 2 SLF4J binding as default logging impl
-	ctx.Maven.Project.AddDependency(maven.Dependency{
-		GroupID:    "org.apache.logging.log4j",
-		ArtifactID: "log4j-slf4j-impl",
-		Scope:      "runtime",
-	})
-
 	return nil
 }
 
diff --git a/pkg/controller/build/build_controller.go b/pkg/controller/build/build_controller.go
index 1d6ca0486..e582e965b 100644
--- a/pkg/controller/build/build_controller.go
+++ b/pkg/controller/build/build_controller.go
@@ -168,17 +168,17 @@ func (r *ReconcileBuild) Reconcile(request reconcile.Request) (reconcile.Result,
 
 	if target.Status.Phase == v1alpha1.BuildPhaseNone || target.Status.Phase == v1alpha1.BuildPhaseWaitingForPlatform {
 		pl, err := platform.GetOrLookup(ctx, r.client, target.Namespace, target.Status.Platform)
-		if err != nil || pl.Status.Phase != v1alpha1.IntegrationPlatformPhaseReady {
+		switch {
+		case err != nil:
+			target.Status.Phase = v1alpha1.BuildPhaseError
+			target.Status.Failure = v1alpha1.NewErrorFailure(err)
+		case pl.Status.Phase != v1alpha1.IntegrationPlatformPhaseReady:
 			target.Status.Phase = v1alpha1.BuildPhaseWaitingForPlatform
-		} else {
+		default:
 			target.Status.Phase = v1alpha1.BuildPhaseInitialization
 		}
 
 		if instance.Status.Phase != target.Status.Phase {
-			if err != nil {
-				target.Status.SetErrorCondition(v1alpha1.BuildConditionPlatformAvailable, v1alpha1.BuildConditionPlatformAvailableReason, err)
-			}
-
 			if pl != nil {
 				target.SetIntegrationPlatform(pl)
 			}
diff --git a/pkg/controller/integration/integration_controller.go b/pkg/controller/integration/integration_controller.go
index 0e4eabeda..641eaa3da 100644
--- a/pkg/controller/integration/integration_controller.go
+++ b/pkg/controller/integration/integration_controller.go
@@ -237,17 +237,17 @@ func (r *ReconcileIntegration) Reconcile(request reconcile.Request) (reconcile.R
 
 	if target.Status.Phase == v1alpha1.IntegrationPhaseNone || target.Status.Phase == v1alpha1.IntegrationPhaseWaitingForPlatform {
 		pl, err := platform.GetOrLookup(ctx, r.client, target.Namespace, target.Status.Platform)
-		if err != nil || pl.Status.Phase != v1alpha1.IntegrationPlatformPhaseReady {
+		switch {
+		case err != nil:
+			target.Status.Phase = v1alpha1.IntegrationPhaseError
+			target.Status.Failure = v1alpha1.NewErrorFailure(err)
+		case pl.Status.Phase != v1alpha1.IntegrationPlatformPhaseReady:
 			target.Status.Phase = v1alpha1.IntegrationPhaseWaitingForPlatform
-		} else {
+		default:
 			target.Status.Phase = v1alpha1.IntegrationPhaseInitialization
 		}
 
 		if instance.Status.Phase != target.Status.Phase {
-			if err != nil {
-				target.Status.SetErrorCondition(v1alpha1.IntegrationConditionPlatformAvailable, v1alpha1.IntegrationConditionPlatformAvailableReason, err)
-			}
-
 			if pl != nil {
 				target.SetIntegrationPlatform(pl)
 			}
diff --git a/pkg/controller/integrationkit/integrationkit_controller.go b/pkg/controller/integrationkit/integrationkit_controller.go
index cb560536c..431b8ef19 100644
--- a/pkg/controller/integrationkit/integrationkit_controller.go
+++ b/pkg/controller/integrationkit/integrationkit_controller.go
@@ -187,17 +187,17 @@ func (r *ReconcileIntegrationKit) Reconcile(request reconcile.Request) (reconcil
 
 	if target.Status.Phase == v1alpha1.IntegrationKitPhaseNone || target.Status.Phase == v1alpha1.IntegrationKitPhaseWaitingForPlatform {
 		pl, err := platform.GetOrLookup(ctx, r.client, target.Namespace, target.Status.Platform)
-		if err != nil || pl.Status.Phase != v1alpha1.IntegrationPlatformPhaseReady {
+		switch {
+		case err != nil:
+			target.Status.Phase = v1alpha1.IntegrationKitPhaseError
+			target.Status.Failure = v1alpha1.NewErrorFailure(err)
+		case pl.Status.Phase != v1alpha1.IntegrationPlatformPhaseReady:
 			target.Status.Phase = v1alpha1.IntegrationKitPhaseWaitingForPlatform
-		} else {
+		default:
 			target.Status.Phase = v1alpha1.IntegrationKitPhaseInitialization
 		}
 
 		if instance.Status.Phase != target.Status.Phase {
-			if err != nil {
-				target.Status.SetErrorCondition(v1alpha1.IntegrationKitConditionPlatformAvailable, v1alpha1.IntegrationKitConditionPlatformAvailableReason, err)
-			}
-
 			if pl != nil {
 				target.SetIntegrationPlatform(pl)
 			}


Test patch:
diff --git a/pkg/builder/builder_steps_test.go b/pkg/builder/builder_steps_test.go
index 30cfdbaf0..61f622c34 100644
--- a/pkg/builder/builder_steps_test.go
+++ b/pkg/builder/builder_steps_test.go
@@ -118,11 +118,6 @@ func TestGenerateJvmProject(t *testing.T) {
 				GroupID:    "org.apache.camel",
 				ArtifactID: "camel-properties",
 			},
-			{
-				GroupID:    "org.apache.logging.log4j",
-				ArtifactID: "log4j-slf4j-impl",
-				Scope:      "runtime",
-			},
 		},
 	)
 }
@@ -308,11 +303,6 @@ func TestGenerateGroovyProject(t *testing.T) {
 				GroupID:    "org.apache.camel",
 				ArtifactID: "camel-groovy",
 			},
-			{
-				GroupID:    "org.apache.logging.log4j",
-				ArtifactID: "log4j-slf4j-impl",
-				Scope:      "runtime",
-			},
 		},
 	)
 }