MCPcopy
hub / github.com/cubefs/cubefs / transferConfigFileToRemote

Function transferConfigFileToRemote

deploy/cmd/transform.go:12–28  ·  view source on GitHub ↗
(localFilePath string, remoteFilePath string, remoteUser string, remoteHost string)

Source from the content-addressed store, hash-verified

10)
11
12func transferConfigFileToRemote(localFilePath string, remoteFilePath string, remoteUser string, remoteHost string) error {
13 localFile, err := os.Open(localFilePath)
14 if err != nil {
15 return fmt.Errorf("failed to open local file: %s", err)
16 }
17 defer localFile.Close()
18
19 cmd := exec.Command("scp", localFilePath, remoteUser+"@"+remoteHost+":"+remoteFilePath)
20 err = cmd.Run()
21 if err != nil {
22 return fmt.Errorf("file %s transferred to %s@%s:%s failed", localFilePath, remoteUser, remoteHost, remoteFilePath)
23 }
24
25 log.Printf("file '%s' transferred to '%s@%s:%s' successfully.\n", localFilePath, remoteUser, remoteHost, remoteFilePath)
26
27 return nil
28}
29
30func transferDirectoryToRemote(localFilePath string, remoteFilePath string, remoteUser string, remoteHost string) error {
31 localFile, err := os.Open(localFilePath)

Callers 5

startAllDataNodeFunction · 0.85
startAllMetaNodeFunction · 0.85
startAllMasterFunction · 0.85

Calls 5

OpenMethod · 0.65
ErrorfMethod · 0.65
CloseMethod · 0.65
RunMethod · 0.65
PrintfMethod · 0.65

Tested by

no test coverage detected