[agent-go]-简化Agent 剔除Harbor K8s Image相关的内容
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
)
|
||||
|
||||
var OctopusAgentInstallPrefix = "/root/wdd/"
|
||||
var nfsDataPath = "/var/lib/docker/nfs_data"
|
||||
|
||||
type BaseFunc interface {
|
||||
|
||||
@@ -500,6 +501,41 @@ func (op *AgentOsOperator) InstallDefaultSshBastion() (bool, []string) {
|
||||
}
|
||||
}
|
||||
|
||||
func (op *AgentOsOperator) ModifySSHConfigBastion() (bool, []string) {
|
||||
// 替换sshd文件
|
||||
sshdConfigFile := "/etc/ssh/sshd_config"
|
||||
sshConfigBackupFile := "/etc/ssh/sshd_config_wdd_back"
|
||||
|
||||
// 只备份第一次
|
||||
if !BasicFileExistAndNotNull(sshConfigBackupFile) {
|
||||
BasicAppendOverwriteContentToFile(sshdConfigFile, sshConfigBackupFile)
|
||||
}
|
||||
|
||||
// AllowTcpForwarding yes
|
||||
// AllowAgentForwarding yes
|
||||
// X11Forwarding yes
|
||||
// StrictMode no
|
||||
// PermitRootLogin yes
|
||||
// PasswordAuthentication yes
|
||||
// PubkeyAuthentication yes
|
||||
|
||||
// 直接使用默认的sshd_config配置
|
||||
if !BasicAppendOverwriteContentToFile(beans.DefaultSshdConfig, sshdConfigFile) {
|
||||
return false, []string{
|
||||
"error write default sshd config to sshd file",
|
||||
}
|
||||
}
|
||||
|
||||
ok, resultLog := BasicSystemdRestart("sshd")
|
||||
if !ok {
|
||||
return false, []string{
|
||||
"sshd restart failed ! please check !",
|
||||
}
|
||||
}
|
||||
|
||||
return true, resultLog
|
||||
}
|
||||
|
||||
func (op *AgentOsOperator) removeDocker() [][]string {
|
||||
|
||||
removeDockerLine := append(op.RemoveCommandPrefix, []string{
|
||||
|
||||
Reference in New Issue
Block a user