本文整理匯總了Golang中launchpad/net/juju-core/state.Machine.EntityName方法的典型用法代碼示例。如果您正苦於以下問題:Golang Machine.EntityName方法的具體用法?Golang Machine.EntityName怎麽用?Golang Machine.EntityName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類launchpad/net/juju-core/state.Machine
的用法示例。
在下文中一共展示了Machine.EntityName方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: checkStartInstance
// checkStartInstance checks that an instance has been started
// with a machine id the same as m's, and that the machine's
// instance id has been set appropriately.
func (s *ProvisionerSuite) checkStartInstance(c *C, m *state.Machine, secret string) {
s.State.StartSync()
for {
select {
case o := <-s.op:
switch o := o.(type) {
case dummy.OpStartInstance:
info := s.StateInfo(c)
info.EntityName = m.EntityName()
c.Assert(o.Info.Password, Not(HasLen), 0)
info.Password = o.Info.Password
c.Assert(o.Info, DeepEquals, info)
// Check we can connect to the state with
// the machine's entity name and password.
st, err := state.Open(o.Info)
c.Assert(err, IsNil)
st.Close()
c.Assert(o.MachineId, Equals, m.Id())
c.Assert(o.Instance, NotNil)
s.checkInstanceId(c, m, o.Instance)
c.Assert(o.Secret, Equals, secret)
return
default:
c.Logf("ignoring unexpected operation %#v", o)
}
case <-time.After(2 * time.Second):
c.Errorf("provisioner did not start an instance")
return
}
}
}