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

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

Issue 7299066: state/api: enable password checking
Left Patch Set: state/api: enable password checking Created 12 years, 2 months ago
Right Patch Set: state/api: enable password checking Created 12 years, 1 month 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « cmd/jujud/bootstrap.go ('k') | environs/jujutest/livetests.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
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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 if err != nil { 453 if err != nil {
454 return fmt.Errorf("cannot make bootstrap config: %v", er r) 454 return fmt.Errorf("cannot make bootstrap config: %v", er r)
455 } 455 }
456 st, err := state.Initialize(info, cfg) 456 st, err := state.Initialize(info, cfg)
457 if err != nil { 457 if err != nil {
458 panic(err) 458 panic(err)
459 } 459 }
460 if err := st.SetAdminMongoPassword(trivial.PasswordHash(password )); err != nil { 460 if err := st.SetAdminMongoPassword(trivial.PasswordHash(password )); err != nil {
461 panic(err) 461 panic(err)
462 } 462 }
463 » » // TODO(rog) use hash of password when we can change passwords 463 » » // TODO(rog) use hash of password when the juju API connection
464 » » // in the API 464 » » // logic is done.
465 _, err = st.AddUser("admin", password) 465 _, err = st.AddUser("admin", password)
466 if err != nil { 466 if err != nil {
467 panic(err) 467 panic(err)
468 } 468 }
469 e.state.apiServer, err = api.NewServer(st, "localhost:0", []byte (testing.ServerCert), []byte(testing.ServerKey)) 469 e.state.apiServer, err = api.NewServer(st, "localhost:0", []byte (testing.ServerCert), []byte(testing.ServerKey))
470 if err != nil { 470 if err != nil {
471 panic(err) 471 panic(err)
472 } 472 }
473 e.state.apiState = st 473 e.state.apiState = st
474 } 474 }
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 // time.Durations into this value. 758 // time.Durations into this value.
759 var providerDelay time.Duration 759 var providerDelay time.Duration
760 760
761 // pause execution to simulate the latency of a real provider 761 // pause execution to simulate the latency of a real provider
762 func delay() { 762 func delay() {
763 if providerDelay > 0 { 763 if providerDelay > 0 {
764 log.Printf("environs/dummy: pausing for %v", providerDelay) 764 log.Printf("environs/dummy: pausing for %v", providerDelay)
765 <-time.After(providerDelay) 765 <-time.After(providerDelay)
766 } 766 }
767 } 767 }
LEFTRIGHT

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