Skip to content

Commit

Permalink
bug: create proxy kvms first #538
Browse files Browse the repository at this point in the history
  • Loading branch information
srinandan committed Sep 13, 2024
1 parent 202cc2e commit ddf16f4
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions internal/cmd/kvm/impkvms.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,6 @@ var ImpCmd = &cobra.Command{
}
}

if len(envKVMFileList) > 0 {
clilog.Info.Println("Importing env scoped KVMs...")
for _, envKVMFile := range envKVMFileList {
kvmFile := filepath.Base(envKVMFile)
kvmMetadata := strings.Split(kvmFile, utils.DefaultFileSplitter)
apiclient.SetApigeeEnv(kvmMetadata[1])
clilog.Info.Printf("\tCreating KVM %s\n", envKVMFile)
if _, err = kvm.Create("", kvmMetadata[2], true); proceedOnError(err) != nil {
return err
}
clilog.Info.Printf("\tImporting entries for %s\n", envKVMFile)
if err = kvm.ImportEntries("", kvmMetadata[2], conn, envKVMFile); proceedOnError(err) != nil {
return err
}
}
}

if len(proxyKVMFileList) > 0 {
clilog.Info.Println("Importing proxy scoped KVMs...")
for _, proxyKVMFile := range proxyKVMFileList {
Expand All @@ -93,6 +76,22 @@ var ImpCmd = &cobra.Command{
}
}

if len(envKVMFileList) > 0 {
clilog.Info.Println("Importing env scoped KVMs...")
for _, envKVMFile := range envKVMFileList {
kvmFile := filepath.Base(envKVMFile)
kvmMetadata := strings.Split(kvmFile, utils.DefaultFileSplitter)
apiclient.SetApigeeEnv(kvmMetadata[1])
clilog.Info.Printf("\tCreating KVM %s\n", envKVMFile)
if _, err = kvm.Create("", kvmMetadata[2], true); proceedOnError(err) != nil {
return err
}
clilog.Info.Printf("\tImporting entries for %s\n", envKVMFile)
if err = kvm.ImportEntries("", kvmMetadata[2], conn, envKVMFile); proceedOnError(err) != nil {
return err
}
}
}
return err
},
}
Expand Down

0 comments on commit ddf16f4

Please sign in to comment.