Merge remote-tracking branch 'upstream/job-service' into new-ui-with-sync-image

This commit is contained in:
kunw 2016-06-15 11:43:17 +08:00
commit 3dcd9cff51
2 changed files with 10 additions and 0 deletions

View File

@ -103,6 +103,9 @@ func GetRepPolicy(id int64) (*models.RepPolicy, error) {
var policy models.RepPolicy
if err := o.Raw(sql, id).QueryRow(&policy); err != nil {
if err == orm.ErrNoRows {
return nil, nil
}
return nil, err
}
@ -151,6 +154,9 @@ func GetRepPolicyByName(name string) (*models.RepPolicy, error) {
var policy models.RepPolicy
if err := o.Raw(sql, name).QueryRow(&policy); err != nil {
if err == orm.ErrNoRows {
return nil, nil
}
return nil, err
}

View File

@ -18,6 +18,7 @@ package dao
import (
"fmt"
"github.com/astaxie/beego/orm"
"github.com/vmware/harbor/models"
)
@ -83,6 +84,9 @@ func GetRoleByID(id int) (*models.Role, error) {
var role models.Role
if err := o.Raw(sql, id).QueryRow(&role); err != nil {
if err == orm.ErrNoRows {
return nil, nil
}
return nil, err
}
return &role, nil