Skip creating swift container if already exists
Signed-off-by: Jack Griffin <jackpg14@gmail.com>
This commit is contained in:
parent
0306c5c453
commit
8ceca304b0
1 changed files with 6 additions and 2 deletions
|
@ -165,9 +165,13 @@ func New(params Parameters) (*Driver, error) {
|
||||||
return nil, fmt.Errorf("Swift authentication failed: %s", err)
|
return nil, fmt.Errorf("Swift authentication failed: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, _, err := ct.Container(params.Container); err == swift.ContainerNotFound {
|
||||||
if err := ct.ContainerCreate(params.Container, nil); err != nil {
|
if err := ct.ContainerCreate(params.Container, nil); err != nil {
|
||||||
return nil, fmt.Errorf("Failed to create container %s (%s)", params.Container, err)
|
return nil, fmt.Errorf("Failed to create container %s (%s)", params.Container, err)
|
||||||
}
|
}
|
||||||
|
} else if err != nil {
|
||||||
|
return nil, fmt.Errorf("Failed to retrieve info about container %s (%s)", params.Container, err)
|
||||||
|
}
|
||||||
|
|
||||||
d := &driver{
|
d := &driver{
|
||||||
Conn: ct,
|
Conn: ct,
|
||||||
|
|
Loading…
Reference in a new issue