func (s *SSHCommonSuite) setAddresses(m *state.Machine, c *gc.C) { addrPub := network.NewScopedAddress( fmt.Sprintf("admin-%s.dns", m.Id()), network.ScopePublic, ) addrPriv := network.NewScopedAddress( fmt.Sprintf("admin-%s.internal", m.Id()), network.ScopeCloudLocal, ) err := m.SetProviderAddresses(addrPub, addrPriv) c.Assert(err, jc.ErrorIsNil) }
func (s *commonMachineSuite) setFakeMachineAddresses(c *gc.C, machine *state.Machine) { addrs := network.NewAddresses("0.1.2.3") err := machine.SetProviderAddresses(addrs...) c.Assert(err, jc.ErrorIsNil) // Set the addresses in the environ instance as well so that if the instance poller // runs it won't overwrite them. instId, err := machine.InstanceId() c.Assert(err, jc.ErrorIsNil) insts, err := s.Environ.Instances([]instance.Id{instId}) c.Assert(err, jc.ErrorIsNil) dummy.SetInstanceAddresses(insts[0], addrs) }
func (s *SSHCommonSuite) setAddresses(c *gc.C, m *state.Machine) { addrPub := network.NewScopedAddress( fmt.Sprintf("%s.public", m.Id()), network.ScopePublic, ) addrPriv := network.NewScopedAddress( fmt.Sprintf("%s.private", m.Id()), network.ScopeCloudLocal, ) err := m.SetProviderAddresses(addrPub, addrPriv) c.Assert(err, jc.ErrorIsNil) }
// updateMachineAddresses will update the machine doc to the current addresses func updateMachineAddresses(machine *state.Machine, privateAddress, publicAddress string) error { privateAddressAddress := network.Address{ Value: privateAddress, Type: network.DeriveAddressType(privateAddress), } publicAddressAddress := network.Address{ Value: publicAddress, Type: network.DeriveAddressType(publicAddress), } if err := machine.SetProviderAddresses(publicAddressAddress, privateAddressAddress); err != nil { return errors.Trace(err) } return nil }
func (s *SSHCommonSuite) setAddresses6(c *gc.C, m *state.Machine) { addrPub := network.NewScopedAddress("2001:db8::1", network.ScopePublic) addrPriv := network.NewScopedAddress("fc00:bbb::1", network.ScopeCloudLocal) err := m.SetProviderAddresses(addrPub, addrPriv) c.Assert(err, jc.ErrorIsNil) }