VOL-3170 Remove api version argument and config file options
Change-Id: Ia293edc4af0b325c9360c271d544adb19c5c2416
diff --git a/README.md b/README.md
index 6f72623..81a9257 100644
--- a/README.md
+++ b/README.md
@@ -57,7 +57,6 @@
-s, --server=SERVER:PORT IP/Host and port of VOLTHA
-k, --kafka=SERVER:PORT IP/Host and port of Kafka
-e, --kvstore=SERVER:PORT IP/Host and port of KV store (etcd) [$KVSTORE]
- -a, --apiversion=VERSION[v1|v2|v3] API version
-d, --debug Enable debug mode
-t, --timeout=DURATION API call timeout duration
--tls Use TLS
diff --git a/VERSION b/VERSION
index 65087b4..b08cf5b 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.1.4
+1.1.5-dev
diff --git a/internal/pkg/commands/command.go b/internal/pkg/commands/command.go
index d47a092..9b2afd0 100644
--- a/internal/pkg/commands/command.go
+++ b/internal/pkg/commands/command.go
@@ -75,7 +75,6 @@
}
type GlobalConfigSpec struct {
- ApiVersion string `yaml:"apiVersion"`
Server string `yaml:"server"`
Kafka string `yaml:"kafka"`
KvStore string `yaml:"kvstore"`
@@ -103,10 +102,9 @@
CharReplacer = strings.NewReplacer("\\t", "\t", "\\n", "\n")
GlobalConfig = GlobalConfigSpec{
- ApiVersion: "v3",
- Server: "localhost:55555",
- Kafka: "",
- KvStore: "localhost:2379",
+ Server: "localhost:55555",
+ Kafka: "",
+ KvStore: "localhost:2379",
Tls: TlsConfigSpec{
UseTls: false,
},
@@ -126,9 +124,7 @@
Kafka string `short:"k" long:"kafka" default:"" value-name:"SERVER:PORT" description:"IP/Host and port of Kafka"`
KvStore string `short:"e" long:"kvstore" env:"KVSTORE" value-name:"SERVER:PORT" description:"IP/Host and port of KV store (etcd)"`
- // Do not set the default for the API version here, else it will override the value read in the config
// nolint: staticcheck
- ApiVersion string `short:"a" long:"apiversion" description:"API version" value-name:"VERSION" choice:"v1" choice:"v2" choice:"v3"`
Debug bool `short:"d" long:"debug" description:"Enable debug mode"`
Timeout string `short:"t" long:"timeout" description:"API call timeout duration" value-name:"DURATION" default:""`
UseTLS bool `long:"tls" description:"Use TLS"`
@@ -284,10 +280,6 @@
}
GlobalConfig.KvStore = net.JoinHostPort(host, strconv.Itoa(port))
- if GlobalOptions.ApiVersion != "" {
- GlobalConfig.ApiVersion = GlobalOptions.ApiVersion
- }
-
if GlobalOptions.KvStoreTimeout != "" {
timeout, err := time.ParseDuration(GlobalOptions.KvStoreTimeout)
if err != nil {
diff --git a/internal/pkg/commands/command_test.go b/internal/pkg/commands/command_test.go
index 0ee0ca7..8dd449b 100644
--- a/internal/pkg/commands/command_test.go
+++ b/internal/pkg/commands/command_test.go
@@ -23,7 +23,9 @@
"testing"
)
-func TestDefaultVersion(t *testing.T) {
+// Test that ProcessGlobalOptions does not interfere with GlobalConfig
+// default.
+func TestProcessGlobalOptionsWithDefaults(t *testing.T) {
os.Setenv("VOLTCONFIG", "__DOES_NOT_EXIST__")
parser := flags.NewNamedParser(path.Base(os.Args[0]), flags.Default|flags.PassAfterNonOption)
@@ -34,7 +36,7 @@
assert.Nil(t, err, "unexpected error paring arguments")
ProcessGlobalOptions()
- assert.Equal(t, "v3", GlobalConfig.ApiVersion, "wrong default version for API version")
+ assert.Equal(t, "localhost:55555", GlobalConfig.Server, "wrong default hostname for server")
}
func TestSplitHostPort(t *testing.T) {
diff --git a/voltctl.config b/voltctl.config
index da87203..f07a75b 100644
--- a/voltctl.config
+++ b/voltctl.config
@@ -1,4 +1,3 @@
-apiVersion: v3
server: localhost:55555
kafka: localhost:9092
kvstore: localhost:2379