Skip to content

Commit

Permalink
Sync from server repo (3cde30b9429)
Browse files Browse the repository at this point in the history
  • Loading branch information
releng committed Nov 8, 2024
1 parent ad0175c commit d350f0b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 10 additions & 1 deletion commands/cmd_create_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,17 @@ func (c *CmdCreateDB) Run(vcc vclusterops.ClusterCommands) error {
// write db info to vcluster config file
err := writeConfig(&vdb, c.createDBOptions.ForceOverwriteFile)
if err != nil {
vcc.DisplayWarning("Failed to write the configuration file: %s\n", err)
vcc.DisplayWarning("Failed to write the configuration file: %s", err)
if dbOptions.ConfigPath != defaultConfigFilePath {
vcc.DisplayWarning("Attempting writing to default config file path: %s", defaultConfigFilePath)
dbOptions.ConfigPath = defaultConfigFilePath
err = writeConfig(&vdb, c.createDBOptions.ForceOverwriteFile)
if err != nil {
vcc.DisplayWarning("Failed to write the configuration file to default path: %s", err)
}
}
}

// write config parameters to vcluster config param file
err = c.writeConfigParam(c.createDBOptions.ConfigurationParameters, c.createDBOptions.ForceOverwriteFile)
if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion commands/vcluster_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const (
currentConfigFileVersion = "1.0"
configFilePerm = 0644
rpmConfDir = "/opt/vertica/config"
defaultConfigFilePath = rpmConfDir + "/" + defConfigFileName
)

// Config is the struct of vertica_cluster.yaml
Expand Down Expand Up @@ -124,7 +125,7 @@ func initConfigImpl(vclusterExePath string, ensureOptVerticaConfigExists, ensure
}
cobra.CheckErr(err)
} else {
dbOptions.ConfigPath = fmt.Sprintf("%s/%s", rpmConfDir, defConfigFileName)
dbOptions.ConfigPath = defaultConfigFilePath
return
}
}
Expand Down Expand Up @@ -360,6 +361,7 @@ func (c *DatabaseConfig) write(configFilePath string, forceOverwrite bool) error
if err != nil {
return fmt.Errorf("fail to marshal configuration data, details: %w", err)
}

err = os.WriteFile(configFilePath, configBytes, configFilePerm)
if err != nil {
return fmt.Errorf("fail to write configuration file, details: %w", err)
Expand Down

0 comments on commit d350f0b

Please sign in to comment.