util: Rename SortedStrSliceCompare and move to util package

This commit is contained in:
Jonathan Gold
2018-03-28 17:41:32 -04:00
parent 7d7eb3d1cd
commit 3c8d424a43
5 changed files with 70 additions and 68 deletions

View File

@@ -32,6 +32,7 @@ import (
"golang.org/x/sys/unix"
"github.com/purpleidea/mgmt/recwatch"
"github.com/purpleidea/mgmt/util"
multierr "github.com/hashicorp/go-multierror"
errwrap "github.com/pkg/errors"
@@ -331,7 +332,7 @@ func (obj *NetRes) addrCheckApply(apply bool) (bool, error) {
}
// if the kernel routes are intact and the addrs match, we're done
err = StrSortedSliceCompare(obj.Addrs, ifaceAddrs)
err = util.SortedStrSliceCompare(obj.Addrs, ifaceAddrs)
if err == nil && kernelOK {
return true, nil
}
@@ -561,7 +562,7 @@ func (obj *NetRes) Compare(r Res) bool {
if (obj.Addrs == nil) != (res.Addrs == nil) {
return false
}
if err := StrSortedSliceCompare(obj.Addrs, res.Addrs); err != nil {
if err := util.SortedStrSliceCompare(obj.Addrs, res.Addrs); err != nil {
return false
}
if obj.Gateway != res.Gateway {