~rogpeppe/juju-core/438-local-instance-Addresses

« back to all changes in this revision

Viewing changes to provider/dummy/environs.go

[r=rogpeppe] worker/addressupdater: wire up

It could do with some more comprehensive
testing, but it might be OK to land anyway.

https://codereview.appspot.com/14306043/

Show diffs side-by-side

added added

removed removed

Lines of Context:
860
860
        machineId    string
861
861
        series       string
862
862
        firewallMode string
 
863
 
 
864
        mu        sync.Mutex
 
865
        addresses []instance.Address
863
866
}
864
867
 
865
868
func (inst *dummyInstance) Id() instance.Id {
870
873
        return ""
871
874
}
872
875
 
 
876
// SetInstanceAddresses sets the addresses associated with the given
 
877
// dummy instance.
 
878
func SetInstanceAddresses(inst instance.Instance, addrs []instance.Address) {
 
879
        inst0 := inst.(*dummyInstance)
 
880
        inst0.mu.Lock()
 
881
        inst0.addresses = append(inst0.addresses[:0], addrs...)
 
882
        inst0.mu.Unlock()
 
883
}
 
884
 
873
885
func (inst *dummyInstance) DNSName() (string, error) {
874
886
        defer delay()
875
887
        return string(inst.id) + ".dns", nil
876
888
}
877
889
 
878
890
func (inst *dummyInstance) Addresses() ([]instance.Address, error) {
879
 
        log.Errorf("environs/dummy: Addresses not implemented")
880
 
        return nil, nil
 
891
        inst.mu.Lock()
 
892
        defer inst.mu.Unlock()
 
893
        return append([]instance.Address{}, inst.addresses...), nil
881
894
}
882
895
 
883
896
func (inst *dummyInstance) WaitDNSName() (string, error) {