Describe the bug
When the current namespace defined in the config file is null:
kafkactl:
current-namespace: null
api: http://localhost:8080
user-token: xxxx
any command line (even trying to switch context) will result in the following error message:
Exception in thread "main" picocli.CommandLine$InitializationException: Could not instantiate class com.michelin.kafkactl.util.VersionProvider: io.micronaut.context.exceptions.DependencyInjectionException: Failed to inject value for parameter [currentNamespace] of method [setCurrentNamespace] of class: com.michelin.kafkactl.property.KafkactlProperties
Message: Failed to inject value for parameter [currentNamespace] of method [setCurrentNamespace] of class: com.michelin.kafkactl.property.KafkactlProperties
Message: Error resolving property value [kafkactl.current-namespace]. Property doesn't exist
Path Taken:
new @j.i.Singleton c.m.k.u.VersionProvider()
\---> @j.i.Singleton c.m.k.u.VersionProvider#kafkactlProperties
\---> @i.m.c.a.ConfigurationProperties("kafkactl") c.m.k.p.KafkactlProperties#setCurrentNamespace([String currentNamespace])
To Reproduce
Steps to reproduce the behavior:
- Create ~HOME/.kafkactl/config.yml with a context without namespace like
contexts:
- name: test
context:
api: http://localhost:8080
user-token: xxxx
- Switch to that context with
kafkactl config use-context test
- Try any command line like
kafkactl get to or kafkactl get to -n <myNamespace>
- See error
Expected behavior
kafkactl get to should result in an explicit error like "No namespace set"
kafkactl get to -n <myNamespace> should result in the correct topics listing
kafkactl config use-context goodContext should switch context
Environment
- Kafkactl distribution: N/A
- Ns4Kafka version: N/A
Steps taken to try and solve the problem
Without the field current-namespace in the config file
kafkactl:
api: http://localhost:8080
user-token: xxxx
kafkactl behaviour is normal.
2 fixes might be needed:
- The
kafkactl config use-context on a context without namespace should not initialize a "current-namespace" field
- If the
current-namespace is set to null, kafkactl should still work when setting a namespace in the command line
Additional context
N/A
Describe the bug
When the current namespace defined in the config file is null:
any command line (even trying to switch context) will result in the following error message:
To Reproduce
Steps to reproduce the behavior:
kafkactl config use-context testkafkactl get toorkafkactl get to -n <myNamespace>Expected behavior
kafkactl get toshould result in an explicit error like "No namespace set"kafkactl get to -n <myNamespace>should result in the correct topics listingkafkactl config use-context goodContextshould switch contextEnvironment
Steps taken to try and solve the problem
Without the field
current-namespacein the config filekafkactl behaviour is normal.
2 fixes might be needed:
kafkactl config use-contexton a context without namespace should not initialize a "current-namespace" fieldcurrent-namespaceis set to null, kafkactl should still work when setting a namespace in the command lineAdditional context
N/A