本文整理汇总了Golang中github.com/juju/juju/api/agent.Entity类的典型用法代码示例。如果您正苦于以下问题:Golang Entity类的具体用法?Golang Entity怎么用?Golang Entity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Entity类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: setupContainerSupport
// setupContainerSupport determines what containers can be run on this machine and
// initialises suitable infrastructure to support such containers.
func (a *MachineAgent) setupContainerSupport(runner worker.Runner, st *api.State, entity *apiagent.Entity, agentConfig agent.Config) error {
var supportedContainers []instance.ContainerType
// We don't yet support nested lxc containers but anything else can run an LXC container.
if entity.ContainerType() != instance.LXC {
supportedContainers = append(supportedContainers, instance.LXC)
}
supportsKvm, err := kvm.IsKVMSupported()
if err != nil {
logger.Warningf("determining kvm support: %v\nno kvm containers possible", err)
}
if err == nil && supportsKvm {
supportedContainers = append(supportedContainers, instance.KVM)
}
return a.updateSupportedContainers(runner, st, entity.Tag(), supportedContainers, agentConfig)
}
开发者ID:zhouqt,项目名称:juju,代码行数:17,代码来源:machine.go
示例2: setAgentPassword
func setAgentPassword(newPw, oldPw string, a agent.Agent, entity *apiagent.Entity) error {
// Change the configuration *before* setting the entity
// password, so that we avoid the possibility that
// we might successfully change the entity's
// password but fail to write the configuration,
// thus locking us out completely.
if err := a.ChangeConfig(func(c agent.ConfigSetter) error {
c.SetPassword(newPw)
c.SetOldPassword(oldPw)
return nil
}); err != nil {
return err
}
return entity.SetPassword(newPw)
}
开发者ID:exekias,项目名称:juju,代码行数:15,代码来源:open.go
注:本文中的github.com/juju/juju/api/agent.Entity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论