mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 14:20:19 +00:00
e2e: Make getConfigFile() generic
Update the getConfigFile() function to allow any file to be looked at on the preferred location first and fall back to the alternate location if it does not exist there. Signed-off-by: karthik-us <ksubrahm@redhat.com>
This commit is contained in:
parent
6ac3a4dabc
commit
e4e373cd47
@ -67,7 +67,7 @@ func deleteCephfsPlugin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createORDeleteCephfsResources(action kubectlAction) {
|
func createORDeleteCephfsResources(action kubectlAction) {
|
||||||
cephConfigFile := getConfigFile(deployPath + cephConfconfigMap)
|
cephConfigFile := getConfigFile(cephConfconfigMap, deployPath, examplePath)
|
||||||
resources := []ResourceDeployer{
|
resources := []ResourceDeployer{
|
||||||
// shared resources
|
// shared resources
|
||||||
&yamlResource{
|
&yamlResource{
|
||||||
|
@ -79,7 +79,7 @@ func deleteNFSPlugin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createORDeleteNFSResources(f *framework.Framework, action kubectlAction) {
|
func createORDeleteNFSResources(f *framework.Framework, action kubectlAction) {
|
||||||
cephConfigFile := getConfigFile(deployPath + cephConfconfigMap)
|
cephConfigFile := getConfigFile(cephConfconfigMap, deployPath, examplePath)
|
||||||
resources := []ResourceDeployer{
|
resources := []ResourceDeployer{
|
||||||
// shared resources
|
// shared resources
|
||||||
&yamlResource{
|
&yamlResource{
|
||||||
|
@ -130,7 +130,7 @@ func deleteRBDPlugin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createORDeleteRbdResources(action kubectlAction) {
|
func createORDeleteRbdResources(action kubectlAction) {
|
||||||
cephConfigFile := getConfigFile(deployPath + cephConfconfigMap)
|
cephConfigFile := getConfigFile(cephConfconfigMap, deployPath, examplePath)
|
||||||
resources := []ResourceDeployer{
|
resources := []ResourceDeployer{
|
||||||
// shared resources
|
// shared resources
|
||||||
&yamlResource{
|
&yamlResource{
|
||||||
|
@ -1733,11 +1733,12 @@ func rwopMayFail(err error) bool {
|
|||||||
return !rwopSupported
|
return !rwopSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
// getConfigFile returns the passed config file location if it exists, else
|
// getConfigFile returns the config file path at the preferred location if it
|
||||||
// returns the old location of the config file under 'examples/' directory.
|
// exists there. Returns the fallback location otherwise.
|
||||||
func getConfigFile(configFile string) string {
|
func getConfigFile(filename, preferred, fallback string) string {
|
||||||
|
configFile := preferred + filename
|
||||||
if _, err := os.Stat(configFile); os.IsNotExist(err) {
|
if _, err := os.Stat(configFile); os.IsNotExist(err) {
|
||||||
configFile = examplePath + cephConfconfigMap
|
configFile = fallback + filename
|
||||||
}
|
}
|
||||||
|
|
||||||
return configFile
|
return configFile
|
||||||
|
Loading…
Reference in New Issue
Block a user