[ Agent ] [ Base ] - refresh for euler
This commit is contained in:
@@ -27,6 +27,8 @@ type AgentOsOperator struct {
|
||||
|
||||
IsOsTypeCentOS bool `json:"is_os_type_centos",comment:"主机操作系统是否为centos系列"`
|
||||
|
||||
IsOsTypeEuler bool `json:"is_os_type_euler",comment:"主机操作系统是否为国产欧拉系列"`
|
||||
|
||||
IsAgentInnerWall bool `json:"is_agent_inner_wall",comment:"主机是否身处国内"`
|
||||
|
||||
AgentArch string `json:"agent_arch",comment:"主机的CPU架构,可选为amd64 arm64"`
|
||||
@@ -353,6 +355,7 @@ func (op *AgentOsOperator) installDefaultSSHKeyExec(funcArgs []string) (bool, []
|
||||
|
||||
// ssh-keygen -t ed25519 -C "wdd@cmii.com"
|
||||
// ssh-keygen -t rsa -P "" -f /root/.ssh/id_rsa -b 4096
|
||||
BasicCreateFolder("/root/.ssh/")
|
||||
|
||||
// check key exists
|
||||
if BasicFileExistAndNotNull("/root/.ssh/id_ed25519") {
|
||||
@@ -598,6 +601,8 @@ func (op *AgentOsOperator) installDockerExec(args []string) (bool, []string) {
|
||||
|
||||
BasicCreateFolder("/root/wdd/")
|
||||
|
||||
op.removeDockerExec()
|
||||
|
||||
if op.IsOsTypeUbuntu {
|
||||
|
||||
if !op.CanAccessInternet {
|
||||
@@ -777,11 +782,44 @@ func (op *AgentOsOperator) installDockerExec(args []string) (bool, []string) {
|
||||
return false, append(log5, "启动docker.service失败,请查明原因!", "journalctl -u docker -n 100 -f")
|
||||
}
|
||||
} else if op.IsOsTypeCentOS {
|
||||
if !op.CanAccessInternet {
|
||||
if !op.CanAccessInternet || op.IsOsTypeEuler {
|
||||
// offline version
|
||||
log.InfoF("[installDockerExec] - centos can not access to internet, installing by offline !")
|
||||
return op.installDockerOfflineExec(args)
|
||||
}
|
||||
|
||||
// download
|
||||
var dockerRepo string
|
||||
if op.IsAgentInnerWall {
|
||||
dockerRepo = "https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo"
|
||||
} else {
|
||||
dockerRepo = "https://download.docker.com/linux/centos/docker-ce.repo"
|
||||
}
|
||||
|
||||
AllCommandExecutor(append(op.InstallCommandPrefix, "yum-utils"))
|
||||
|
||||
ok, resultLog := AllCommandExecutor(
|
||||
[]string{
|
||||
"yum-config-manager",
|
||||
"--add-repo",
|
||||
dockerRepo,
|
||||
},
|
||||
)
|
||||
if !ok {
|
||||
return false, resultLog
|
||||
}
|
||||
|
||||
// todo 20 version
|
||||
resultOk, l := AllCommandExecutor(append(op.InstallCommandPrefix, "docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin"))
|
||||
|
||||
if !resultOk {
|
||||
return false, l
|
||||
}
|
||||
|
||||
systemdUp, log2 := BasicSystemdUp("docker")
|
||||
if !systemdUp {
|
||||
return false, log2
|
||||
}
|
||||
}
|
||||
|
||||
return true, []string{
|
||||
@@ -1995,7 +2033,7 @@ func (op *AgentOsOperator) chronyToMasterExec(args []string) (bool, []string) {
|
||||
|
||||
if op.IsOsTypeCentOS {
|
||||
if !op.CanAccessInternet {
|
||||
return op.chronyToMasterCentOsOfflineExec(args)
|
||||
return op.chronyToMasterByDocker(args)
|
||||
}
|
||||
|
||||
// install ntp
|
||||
@@ -2074,9 +2112,7 @@ func (op *AgentOsOperator) chronyToMasterExec(args []string) (bool, []string) {
|
||||
}
|
||||
}
|
||||
|
||||
func (op *AgentOsOperator) chronyToMasterCentOsOfflineExec(args []string) (bool, []string) {
|
||||
|
||||
// todo
|
||||
func (op *AgentOsOperator) chronyToMasterByDocker(args []string) (bool, []string) {
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user