Fix error messages for consistency in ca.go and certdb.go

This commit is contained in:
2025-12-10 21:13:51 +01:00
parent 5d2675450d
commit 714a38d612
2 changed files with 6 additions and 6 deletions

8
ca.go
View File

@@ -462,7 +462,7 @@ func issueSingleCertificate(def CertificateDefinition, i int, n int) (bool, erro
// Check if the certificate is in database, fail if it is.
if caState.FindByName(def.Name, false) != nil {
return false, fmt.Errorf("certificate %s already exists and is valid.", def.Name)
return false, fmt.Errorf("certificate %s already exists and is valid", def.Name)
}
// Initialize Subject if not specified
@@ -634,7 +634,7 @@ Certificate generated:
// If saving CA state fails, we still return success for the certificate issuance
fmt.Printf("WARNING: %v\n", err)
fmt.Println("CA state not saved, but certificate issued and saved successfully.")
return true, fmt.Errorf("Error saving CA state: %v", err)
return true, fmt.Errorf("error saving CA state: %v", err)
}
return true, nil
@@ -655,12 +655,12 @@ func ProvisionCertificates(filePath string) error {
// Load certificates provisioning configuration from the file (HCL syntax)
err = certDefs.LoadFromFile(filePath)
if err != nil {
return fmt.Errorf("Error loading certificates file: %v", err)
return fmt.Errorf("error loading certificates file: %v", err)
}
// The certificate provisioning file must contain at least one certificate definition
if len(certDefs.Certificates) < 1 {
return fmt.Errorf("No certificates defined in %s", filePath)
return fmt.Errorf("no certificates defined in %s", filePath)
}
// We will be counting successes and errors