本文整理汇总了Golang中github.com/juju/juju/environs.BootstrapContext.ShouldVerifyCredentials方法的典型用法代码示例。如果您正苦于以下问题:Golang BootstrapContext.ShouldVerifyCredentials方法的具体用法?Golang BootstrapContext.ShouldVerifyCredentials怎么用?Golang BootstrapContext.ShouldVerifyCredentials使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/environs.BootstrapContext
的用法示例。
在下文中一共展示了BootstrapContext.ShouldVerifyCredentials方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: PrepareForBootstrap
// PrepareForBootstrap is specified in the EnvironProvider interface.
func (prov *azureEnvironProvider) PrepareForBootstrap(ctx environs.BootstrapContext, cfg *config.Config) (environs.Environ, error) {
// Ensure that internal configuration is not specified, and then set
// what we can now. We only need to do this during bootstrap. Validate
// will check for changes later.
unknownAttrs := cfg.UnknownAttrs()
for _, key := range internalConfigAttributes {
if _, ok := unknownAttrs[key]; ok {
return nil, errors.Errorf(`internal config %q must not be specified`, key)
}
}
// Record the UUID that will be used for the controller environment.
cfg, err := cfg.Apply(map[string]interface{}{
configAttrControllerResourceGroup: resourceGroupName(cfg),
})
if err != nil {
return nil, errors.Annotate(err, "recording controller-resource-group")
}
env, err := prov.Open(cfg)
if err != nil {
return nil, errors.Trace(err)
}
if ctx.ShouldVerifyCredentials() {
if err := verifyCredentials(env.(*azureEnviron)); err != nil {
return nil, errors.Trace(err)
}
}
return env, nil
}
示例2: PrepareForBootstrap
// PrepareForBootstrap implements environs.Environ.
func (env *environ) PrepareForBootstrap(ctx environs.BootstrapContext) error {
if ctx.ShouldVerifyCredentials() {
if err := env.gce.VerifyCredentials(); err != nil {
return errors.Trace(err)
}
}
return nil
}
示例3: PrepareForBootstrap
// PrepareForBootstrap is specified in the EnvironProvider interface.
func (p maasEnvironProvider) PrepareForBootstrap(ctx environs.BootstrapContext, cfg *config.Config) (environs.Environ, error) {
env, err := p.Open(cfg)
if err != nil {
return nil, err
}
if ctx.ShouldVerifyCredentials() {
if err := verifyCredentials(env.(*maasEnviron)); err != nil {
return nil, err
}
}
return env, nil
}
示例4: PrepareForBootstrap
// PrepareForBootstrap is specified in the EnvironProvider interface.
func (p joyentProvider) PrepareForBootstrap(ctx environs.BootstrapContext, cfg *config.Config) (environs.Environ, error) {
e, err := p.Open(cfg)
if err != nil {
return nil, errors.Trace(err)
}
if ctx.ShouldVerifyCredentials() {
if err := verifyCredentials(e.(*joyentEnviron)); err != nil {
return nil, errors.Trace(err)
}
}
return e, nil
}
示例5: PrepareForBootstrap
// PrepareForBootstrap is specified in the EnvironProvider interface.
func (prov azureEnvironProvider) PrepareForBootstrap(ctx environs.BootstrapContext, cfg *config.Config) (environs.Environ, error) {
cfg, err := prov.PrepareForCreateEnvironment(cfg)
if err != nil {
return nil, errors.Trace(err)
}
env, err := prov.Open(cfg)
if err != nil {
return nil, errors.Trace(err)
}
if ctx.ShouldVerifyCredentials() {
if err := verifyCredentials(env.(*azureEnviron)); err != nil {
return nil, errors.Trace(err)
}
}
return env, nil
}
示例6: PrepareForBootstrap
func (p environProvider) PrepareForBootstrap(ctx environs.BootstrapContext, cfg *config.Config) (environs.Environ, error) {
cfg, err := p.PrepareForCreateEnvironment(cfg)
if err != nil {
return nil, err
}
e, err := p.Open(cfg)
if err != nil {
return nil, err
}
if ctx.ShouldVerifyCredentials() {
if err := verifyCredentials(e.(*environ)); err != nil {
return nil, err
}
}
return e, nil
}