[ CMII ] [ Operator ] - get pod GitBranch from cmiiEnv

This commit is contained in:
zeaslity
2024-01-22 11:43:36 +08:00
parent 42dee262cf
commit f1fb7e8309
8 changed files with 186 additions and 20 deletions

View File

@@ -1986,15 +1986,6 @@ func (op *AgentOsOperator) chronyToMaster(args []string) [][]string {
func (op *AgentOsOperator) chronyToMasterExec(args []string) (bool, []string) {
if op.IsOsTypeCentOS {
// todo
return false, []string{
"[chronyToMasterExec] - do not support none ubuntu os !",
}
}
parseIP := net.ParseIP(args[0])
if parseIP == nil {
return false, []string{
@@ -2002,6 +1993,38 @@ func (op *AgentOsOperator) chronyToMasterExec(args []string) (bool, []string) {
}
}
if op.IsOsTypeCentOS {
if !op.CanAccessInternet {
return op.chronyToMasterCentOsOfflineExec(args)
}
// install ntp
installSoftwares, i := BasicInstallSoftwares(op.InstallCommandPrefix, true, "ntp")
if !installSoftwares {
msg := "[chronyToMasterExec] - centos install ntp error!"
log.ErrorF(msg)
return false, append(i, msg)
}
BasicSystemdUp("ntpd")
HardCodeCommandExecutor("ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime")
ok, resultLog := AllCommandExecutor([]string{
"ntpdate",
args[0],
})
if !ok {
sprintf := fmt.Sprintf("[chronyToMasterExec] - centos ntpdate to %s error", args[0])
log.Error(sprintf)
return false, append(resultLog, sprintf)
}
return true, []string{
"[chronyToMasterExec] - chrony to master success !",
}
}
// modify the systemd-timesync.service
ntpFile := "/etc/systemd/timesyncd.conf"
AllCommandExecutor([]string{
@@ -2051,6 +2074,13 @@ func (op *AgentOsOperator) chronyToMasterExec(args []string) (bool, []string) {
}
}
func (op *AgentOsOperator) chronyToMasterCentOsOfflineExec(args []string) (bool, []string) {
// todo
return true, nil
}
func (op *AgentOsOperator) installZSH() [][]string {
installZSHFunc := [][]string{