Use ParseSignal and AtomicWriteFile functions from containerd

Containerd has its own ParseSignal and AtomicWriteFile implementation.
So there's no need to use these function from github.com/docker/docker.

Signed-off-by: Shengjing Zhu <i@zhsj.me>
This commit is contained in:
Shengjing Zhu
2019-03-08 00:44:30 +08:00
parent 95f564f95b
commit c6729fe0c4
20 changed files with 4 additions and 1169 deletions

View File

@@ -23,7 +23,7 @@ import (
"path/filepath"
"sync"
"github.com/docker/docker/pkg/ioutils"
"github.com/containerd/continuity"
"github.com/pkg/errors"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)
@@ -160,7 +160,7 @@ func StoreStatus(root, id string, status Status) (StatusStorage, error) {
return nil, errors.Wrap(err, "failed to encode status")
}
path := filepath.Join(root, "status")
if err := ioutils.AtomicWriteFile(path, data, 0600); err != nil {
if err := continuity.AtomicWriteFile(path, data, 0600); err != nil {
return nil, errors.Wrapf(err, "failed to checkpoint status to %q", path)
}
return &statusStorage{
@@ -209,7 +209,7 @@ func (s *statusStorage) UpdateSync(u UpdateFunc) error {
if err != nil {
return errors.Wrap(err, "failed to encode status")
}
if err := ioutils.AtomicWriteFile(s.path, data, 0600); err != nil {
if err := continuity.AtomicWriteFile(s.path, data, 0600); err != nil {
return errors.Wrapf(err, "failed to checkpoint status to %q", s.path)
}
s.status = newStatus