本文整理汇总了Golang中launchpad/net/juju-core/agent.Conf.OpenState方法的典型用法代码示例。如果您正苦于以下问题:Golang Conf.OpenState方法的具体用法?Golang Conf.OpenState怎么用?Golang Conf.OpenState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类launchpad/net/juju-core/agent.Conf
的用法示例。
在下文中一共展示了Conf.OpenState方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestOpenStateNormal
func (s *openSuite) TestOpenStateNormal(c *C) {
conf := agent.Conf{
StateInfo: s.StateInfo(c),
}
conf.OldPassword = "irrelevant"
st, err := conf.OpenState()
c.Assert(err, IsNil)
st.Close()
}
示例2: TestOpenStateNoPassword
func (s *openSuite) TestOpenStateNoPassword(c *C) {
conf := agent.Conf{
StateInfo: s.StateInfo(c),
}
conf.OldPassword = conf.StateInfo.Password
conf.StateInfo.Password = ""
st, err := conf.OpenState()
c.Assert(err, IsNil)
c.Assert(st, NotNil)
st.Close()
}
示例3: TestOpenStateFallbackPassword
func (s *openSuite) TestOpenStateFallbackPassword(c *gc.C) {
conf := agent.Conf{
StateInfo: s.StateInfo(c),
}
conf.OldPassword = conf.StateInfo.Password
conf.StateInfo.Password = "not the right password"
st, err := conf.OpenState()
c.Assert(err, gc.IsNil)
c.Assert(st, gc.NotNil)
st.Close()
}
示例4: openState
func openState(c *agent.Conf, a Agent) (*state.State, AgentState, error) {
st, err := c.OpenState()
if err != nil {
return nil, nil, err
}
entity, err := a.Entity(st)
if errors.IsNotFoundError(err) || err == nil && entity.Life() == state.Dead {
err = worker.ErrTerminateAgent
}
if err != nil {
st.Close()
return nil, nil, err
}
return st, entity, nil
}