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

fixed path issue in import kvm, #303 #304 #305

Merged
merged 4 commits into from
Oct 5, 2023
Merged
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
12 changes: 8 additions & 4 deletions cmd/kvm/impkvms.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package kvm

import (
"path/filepath"
"strings"

"internal/apiclient"
Expand Down Expand Up @@ -45,7 +46,8 @@ var ImpCmd = &cobra.Command{
if len(orgKVMFileList) > 0 {
clilog.Info.Println("Importing org scoped KVMs...")
for _, orgKVMFile := range orgKVMFileList {
kvmMetadata := strings.Split(orgKVMFile, "_")
kvmFile := filepath.Base(orgKVMFile)
kvmMetadata := strings.Split(kvmFile, "_")
clilog.Info.Printf("\tCreating KVM %s\n", orgKVMFile)
if _, err = kvm.Create("", kvmMetadata[1], true); err != nil {
return err
Expand All @@ -60,7 +62,8 @@ var ImpCmd = &cobra.Command{
if len(envKVMFileList) > 0 {
clilog.Info.Println("Importing env scoped KVMs...")
for _, envKVMFile := range envKVMFileList {
kvmMetadata := strings.Split(envKVMFile, "_")
kvmFile := filepath.Base(envKVMFile)
kvmMetadata := strings.Split(kvmFile, "_")
apiclient.SetApigeeEnv(kvmMetadata[1])
clilog.Info.Printf("\tCreating KVM %s\n", envKVMFile)
if _, err = kvm.Create("", kvmMetadata[2], true); err != nil {
Expand All @@ -76,9 +79,10 @@ var ImpCmd = &cobra.Command{
if len(proxyKVMFileList) > 0 {
clilog.Info.Println("Importing proxy scoped KVMs...")
for _, proxyKVMFile := range proxyKVMFileList {
kvmMetadata := strings.Split(proxyKVMFile, "_")
kvmFile := filepath.Base(proxyKVMFile)
kvmMetadata := strings.Split(kvmFile, "_")
clilog.Info.Printf("\tCreating KVM %s\n", proxyKVMFile)
if _, err = kvm.Create(kvmMetadata[1], "", true); err != nil {
if _, err = kvm.Create(kvmMetadata[1], kvmMetadata[2], true); err != nil {
return err
}
clilog.Info.Printf("\tImporting entries for %s\n", proxyKVMFile)
Expand Down