maatma: display the error returned by knotc instead of generic command error

This commit is contained in:
nemunaire 2019-03-25 22:45:05 +01:00
parent b8179583e6
commit 7bfed9dc89

View File

@ -201,8 +201,8 @@ func (student Student) AddAssociatedDomains() (err error) {
var out []byte
out, err = runKnotc(cmd...)
if err != nil {
err = errors.New(fmt.Sprintf("An error occurs on command '%s': %s", strings.Join(cmd, " "), err.Error()))
log.Println(string(out))
log.Printf("An error occurs on command '%s': %s", strings.Join(cmd, " "), err.Error())
err = errors.New(string(out))
runKnotc("zone-abort", AssociatedDomainSuffix)
return
}
@ -245,8 +245,8 @@ func (student Student) AddNSDelegatedDomain(dn string, ttl uint64, ns string) (e
var out []byte
out, err = runKnotc(cmd...)
if err != nil && cmd[0] != "zone-unset" {
err = errors.New(fmt.Sprintf("An error occurs on command '%s': %s", strings.Join(cmd, " "), err.Error()))
log.Println(string(out))
log.Printf("An error occurs on command '%s': %s", strings.Join(cmd, " "), err.Error())
err = errors.New(string(out))
runKnotc("zone-abort", DelegatedDomainSuffix)
return
}
@ -267,8 +267,8 @@ func (student Student) UpdateNSDelegatedDomain(dn string, ttl uint64, oldns stri
var out []byte
out, err = runKnotc(cmd...)
if err != nil && cmd[0] != "zone-unset" {
err = errors.New(fmt.Sprintf("An error occurs on command '%s': %s", strings.Join(cmd, " "), err.Error()))
log.Println(string(out))
log.Printf("An error occurs on command '%s': %s", strings.Join(cmd, " "), err.Error())
err = errors.New(string(out))
runKnotc("zone-abort", DelegatedDomainSuffix)
return
}
@ -301,8 +301,8 @@ func (student Student) AddGLUEDelegatedDomain(dn string, ttl uint64, aaaa string
var out []byte
out, err = runKnotc(cmd...)
if err != nil && cmd[0] != "zone-unset" {
err = errors.New(fmt.Sprintf("An error occurs on command '%s': %s", strings.Join(cmd, " "), err.Error()))
log.Println(string(out))
log.Printf("An error occurs on command '%s': %s", strings.Join(cmd, " "), err.Error())
err = errors.New(string(out))
runKnotc("zone-abort", DelegatedDomainSuffix)
return
}
@ -335,8 +335,8 @@ func (student Student) UpdateGLUEDelegatedDomain(dn string, ttl uint64, oldaaaa
var out []byte
out, err = runKnotc(cmd...)
if err != nil && cmd[0] != "zone-unset" {
err = errors.New(fmt.Sprintf("An error occurs on command '%s': %s", strings.Join(cmd, " "), err.Error()))
log.Println(string(out))
log.Printf("An error occurs on command '%s': %s", strings.Join(cmd, " "), err.Error())
err = errors.New(string(out))
runKnotc("zone-abort", DelegatedDomainSuffix)
return
}
@ -384,8 +384,8 @@ func (student Student) AddDSDelegatedDomain(dn string, ttl uint64, dnskey []stri
var out []byte
out, err = runKnotc(cmd...)
if err != nil && cmd[0] != "zone-unset" {
err = errors.New(fmt.Sprintf("An error occurs on command '%s': %s", strings.Join(cmd, " "), err.Error()))
log.Println(string(out))
log.Printf("An error occurs on command '%s': %s", strings.Join(cmd, " "), err.Error())
err = errors.New(string(out))
runKnotc("zone-abort", DelegatedDomainSuffix)
return
}
@ -406,8 +406,8 @@ func (student Student) UpdateDSDelegatedDomain(dn string, ttl uint64, oldds []st
var out []byte
out, err = runKnotc(cmd...)
if err != nil && cmd[0] != "zone-unset" {
err = errors.New(fmt.Sprintf("An error occurs on command '%s': %s", strings.Join(cmd, " "), err.Error()))
log.Println(string(out))
log.Printf("An error occurs on command '%s': %s", strings.Join(cmd, " "), err.Error())
err = errors.New(string(out))
runKnotc("zone-abort", DelegatedDomainSuffix)
return
}
@ -443,8 +443,8 @@ func (student Student) DeleteRRDelegatedDomain(dn string, rr string, values ...s
var out []byte
out, err = runKnotc(cmd...)
if err != nil {
err = errors.New(fmt.Sprintf("An error occurs on command '%s': %s", strings.Join(cmd, " "), err.Error()))
log.Println(string(out))
log.Printf("An error occurs on command '%s': %s", strings.Join(cmd, " "), err.Error())
err = errors.New(string(out))
runKnotc("zone-abort", DelegatedDomainSuffix)
return
}