bumplzz69 / google-cloud-sdk

Automatically exported from code.google.com/p/google-cloud-sdk
0 stars 0 forks source link

"gcloud compute ssh" always sets return code to 1 if ssh return code is not zero #146

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Running any command that returns a non-zero exit code via gcloud compute ssh:

gcloud compute ssh my-gce-instance --command="exit 3"; echo $?

What is the expected output? What do you see instead?

In this particular case, $? was 1. An equivalent ssh command sets $? to 3. The 
output of the gcloud command itself is actually 
ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [3].

In fact, all nonzero return values are translated to an exit code of 1 from 
gcloud. This makes scripting that depends on exit code fail.

What is the output of 'gcloud info'?

Google Cloud SDK [0.9.61]

Platform: [Linux, x86_64]
Python Version: [2.7.3 (default, Dec 18 2014, 19:10:20)  [GCC 4.6.3]]
Site Packages: [Disabled]

Installation Root: [/home/scole/google-cloud-sdk]
Installed Components:
  kubectl: []
  app-engine-python: [1.9.20]
  core-nix: [2015.05.26]
  gcutil: [1.16.5]
  gae-go: [2015.05.26]
  gae-python: [2014.05.06]
  core: [2015.05.19]
  app-engine-go-linux-x86_64: [1.9.20]
  gae-go-nix: [2015.05.26]
  gcloud: [2015.05.19]
  gsutil-nix: [4.12]
  app-engine-python-extras: [1.9.21]
  gsutil: [4.12]
  bq: [2.0.18]
  dns: [2015.05.26]
  sql: [2015.05.26]
  compute: [2015.05.19]
  kubectl-linux-x86_64: [0.17.0]
  gcutil-nix: [1.16.5]
  bq-nix: [2.0.18]
System PATH: 
[/home/scole/google-cloud-sdk/bin:/home/scole/bin:/home/scole/google-cloud-sdk/b
in:/home/scole/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:
/usr/games:/home/scole/.rvm/bin:/home/scole/fleet/bin:/home/scole/.rvm/bin]
Cloud SDK on PATH: [True]

Installation Properties: [/home/scole/google-cloud-sdk/properties]
User Config Directory: [/home/scole/.config/gcloud]
User Properties: [/home/scole/.config/gcloud/properties]
Current Workspace: [None]
Workspace Config Directory: [None]
Workspace Properties: [None]

Account: [steven_cole@playstation.sony.com]
Project: [XXXXX]

Current Properties:
  [core]
    project: [XXXXX]
    account: [steven_cole@playstation.sony.com]
    disable_usage_reporting: [False]

Logs Directory: [/home/scole/.config/gcloud/logs]
Last Log File: [/home/scole/.config/gcloud/logs/2015.06.03/15.27.04.652760.log]

Please provide any additional information below.

Original issue reported on code.google.com by steven_c...@playstation.sony.com on 3 Jun 2015 at 10:34

GoogleCodeExporter commented 9 years ago
Thanks for the report!  I agree that the proposed behavior---having gcloud's 
exit status match the command's---would be a better behavior.  I've created a 
ticket internally to track this.

Original comment by jeffvaug...@google.com on 4 Jun 2015 at 4:47