本文整理匯總了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
}