gcloud compute execute command remotely

A gcloud update that landed a week ago blocked passing ssh commands after '--' and effectively forces use of --command option for this. In this case use:

gcloud compute ssh --zone ZONE INSTANCE --command 'cd /tmp && python some.py'.


Try:

$ gcloud compute ssh --zone ZONE INSTANCE -- 'cd /tmp && python some.py'

From gcloud compute ssh --help:

 [-- IMPLEMENTATION-ARGS ...]
    Flags and positionals passed to the underlying ssh implementation.

    The '--' argument must be specified between gcloud specific args on the
    left and IMPLEMENTATION-ARGS on the right. Example:

        $ gcloud compute ssh example-instance --zone us-central1-a -- -vvv \
            -L 80:%INSTANCE%:80