~juju-qa/ubuntu/xenial/juju/2.0-rc2

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/cmd/juju/controller/addmodel.go

  • Committer: Nicholas Skaggs
  • Date: 2016-09-30 14:39:30 UTC
  • mfrom: (1.8.1)
  • Revision ID: nicholas.skaggs@canonical.com-20160930143930-vwwhrefh6ftckccy
import upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
                name, owner, cloudName, cloudRegion string,
130
130
                cloudCredential names.CloudCredentialTag,
131
131
                config map[string]interface{},
132
 
        ) (params.ModelInfo, error)
 
132
        ) (base.ModelInfo, error)
133
133
}
134
134
 
135
135
type CloudAPI interface {
196
196
                                return errors.Trace(err)
197
197
                        }
198
198
                }
199
 
                credentialTag, err = c.maybeUploadCredential(ctx, cloudClient, cloudTag, cloud, modelOwner)
 
199
                credentialTag, err = c.maybeUploadCredential(ctx, cloudClient, cloudTag, cloudRegion, cloud, modelOwner)
200
200
                if err != nil {
201
201
                        return errors.Trace(err)
202
202
                }
235
235
                messageFormat += " on %s"
236
236
                messageArgs = append(messageArgs, cloudRegion)
237
237
        }
238
 
        if model.CloudCredentialTag != "" {
239
 
                tag, err := names.ParseCloudCredentialTag(model.CloudCredentialTag)
240
 
                if err != nil {
241
 
                        return errors.Trace(err)
242
 
                }
 
238
        if model.CloudCredential != "" {
 
239
                tag := names.NewCloudCredentialTag(model.CloudCredential)
243
240
                credentialName := tag.Name()
244
241
                if tag.Owner().Canonical() != modelOwner {
245
242
                        credentialName = fmt.Sprintf("%s/%s", tag.Owner().Canonical(), credentialName)
389
386
        ctx *cmd.Context,
390
387
        cloudClient CloudAPI,
391
388
        cloudTag names.CloudTag,
 
389
        cloudRegion string,
392
390
        cloud jujucloud.Cloud,
393
391
        modelOwner string,
394
392
) (names.CloudCredentialTag, error) {
429
427
 
430
428
        // Upload the credential from the client, if it exists locally.
431
429
        credential, _, _, err := modelcmd.GetCredentials(
432
 
                c.ClientStore(), c.CloudRegion, credentialTag.Name(),
433
 
                cloudTag.Id(), cloud.Type,
 
430
                ctx, c.ClientStore(), modelcmd.GetCredentialsParams{
 
431
                        Cloud:          cloud,
 
432
                        CloudName:      cloudTag.Id(),
 
433
                        CloudRegion:    cloudRegion,
 
434
                        CredentialName: credentialTag.Name(),
 
435
                },
434
436
        )
435
437
        if err != nil {
436
438
                return names.CloudCredentialTag{}, errors.Trace(err)