Skip to content

Commit

Permalink
Remove config check (#908)
Browse files Browse the repository at this point in the history
- Remove DefaultCobraToViper variable
- Remove `configCheck` from `EdenSetup`

This is prerequisite to use eden as library

Signed-off-by: Pavel Abramov <[email protected]>
  • Loading branch information
uncleDecart authored Oct 19, 2023
1 parent 02a9238 commit 06035a0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 95 deletions.
3 changes: 3 additions & 0 deletions cmd/edenSetup.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ func newSetupCmd(configName, verbosity *string) *cobra.Command {
Long: `Setup harness.`,
PersistentPreRunE: preRunViperLoadFunction(cfg, configName, verbosity),
Run: func(cmd *cobra.Command, args []string) {
if err := openevec.ConfigCheck(*configName); err != nil {
log.Fatalf("Config check failed %s", err)
}
if err := openEVEC.SetupEden(*configName, configDir, softSerial, zedControlURL, ipxeOverride, grubOptions, netboot, installer); err != nil {

log.Fatalf("Setup eden failed: %s", err)
Expand Down
90 changes: 0 additions & 90 deletions pkg/defaults/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,94 +205,4 @@ const (
var (
//DefaultQemuHostFwd represents port forward for ssh
DefaultQemuHostFwd = map[string]string{strconv.Itoa(DefaultSSHPort): "22"}
//DefaultCobraToViper represents mapping values between cobra (cli) and viper (yml)
DefaultCobraToViper = map[string]string{
"redis.dist": "redis-dist",
"redis.tag": "redis-tag",
"redis.port": "redis-port",
"redis.force": "redis-force",

"adam.dist": "adam-dist",
"adam.tag": "adam-tag",
"adam.port": "adam-port",
"adam.domain": "domain",
"adam.ip": "ip",
"adam.eve-ip": "eve-ip",
"adam.force": "adam-force",
"adam.v1": "api-v1",
"adam.redis.adam": "adam-redis-url",
"adam.remote.redis": "adam-redis",

"registry.tag": "registry-tag",
"registry.port": "registry-port",
"registry.dist": "registry-dist",

"eve.arch": "eve-arch",
"eve.platform": "eve-platform",
"eve.os": "eve-os",
"eve.accel": "eve-accel",
"eve.hv": "eve-hv",
"eve.serial": "eve-serial",
"eve.pid": "eve-pid",
"eve.log": "eve-log",
"eve.firmware": "eve-firmware",
"eve.repo": "eve-repo",
"eve.registry": "eve-registry",
"eve.tag": "eve-tag",
"eve.hostfwd": "eve-hostfwd",
"eve.dist": "eve-dist",
"eve.base-dist": "eve-base-dist",
"eve.qemu-config": "qemu-config",
"eve.uuid": "uuid",
"eve.image-file": "image-file",
"eve.dtb-part": "dtb-part",
"eve.config-part": "config-part",
"eve.base-version": "os-version",
"eve.devmodel": "devmodel",
"eve.devmodelfile": "devmodel-file",
"eve.telnet-port": "eve-telnet-port",
"eve.cpu": "cpus",
"eve.ram": "memory",
"eve.tpm": "tpm",
"eve.disks": "eve-disks",

"eve.custom-installer.path": "custom-installer-path",
"eve.custom-installer.format": "custom-installer-format",

"eve.bootstrap-file": "eve-bootstrap-file",
"eve.usbnetconf-file": "eve-usbnetconf-file",

"eve.qemu.monitor-port": "qemu-monitor-port",
"eve.qemu.netdev-socket-port": "qemu-netdev-socket-port",

"eden.images.dist": "image-dist",
"eden.images.docker": "docker-yml",
"eden.images.vm": "vm-yml",
"eden.download": "download",
"eden.eserver.ip": "eserver-ip",
"eden.eserver.port": "eserver-port",
"eden.eserver.tag": "eserver-tag",
"eden.eserver.force": "eserver-force",
"eden.certs-dist": "certs-dist",
"eden.bin-dist": "bin-dist",
"eden.ssh-key": "ssh-key",
"eden.test-bin": "prog",
"eden.test-scenario": "scenario",

"config": "config",

"sdn.disable": "sdn-disable",
"sdn.source-dir": "sdn-source-dir",
"sdn.config-dir": "sdn-config-dir",
"sdn.image-file": "sdn-image-file",
"sdn.linuxkit-bin": "sdn-linuxkit-bin",
"sdn.cpu": "sdn-cpu",
"sdn.ram": "sdn-ram",
"sdn.pid": "sdn-pid",
"sdn.console-log": "sdn-console-log",
"sdn.telnet-port": "sdn-telnet-port",
"sdn.ssh-port": "sdn-ssh-port",
"sdn.mgmt-port": "sdn-mgmt-port",
"sdn.network-model": "sdn-network-model",
}
)
2 changes: 1 addition & 1 deletion pkg/openevec/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func resolvePath(v reflect.Value) {
}
}

func configCheck(configName string) error {
func ConfigCheck(configName string) error {
configFile := utils.GetConfig(configName)
configSaved := utils.ResolveAbsPath(fmt.Sprintf("%s-%s", configName, defaults.DefaultConfigSaved))

Expand Down
4 changes: 0 additions & 4 deletions pkg/openevec/eden.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ func (openEVEC *OpenEVEC) SetupEden(configName, configDir, softSerial, zedContro

cfg := *openEVEC.cfg

if err := configCheck(configName); err != nil {
return err
}

if netboot && installer {
return fmt.Errorf("please use netboot or installer flag, not both")
}
Expand Down

0 comments on commit 06035a0

Please sign in to comment.