mirror of
https://github.com/containers/podman.git
synced 2025-11-13 01:29:06 +08:00
vendor c/common
Update the recent events-log changes to fix the build error. [NO NEW TESTS NEEDED] since there's no functional change. Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
28
vendor/github.com/containers/common/libnetwork/cni/cni_conversion.go
generated
vendored
28
vendor/github.com/containers/common/libnetwork/cni/cni_conversion.go
generated
vendored
@@ -11,7 +11,6 @@ import (
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/containernetworking/cni/libcni"
|
||||
@@ -21,6 +20,7 @@ import (
|
||||
pkgutil "github.com/containers/common/pkg/util"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func createNetworkFromCNIConfigList(conf *libcni.NetworkConfigList, confPath string) (*types.Network, error) {
|
||||
@@ -45,12 +45,11 @@ func createNetworkFromCNIConfigList(conf *libcni.NetworkConfigList, confPath str
|
||||
}
|
||||
}
|
||||
|
||||
f, err := os.Stat(confPath)
|
||||
t, err := fileTime(confPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
stat := f.Sys().(*syscall.Stat_t)
|
||||
network.Created = time.Unix(int64(stat.Ctim.Sec), int64(stat.Ctim.Nsec))
|
||||
network.Created = t
|
||||
|
||||
firstPlugin := conf.Plugins[0]
|
||||
network.Driver = firstPlugin.Network.Type
|
||||
@@ -316,16 +315,15 @@ func (n *cniNetwork) createCNIConfigListFromNetwork(network *types.Network, writ
|
||||
cniPathName := ""
|
||||
if writeToDisk {
|
||||
cniPathName = filepath.Join(n.cniConfigDir, network.Name+".conflist")
|
||||
err = ioutil.WriteFile(cniPathName, b, 0644)
|
||||
err = ioutil.WriteFile(cniPathName, b, 0o644)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
f, err := os.Stat(cniPathName)
|
||||
t, err := fileTime(cniPathName)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
stat := f.Sys().(*syscall.Stat_t)
|
||||
network.Created = time.Unix(int64(stat.Ctim.Sec), int64(stat.Ctim.Nsec))
|
||||
network.Created = t
|
||||
} else {
|
||||
network.Created = time.Now()
|
||||
}
|
||||
@@ -424,3 +422,17 @@ func parseOptions(networkOptions map[string]string, networkDriver string) (*opti
|
||||
}
|
||||
return opt, nil
|
||||
}
|
||||
|
||||
func fileTime(file string) (time.Time, error) {
|
||||
var st unix.Stat_t
|
||||
for {
|
||||
err := unix.Stat(file, &st)
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
if err != unix.EINTR { //nolint:errorlint // unix errors are bare
|
||||
return time.Time{}, &os.PathError{Path: file, Op: "stat", Err: err}
|
||||
}
|
||||
}
|
||||
return time.Unix(int64(st.Ctim.Sec), int64(st.Ctim.Nsec)), nil //nolint:unconvert // On some platforms Sec and Nsec are int32.
|
||||
}
|
||||
|
||||
1
vendor/github.com/containers/common/libnetwork/cni/config.go
generated
vendored
1
vendor/github.com/containers/common/libnetwork/cni/config.go
generated
vendored
@@ -17,7 +17,6 @@ import (
|
||||
|
||||
// NetworkCreate will take a partial filled Network and fill the
|
||||
// missing fields. It creates the Network and returns the full Network.
|
||||
// nolint:gocritic
|
||||
func (n *cniNetwork) NetworkCreate(net types.Network) (types.Network, error) {
|
||||
n.lock.Lock()
|
||||
defer n.lock.Unlock()
|
||||
|
||||
1
vendor/github.com/containers/common/libnetwork/internal/util/util.go
generated
vendored
1
vendor/github.com/containers/common/libnetwork/internal/util/util.go
generated
vendored
@@ -109,7 +109,6 @@ func GetFreeIPv4NetworkSubnet(usedNetworks []*net.IPNet, subnetPools []config.Su
|
||||
return nil, err
|
||||
}
|
||||
return nil, errors.New("could not find free subnet from subnet pools")
|
||||
|
||||
}
|
||||
|
||||
// GetFreeIPv6NetworkSubnet returns a unused ipv6 subnet
|
||||
|
||||
1
vendor/github.com/containers/common/libnetwork/netavark/config.go
generated
vendored
1
vendor/github.com/containers/common/libnetwork/netavark/config.go
generated
vendored
@@ -19,7 +19,6 @@ import (
|
||||
|
||||
// NetworkCreate will take a partial filled Network and fill the
|
||||
// missing fields. It creates the Network and returns the full Network.
|
||||
// nolint:gocritic
|
||||
func (n *netavarkNetwork) NetworkCreate(net types.Network) (types.Network, error) {
|
||||
n.lock.Lock()
|
||||
defer n.lock.Unlock()
|
||||
|
||||
4
vendor/github.com/containers/common/libnetwork/netavark/ipam.go
generated
vendored
4
vendor/github.com/containers/common/libnetwork/netavark/ipam.go
generated
vendored
@@ -59,9 +59,7 @@ func newIPAMError(cause error, msg string, args ...interface{}) *ipamError {
|
||||
// openDB will open the ipam database
|
||||
// Note that the caller has to Close it.
|
||||
func (n *netavarkNetwork) openDB() (*bbolt.DB, error) {
|
||||
// linter complains about the octal value
|
||||
// nolint:gocritic
|
||||
db, err := bbolt.Open(n.ipamDBPath, 0600, nil)
|
||||
db, err := bbolt.Open(n.ipamDBPath, 0o600, nil)
|
||||
if err != nil {
|
||||
return nil, newIPAMError(err, "failed to open database %s", n.ipamDBPath)
|
||||
}
|
||||
|
||||
4
vendor/github.com/containers/common/libnetwork/netavark/network.go
generated
vendored
4
vendor/github.com/containers/common/libnetwork/netavark/network.go
generated
vendored
@@ -108,11 +108,11 @@ func NewNetworkInterface(conf *InitConfig) (types.ContainerNetwork, error) {
|
||||
return nil, errors.Wrap(err, "failed to parse default subnet")
|
||||
}
|
||||
|
||||
if err := os.MkdirAll(conf.NetworkConfigDir, 0755); err != nil {
|
||||
if err := os.MkdirAll(conf.NetworkConfigDir, 0o755); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := os.MkdirAll(conf.NetworkRunDir, 0755); err != nil {
|
||||
if err := os.MkdirAll(conf.NetworkRunDir, 0o755); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
3
vendor/github.com/containers/common/libnetwork/network/interface.go
generated
vendored
3
vendor/github.com/containers/common/libnetwork/network/interface.go
generated
vendored
@@ -121,8 +121,7 @@ func defaultNetworkBackend(store storage.Store, conf *config.Config) (backend ty
|
||||
defer func() {
|
||||
// only write when there is no error
|
||||
if err == nil {
|
||||
// nolint:gocritic
|
||||
if err := ioutils.AtomicWriteFile(file, []byte(backend), 0644); err != nil {
|
||||
if err := ioutils.AtomicWriteFile(file, []byte(backend), 0o644); err != nil {
|
||||
logrus.Errorf("could not write network backend to file: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user