mantle/api: gcloud: don't mutate Image arg if not provided
If the user didn't specify any Image argument then there's no reason
for us to try to mutate it into something useful. Just leave it as an
empty string so later consumers can also do a useful check.
@@ -57,6 +57,7 @@ func New(opts *Options) (*API, error) {
// If the image name isn't a full api endpoint accept a name beginning
// with "projects/" to specify a different project from the instance.
// Also accept a short name and use instance project.
+ if opts.Image != "" {
if strings.HasPrefix(opts.Image, "projects/") {
opts.Image = endpointPrefix + opts.Image
} else if !strings.Contains(opts.Image, "/") {
@@ -64,6 +65,7 @@ func New(opts *Options) (*API, error) {
} else if !strings.HasPrefix(opts.Image, endpointPrefix) {
return nil, fmt.Errorf("GCE Image argument must be the full api endpoint, begin with 'projects/', or use the short name")
}
+ }
var (
client *http.Client
