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

Side by Side Diff: juju/open.go

Issue 5432056: Skeleton framework for ec2 provider.
Patch Set: - Created 12 years, 4 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:
View unified diff | Download patch
« no previous file with comments | « juju/jujutest/test.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package juju 1 package juju
2 2
3 import "fmt" 3 import "fmt"
4 4
5 // New creates a new Environ using the 5 // New creates a new Environ using the
6 // environment configuration with the given name. 6 // environment configuration with the given name.
7 // If name is empty, the default environment will be used. 7 // If name is empty, the default environment will be used.
8 func (envs *Environs) Open(name string) (Environ, error) { 8 func (envs *Environs) Open(name string) (Environ, error) {
9 if name == "" { 9 if name == "" {
10 name = envs.Default 10 name = envs.Default
11 if name == "" { 11 if name == "" {
12 return nil, fmt.Errorf("no default environment found") 12 return nil, fmt.Errorf("no default environment found")
13 } 13 }
14 } 14 }
15 e, ok := envs.environs[name] 15 e, ok := envs.environs[name]
16 if !ok { 16 if !ok {
17 return nil, fmt.Errorf("unknown environment %q", name) 17 return nil, fmt.Errorf("unknown environment %q", name)
18 } 18 }
19 if e.err != nil { 19 if e.err != nil {
20 return nil, e.err 20 return nil, e.err
21 } 21 }
22 env, err := providers[e.kind].Open(name, e.config) 22 env, err := providers[e.kind].Open(name, e.config)
23 if err != nil { 23 if err != nil {
24 return nil, fmt.Errorf("cannot initialize environment %q: %v", n ame, err) 24 return nil, fmt.Errorf("cannot initialize environment %q: %v", n ame, err)
25 } 25 }
26 26
27 return env, nil 27 return env, nil
28 } 28 }
OLDNEW
« no previous file with comments | « juju/jujutest/test.go ('k') | no next file » | no next file with comments »

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