From 4465e1a8bd6fb6e036bf79b19c8d84a2db890208 Mon Sep 17 00:00:00 2001 From: Pasquale Congiusti Date: Mon, 7 Jun 2021 14:44:59 +0200 Subject: [PATCH] feat(cmd/run): warn when using path on --config Ref #2003 --- docs/modules/ROOT/pages/cli/modeline.adoc | 4 ++-- pkg/cmd/run_help.go | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/modules/ROOT/pages/cli/modeline.adoc b/docs/modules/ROOT/pages/cli/modeline.adoc index e4daff50aa..ac1b734376 100644 --- a/docs/modules/ROOT/pages/cli/modeline.adoc +++ b/docs/modules/ROOT/pages/cli/modeline.adoc @@ -70,7 +70,7 @@ The following is a partial list of useful options: |Add a build time property or properties file (syntax: _[my-key=my-value\|file:/path/to/my-conf.properties]_ |config -|Add a runtime configuration from a Configmap, a Secret or a file (syntax: _[configmap\|secret\|file]:name[/key])_ +|Add a runtime configuration from a Configmap, a Secret or a file (syntax: _[configmap\|secret\|file]:name[/key]_) |dependency |An external library that should be included, e.g. for Maven dependencies `dependency=mvn:org.my:app:1.0` @@ -94,7 +94,7 @@ The following is a partial list of useful options: |Add a runtime property or properties file (syntax: _[my-key=my-value\|file:/path/to/my-conf.properties]_) |resource -|Add a runtime resource from a Configmap, a Secret or a file (syntax: _[configmap\|secret\|file]:name[/key][@path])_ +|Add a runtime resource from a Configmap, a Secret or a file (syntax: _[configmap\|secret\|file]:name[/key][@path]_) |trait |Configure a trait, e.g. `trait=service.enabled=false` diff --git a/pkg/cmd/run_help.go b/pkg/cmd/run_help.go index d117bf85e8..0fe8ee14ec 100644 --- a/pkg/cmd/run_help.go +++ b/pkg/cmd/run_help.go @@ -220,6 +220,10 @@ func applyOption(config *RunConfigOption, integrationSpec *v1.IntegrationSpec, // ApplyConfigOption will set the proper --config option behavior to the IntegrationSpec func ApplyConfigOption(config *RunConfigOption, integrationSpec *v1.IntegrationSpec, c client.Client, namespace string, enableCompression bool) error { + // A config option cannot specify destination path + if config.DestinationPath() != "" { + return fmt.Errorf("cannot specify a destination path for this option type") + } return applyOption(config, integrationSpec, c, namespace, enableCompression, v1.ResourceTypeConfig) }