dbeaver / dbeaver

Free universal database tool and SQL client
https://dbeaver.io
Apache License 2.0
40.73k stars 3.51k forks source link

Connection shell commands unexpected behaviour #17801

Open PeterMaltby opened 2 years ago

PeterMaltby commented 2 years ago

Description

I was attempting to use the following script in the Connection setting -> Shell commands "before connect" section in order to create an ssh tunnel to AWS recourse that frequently changes location the code is:

instanceId=`aws ssm describe-instance-information --filters "Key=tag:Name,Values=name-of-db" --profile PROFILE-NAME --region eu-west-1 | grep InstanceId | cut -d'"' -f4`
aws ssm start-session --target $instanceId --document-name AWS-StartPortForwardingSession --parameters "portNumber=[50000],localPortNumber=[50001]" --region eu-west-1 --profile PROFILE-NAME

upon connecting I get the below error:

Can't start process
  Cannot run program "instanceId=`aws" (in directory "/Users/peter.maltby1/scripts"): error=2, No such file or directory
  Cannot run program "instanceId=`aws" (in directory "/Users/peter.maltby1/scripts"): error=2, No such file or directory
    error=2, No such file or directory
    error=2, No such file or directory

Some investigation has led to me seeing the output of $PATH is not correct, however even when manually entering the path to the above commands " the desired outcome is still not reached, I can confirm the script runs on my system outside of DBeaver.

Apologies as I only have the above hardware to attempt this on so am uncertain if this is a system-specific bug, or whether I'm misunderstanding how to use the Shell commands and its limitations as I could not find much documentation. Thanks.

DBeaver Version

Community 22.2.1.202209251341

Operating System

macOS Monterey v 12.5.1

Database and driver

n/a

Steps to reproduce

run above script inside shell commands.

Fydon commented 4 months ago

Ideally it would be possible to grant DBeaver Full Disk Access via the Privacy & Security setting. However for now I've overcome this by opening in via Terminal with elevated permissions as sudo open /Applications/DBeaver.app.