Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove config check #908

Merged
merged 2 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 configCheck(configName string) error {
func ConfigCheck(configName string) error {

Check failure on line 318 in pkg/openevec/config.go

View workflow job for this annotation

GitHub Actions / yetus

revive: exported function ConfigCheck should have comment or be unexported https://revive.run/r#exported
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 @@ -49,14 +49,10 @@
return nil
}

func (openEVEC *OpenEVEC) SetupEden(configName, configDir, softSerial, zedControlURL, ipxeOverride string, grubOptions []string, netboot, installer bool) error {

Check failure on line 52 in pkg/openevec/eden.go

View workflow job for this annotation

GitHub Actions / yetus

golangcilint: calculated cyclomatic complexity for function SetupEden is 14, max is 10 (cyclop)

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
Loading