Skip to content

Commit

Permalink
Add checks for the config.yaml presence
Browse files Browse the repository at this point in the history
  • Loading branch information
matbu committed Mar 22, 2024
1 parent 3bac37e commit 9714a98
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions cmd/diff.go
Expand Up @@ -74,19 +74,20 @@ CMD1=oc exec -t neutron-cd94d8ccb-vq2gk -c neutron-api --
}
path1 := args[0]
path2 := args[1]
configPath := CheckFilesPresence(serviceCfgFile)
if crd {
if frompod {
if podname == "" {
panic("Please provide a pod name with --frompod option.")
}
servicecfg.DiffServiceConfigFromPod(service, path2, path1, serviceCfgFile)
servicecfg.DiffServiceConfigFromPod(service, path2, path1, configPath)
} else if frompodman {
if podname == "" {
panic("Please provide a pod name with --frompodman option.")
}
servicecfg.DiffServiceConfigFromPodman(service, path2, path1, serviceCfgFile)
servicecfg.DiffServiceConfigFromPodman(service, path2, path1, configPath)
} else {
servicecfg.DiffServiceConfigWithCRD(service, path2, path1, serviceCfgFile)
servicecfg.DiffServiceConfigWithCRD(service, path2, path1, configPath)
}
return
}
Expand Down
7 changes: 4 additions & 3 deletions cmd/pull.go
Expand Up @@ -54,6 +54,7 @@ This command will populate the config.yaml file with the podman and image Ids an
if serviceConfig == "" {
serviceConfig = config.Default.ServiceConfigFile
}
configPath := CheckFilesPresence(serviceConfig)

if cloud == "ocp" {
// Test OCP connection:
Expand All @@ -63,7 +64,7 @@ This command will populate the config.yaml file with the podman and image Ids an
}
// OCP Settings
localOCPDir := config.Openshift.OcpLocalConfigPath
err := collectcfg.FetchConfigFromEnv(serviceConfig, localOCPDir, "", false, config.Openshift.Connection, "", "", filters)
err := collectcfg.FetchConfigFromEnv(configPath, localOCPDir, "", false, config.Openshift.Connection, "", "", filters)
if err != nil {
fmt.Println("Error while collecting config: ", err)
return
Expand All @@ -79,12 +80,12 @@ This command will populate the config.yaml file with the podman and image Ids an
return
}
if update || updateOnly {
collectcfg.SetTripleODataEnv(serviceConfig, fullCmd, filters, true)
collectcfg.SetTripleODataEnv(configPath, fullCmd, filters, true)
if updateOnly {
return
}
}
err := collectcfg.FetchConfigFromEnv(serviceConfig, localConfigDir, remoteConfigDir, true, config.Tripleo.Connection, sshCmd, config.Tripleo.DirectorHost, filters)
err := collectcfg.FetchConfigFromEnv(configPath, localConfigDir, remoteConfigDir, true, config.Tripleo.Connection, sshCmd, config.Tripleo.DirectorHost, filters)
if err != nil {
fmt.Println("Error while collecting config: ", err)
return
Expand Down

0 comments on commit 9714a98

Please sign in to comment.