~dstroppa/juju-core/joyent-provider-storage

« back to all changes in this revision

Viewing changes to provider/dummy/environs.go

  • Committer: Daniele Stroppa
  • Date: 2014-01-08 15:58:10 UTC
  • mfrom: (1953.1.231 juju-core)
  • Revision ID: daniele.stroppa@joyent.com-20140108155810-xecbwrqkb5i0fyoe
Merging trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
                "development":               false,
75
75
                "state-port":                1234,
76
76
                "api-port":                  4321,
 
77
                "syslog-port":               2345,
77
78
                "default-series":            "precise",
78
79
 
79
80
                "secret":       "pork",
84
85
// stateInfo returns a *state.Info which allows clients to connect to the
85
86
// shared dummy state, if it exists.
86
87
func stateInfo() *state.Info {
87
 
        if testing.MgoAddr == "" {
 
88
        if testing.MgoServer.Addr() == "" {
88
89
                panic("dummy environ state tests must be run with MgoTestPackage")
89
90
        }
90
91
        return &state.Info{
91
 
                Addrs:  []string{testing.MgoAddr},
 
92
                Addrs:  []string{testing.MgoServer.Addr()},
92
93
                CACert: []byte(testing.CACert),
93
94
        }
94
95
}
101
102
}
102
103
 
103
104
type OpBootstrap struct {
 
105
        Context     environs.BootstrapContext
104
106
        Env         string
105
107
        Constraints constraints.Value
106
108
}
221
223
                s.destroy()
222
224
        }
223
225
        providerInstance.state = make(map[int]*environState)
224
 
        if testing.MgoAddr != "" {
225
 
                testing.MgoReset()
 
226
        if testing.MgoServer.Addr() != "" {
 
227
                testing.MgoServer.Reset()
226
228
        }
227
229
}
228
230
 
241
243
                }
242
244
                state.apiState = nil
243
245
        }
244
 
        if testing.MgoAddr != "" {
245
 
                testing.MgoReset()
 
246
        if testing.MgoServer.Addr() != "" {
 
247
                testing.MgoServer.Reset()
246
248
        }
247
249
        state.bootstrapped = false
248
250
}
521
523
                storage.NewStorageSimpleStreamsDataSource(e.Storage(), storage.BaseToolsPath)}, nil
522
524
}
523
525
 
524
 
func (e *environ) Bootstrap(cons constraints.Value) error {
 
526
func (e *environ) Bootstrap(ctx environs.BootstrapContext, cons constraints.Value) error {
525
527
        selectedTools, err := common.EnsureBootstrapTools(e, e.Config().DefaultSeries(), cons.Arch)
526
528
        if err != nil {
527
529
                return err
591
593
                estate.apiState = st
592
594
        }
593
595
        estate.bootstrapped = true
594
 
        estate.ops <- OpBootstrap{Env: e.name, Constraints: cons}
 
596
        estate.ops <- OpBootstrap{Context: ctx, Env: e.name, Constraints: cons}
595
597
        return nil
596
598
}
597
599
 
785
787
                if inst == nil {
786
788
                        err = environs.ErrPartialInstances
787
789
                        notFound++
 
790
                        insts = append(insts, nil)
 
791
                } else {
 
792
                        insts = append(insts, inst)
788
793
                }
789
 
                insts = append(insts, inst)
790
794
        }
791
795
        if notFound == len(ids) {
792
796
                return nil, environs.ErrNoInstances
899
903
        return string(inst.id) + ".dns", nil
900
904
}
901
905
 
 
906
func (*dummyInstance) Refresh() error {
 
907
        return nil
 
908
}
 
909
 
902
910
func (inst *dummyInstance) Addresses() ([]instance.Address, error) {
903
911
        inst.mu.Lock()
904
912
        defer inst.mu.Unlock()