From 065e8592277a8dece32ca1d6c5620eb62d5bae9e Mon Sep 17 00:00:00 2001 From: Matt Burchett Date: Mon, 21 Mar 2022 19:26:39 -0500 Subject: [PATCH] virtual_environment_datastores.go: Update remote command to get datasource path (#49) This commit fixes the shell command that is being executed to get the datasource path which appears to be no longer functional. The previous command assumed that "path" is going to be the next line after the datasource name, leaving NFS mounts and other types of mount points non-functional. --- proxmox/virtual_environment_datastores.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxmox/virtual_environment_datastores.go b/proxmox/virtual_environment_datastores.go index 095235a1..5bcbf539 100644 --- a/proxmox/virtual_environment_datastores.go +++ b/proxmox/virtual_environment_datastores.go @@ -167,7 +167,7 @@ func (c *VirtualEnvironmentClient) UploadFileToDatastore(d *VirtualEnvironmentDa } buf, err := sshSession.CombinedOutput( - fmt.Sprintf(`grep -Pzo ': %s\s+path\s+[^\s]+' /etc/pve/storage.cfg | grep -Pzo '/[^\s]*' | tr -d '\000'`, d.DatastoreID), + fmt.Sprintf(`awk "/.+: %s$/,/^$/" /etc/pve/storage.cfg | grep -oP '(?<=path[ ])[^\s]+' | head -c -1`, d.DatastoreID), ) if err != nil {