Skip to content

Commit

Permalink
virtual_environment_datastores.go: Update remote command to get datas…
Browse files Browse the repository at this point in the history
…ource 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.
  • Loading branch information
mattburchett authored Mar 22, 2022
1 parent 75e01de commit 065e859
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion proxmox/virtual_environment_datastores.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 065e859

Please sign in to comment.