From ce9a04eb80e90c1204e28fc812156489f77add6d Mon Sep 17 00:00:00 2001 From: 24sama Date: Wed, 7 Dec 2022 14:15:15 +0800 Subject: [PATCH] fix: a sha256 checking bug when downloading different versions of binary files Signed-off-by: 24sama --- pkg/service/operation/file/containerd.go | 2 +- pkg/service/operation/file/crictl.go | 2 +- pkg/service/operation/file/docker.go | 4 ++-- pkg/service/operation/file/k3s.go | 2 +- pkg/service/operation/file/kubeadm.go | 2 +- pkg/service/operation/file/kubecni.go | 2 +- pkg/service/operation/file/kubectl.go | 2 +- pkg/service/operation/file/kubelet.go | 2 +- pkg/service/operation/file/runc.go | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pkg/service/operation/file/containerd.go b/pkg/service/operation/file/containerd.go index 019cfb316..809a0b8f5 100644 --- a/pkg/service/operation/file/containerd.go +++ b/pkg/service/operation/file/containerd.go @@ -44,7 +44,7 @@ func NewContainerd(sshClient ssh.Interface, rootFs rootfs.Interface, version, ar RootFs: rootFs, Type: FileBinary, Name: fileName, - LocalFullPath: filepath.Join(rootFs.ClusterRootFsDir(), fileName), + LocalFullPath: filepath.Join(rootFs.ClusterRootFsDir(), ContainerdID, version, arch, fileName), RemoteFullPath: filepath.Join(BinDir, fileName), }) if err != nil { diff --git a/pkg/service/operation/file/crictl.go b/pkg/service/operation/file/crictl.go index 10e745e94..e0bb01079 100644 --- a/pkg/service/operation/file/crictl.go +++ b/pkg/service/operation/file/crictl.go @@ -46,7 +46,7 @@ func NewCrictl(sshClient ssh.Interface, rootFs rootfs.Interface, version, arch s RootFs: rootFs, Type: FileBinary, Name: fileName, - LocalFullPath: filepath.Join(rootFs.ClusterRootFsDir(), fileName), + LocalFullPath: filepath.Join(rootFs.ClusterRootFsDir(), CrictlID, version, arch, fileName), RemoteFullPath: filepath.Join(BinDir, fileName), }) if err != nil { diff --git a/pkg/service/operation/file/docker.go b/pkg/service/operation/file/docker.go index 5464f186c..7048b9b0f 100644 --- a/pkg/service/operation/file/docker.go +++ b/pkg/service/operation/file/docker.go @@ -60,7 +60,7 @@ func NewDocker(sshClient ssh.Interface, rootFs rootfs.Interface, version, arch s RootFs: rootFs, Type: FileBinary, Name: fileName, - LocalFullPath: filepath.Join(rootFs.ClusterRootFsDir(), fileName), + LocalFullPath: filepath.Join(rootFs.ClusterRootFsDir(), DockerID, version, arch, fileName), RemoteFullPath: filepath.Join(directory.BinDir, fileName), }) if err != nil { @@ -100,7 +100,7 @@ func NewCRIDockerd(sshClient ssh.Interface, rootFs rootfs.Interface, version, ar RootFs: rootFs, Type: FileBinary, Name: fileName, - LocalFullPath: filepath.Join(rootFs.ClusterRootFsDir(), fileName), + LocalFullPath: filepath.Join(rootFs.ClusterRootFsDir(), CRIDockerdID, version, arch, fileName), RemoteFullPath: filepath.Join(directory.BinDir, fileName), }) if err != nil { diff --git a/pkg/service/operation/file/k3s.go b/pkg/service/operation/file/k3s.go index 360fd5a48..9e81f4645 100644 --- a/pkg/service/operation/file/k3s.go +++ b/pkg/service/operation/file/k3s.go @@ -46,7 +46,7 @@ func NewK3s(sshClient ssh.Interface, rootFs rootfs.Interface, version, arch stri RootFs: rootFs, Type: FileBinary, Name: fileName, - LocalFullPath: filepath.Join(rootFs.ClusterRootFsDir(), fileName), + LocalFullPath: filepath.Join(rootFs.ClusterRootFsDir(), K3sID, version, arch, fileName), RemoteFullPath: filepath.Join(BinDir, fileName), }) if err != nil { diff --git a/pkg/service/operation/file/kubeadm.go b/pkg/service/operation/file/kubeadm.go index 7b1432f00..1882b05f9 100644 --- a/pkg/service/operation/file/kubeadm.go +++ b/pkg/service/operation/file/kubeadm.go @@ -46,7 +46,7 @@ func NewKubeadm(sshClient ssh.Interface, rootFs rootfs.Interface, version, arch RootFs: rootFs, Type: FileBinary, Name: fileName, - LocalFullPath: filepath.Join(rootFs.ClusterRootFsDir(), fileName), + LocalFullPath: filepath.Join(rootFs.ClusterRootFsDir(), KubeadmID, version, arch, fileName), RemoteFullPath: filepath.Join(BinDir, fileName), }) if err != nil { diff --git a/pkg/service/operation/file/kubecni.go b/pkg/service/operation/file/kubecni.go index 405de4632..99b520f1a 100644 --- a/pkg/service/operation/file/kubecni.go +++ b/pkg/service/operation/file/kubecni.go @@ -48,7 +48,7 @@ func NewKubecni(sshClient ssh.Interface, rootFs rootfs.Interface, version, arch RootFs: rootFs, Type: FileBinary, Name: fileName, - LocalFullPath: filepath.Join(rootFs.ClusterRootFsDir(), fileName), + LocalFullPath: filepath.Join(rootFs.ClusterRootFsDir(), KubecniID, version, arch, fileName), RemoteFullPath: filepath.Join(OptCniBinDir, fileName), }) if err != nil { diff --git a/pkg/service/operation/file/kubectl.go b/pkg/service/operation/file/kubectl.go index 4ef4f8155..bd09beb92 100644 --- a/pkg/service/operation/file/kubectl.go +++ b/pkg/service/operation/file/kubectl.go @@ -46,7 +46,7 @@ func NewKubectl(sshClient ssh.Interface, rootFs rootfs.Interface, version, arch RootFs: rootFs, Type: FileBinary, Name: fileName, - LocalFullPath: filepath.Join(rootFs.ClusterRootFsDir(), fileName), + LocalFullPath: filepath.Join(rootFs.ClusterRootFsDir(), KubectlID, version, arch, fileName), RemoteFullPath: filepath.Join(BinDir, fileName), }) if err != nil { diff --git a/pkg/service/operation/file/kubelet.go b/pkg/service/operation/file/kubelet.go index 35b2fb787..177b82f78 100644 --- a/pkg/service/operation/file/kubelet.go +++ b/pkg/service/operation/file/kubelet.go @@ -46,7 +46,7 @@ func NewKubelet(sshClient ssh.Interface, rootFs rootfs.Interface, version, arch RootFs: rootFs, Type: FileBinary, Name: fileName, - LocalFullPath: filepath.Join(rootFs.ClusterRootFsDir(), fileName), + LocalFullPath: filepath.Join(rootFs.ClusterRootFsDir(), KubeletID, version, arch, fileName), RemoteFullPath: filepath.Join(BinDir, fileName), }) if err != nil { diff --git a/pkg/service/operation/file/runc.go b/pkg/service/operation/file/runc.go index c6d4b7897..5f85ec318 100644 --- a/pkg/service/operation/file/runc.go +++ b/pkg/service/operation/file/runc.go @@ -45,7 +45,7 @@ func NewRunc(sshClient ssh.Interface, rootFs rootfs.Interface, version, arch str RootFs: rootFs, Type: FileBinary, Name: fileName, - LocalFullPath: filepath.Join(rootFs.ClusterRootFsDir(), fileName), + LocalFullPath: filepath.Join(rootFs.ClusterRootFsDir(), RuncID, version, arch, fileName), RemoteFullPath: filepath.Join(BinDir, fileName), }) if err != nil {