about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/admin/google-cloud-sdk/cloud_sql_proxy_path.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/admin/google-cloud-sdk/cloud_sql_proxy_path.patch')
-rw-r--r--nixpkgs/pkgs/tools/admin/google-cloud-sdk/cloud_sql_proxy_path.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/admin/google-cloud-sdk/cloud_sql_proxy_path.patch b/nixpkgs/pkgs/tools/admin/google-cloud-sdk/cloud_sql_proxy_path.patch
new file mode 100644
index 000000000000..aec4be2ec19a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/admin/google-cloud-sdk/cloud_sql_proxy_path.patch
@@ -0,0 +1,36 @@
+diff --git a/lib/googlecloudsdk/api_lib/sql/instances.py b/lib/googlecloudsdk/api_lib/sql/instances.py
+index 0d88ffe..814a436 100644
+--- a/lib/googlecloudsdk/api_lib/sql/instances.py
++++ b/lib/googlecloudsdk/api_lib/sql/instances.py
+@@ -86,18 +86,19 @@ def GetRegionFromZone(gce_zone):
+ def _GetCloudSqlProxyPath():
+   """Determines the path to the cloud_sql_proxy binary."""
+   sdk_bin_path = config.Paths().sdk_bin_path
+-  if not sdk_bin_path:
+-    # Check if cloud_sql_proxy is located on the PATH.
+-    proxy_path = file_utils.FindExecutableOnPath('cloud_sql_proxy')
+-    if proxy_path:
+-      log.debug(
+-          'Using cloud_sql_proxy found at [{path}]'.format(path=proxy_path))
+-      return proxy_path
+-    else:
+-      raise exceptions.ToolException(
+-          'A Cloud SQL Proxy SDK root could not be found. Please check your '
+-          'installation.')
+-  return os.path.join(sdk_bin_path, 'cloud_sql_proxy')
++  if sdk_bin_path and os.path.isfile(os.path.join(sdk_bin_path, 'cloud_sql_proxy')):
++      return os.path.join(sdk_bin_path, 'cloud_sql_proxy')
++
++  # Check if cloud_sql_proxy is located on the PATH.
++  proxy_path = file_utils.FindExecutableOnPath('cloud_sql_proxy')
++  if proxy_path:
++    log.debug(
++        'Using cloud_sql_proxy found at [{path}]'.format(path=proxy_path))
++    return proxy_path
++
++  raise exceptions.ToolException(
++      'A Cloud SQL Proxy SDK root could not be found. Please check your '
++      'installation.')
+ 
+ 
+ def _RaiseProxyError(error_msg=None):