Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(77)

Delta Between Two Patch Sets: environs/dummy/environs.go

Issue 6612054: environs/cloudinit: use --initial-password
Left Patch Set: Created 12 years, 6 months ago
Right Patch Set: environs/cloudinit: use --initial-password Created 12 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « environs/cloudinit/cloudinit_test.go ('k') | environs/ec2/ec2.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // The dummy provider implements an environment provider for testing 1 // The dummy provider implements an environment provider for testing
2 // purposes, registered with environs under the name "dummy". 2 // purposes, registered with environs under the name "dummy".
3 //· 3 //·
4 // The configuration YAML for the testing environment 4 // The configuration YAML for the testing environment
5 // must specify a "state-server" property with a boolean 5 // must specify a "state-server" property with a boolean
6 // value. If this is true, a state server will be started 6 // value. If this is true, a state server will be started
7 // the first time StateInfo is called on a newly reset environment. 7 // the first time StateInfo is called on a newly reset environment.
8 //· 8 //·
9 // The configuration data also accepts a "broken" property 9 // The configuration data also accepts a "broken" property
10 // of type boolean. If this is non-empty, any operation 10 // of type boolean. If this is non-empty, any operation
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 } 461 }
462 462
463 func (e *environ) StartInstance(machineId int, info *state.Info, tools *state.To ols) (environs.Instance, error) { 463 func (e *environ) StartInstance(machineId int, info *state.Info, tools *state.To ols) (environs.Instance, error) {
464 defer delay() 464 defer delay()
465 log.Printf("dummy startinstance, machine %d", machineId) 465 log.Printf("dummy startinstance, machine %d", machineId)
466 if err := e.checkBroken("StartInstance"); err != nil { 466 if err := e.checkBroken("StartInstance"); err != nil {
467 return nil, err 467 return nil, err
468 } 468 }
469 e.state.mu.Lock() 469 e.state.mu.Lock()
470 defer e.state.mu.Unlock() 470 defer e.state.mu.Unlock()
471 if info.EntityName != fmt.Sprintf("machine-%d", machineId) {
472 return nil, fmt.Errorf("entity name must match started machine")
473 }
471 if tools != nil && (strings.HasPrefix(tools.Series, "unknown") || string s.HasPrefix(tools.Arch, "unknown")) { 474 if tools != nil && (strings.HasPrefix(tools.Series, "unknown") || string s.HasPrefix(tools.Arch, "unknown")) {
472 return nil, fmt.Errorf("cannot find image for %s-%s", tools.Seri es, tools.Arch) 475 return nil, fmt.Errorf("cannot find image for %s-%s", tools.Seri es, tools.Arch)
473 } 476 }
474 i := &instance{ 477 i := &instance{
475 state: e.state, 478 state: e.state,
476 id: fmt.Sprintf("%s-%d", e.state.name, e.state.maxId), 479 id: fmt.Sprintf("%s-%d", e.state.name, e.state.maxId),
477 ports: make(map[state.Port]bool), 480 ports: make(map[state.Port]bool),
478 machineId: machineId, 481 machineId: machineId,
479 } 482 }
480 e.state.insts[i.id] = i 483 e.state.insts[i.id] = i
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 // time.Durations into this value. 630 // time.Durations into this value.
628 var providerDelay time.Duration 631 var providerDelay time.Duration
629 632
630 // pause execution to simulate the latency of a real provider 633 // pause execution to simulate the latency of a real provider
631 func delay() { 634 func delay() {
632 if providerDelay > 0 { 635 if providerDelay > 0 {
633 log.Printf("dummy: pausing for %v", providerDelay) 636 log.Printf("dummy: pausing for %v", providerDelay)
634 <-time.After(providerDelay) 637 <-time.After(providerDelay)
635 } 638 }
636 } 639 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b