MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / updateSSHSingleDirectiveValue

Function updateSSHSingleDirectiveValue

agent/app/service/ssh.go:1021–1038  ·  view source on GitHub ↗
(key, value string, directives []sshDirective)

Source from the content-addressed store, hash-verified

1019}
1020
1021func updateSSHSingleDirectiveValue(key, value string, directives []sshDirective) error {
1022 block, err := loadSSHManagedBlockFromFile(sshPath)
1023 if err != nil {
1024 return err
1025 }
1026 for _, item := range directives {
1027 if item.InMatch || !strings.EqualFold(item.Key, key) {
1028 continue
1029 }
1030 if item.File == sshPath && block.contains(item.Line) {
1031 continue
1032 }
1033 if err := commentSSHConfigLines(item.File, []int{item.Line}); err != nil {
1034 return err
1035 }
1036 }
1037 return rewriteSSHManagedDirectives(sshPath, key, []string{fmt.Sprintf("%s %s", key, value)})
1038}
1039
1040func rewriteSSHMultiValueDirective(key, value string, directives []sshDirective) error {
1041 block, err := loadSSHManagedBlockFromFile(sshPath)

Callers 1

updateSSHDirectiveValueFunction · 0.85

Calls 4

commentSSHConfigLinesFunction · 0.85
containsMethod · 0.80

Tested by

no test coverage detected