Skip to content

Commit

Permalink
evetestkit : sanity check in AppSCPCopy
Browse files Browse the repository at this point in the history
Do sanity check in AppSCPCopy to make sure that the source does exist
and it is not a directory.

Signed-off-by: Shahriyar Jalayeri <shahriyar@zededa.com>
  • Loading branch information
shjala committed Sep 24, 2024
1 parent ea4dc8d commit 655570b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/evetestkit/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,14 @@ func (node *EveNode) AppSSHExec(appName, command string) (string, error) {

// AppSCPCopy copies a file from the local machine to the app VM running on the EVE node.
func (node *EveNode) AppSCPCopy(appName, localFile, remoteFile string) error {
info, err := os.Stat(localFile)
if os.IsNotExist(err) {
return fmt.Errorf("file %s does not exist", localFile)
}
if info.IsDir() {
return fmt.Errorf("file %s is a directory", localFile)
}

appConfig := node.getAppConfig(appName)
if appConfig == nil {
return fmt.Errorf("app %s not found, make sure to deploy app/vm with WithSSH option", appName)
Expand Down

0 comments on commit 655570b

Please sign in to comment.