Merge pull request #2619 from Nomon/master
provider/docker: Fix Repository in PullOptions
This commit is contained in:
commit
5d9a5725b9
|
@ -83,7 +83,7 @@ func pullImage(data *Data, client *dc.Client, image string) error {
|
|||
splitPortRepo := strings.Split(splitImageName[1], "/")
|
||||
pullOpts.Registry = splitImageName[0] + ":" + splitPortRepo[0]
|
||||
pullOpts.Tag = splitImageName[2]
|
||||
pullOpts.Repository = strings.Join(splitPortRepo[1:], "/")
|
||||
pullOpts.Repository = pullOpts.Registry + "/" + strings.Join(splitPortRepo[1:], "/")
|
||||
|
||||
// It's either registry:port/username/repo, registry:port/repo,
|
||||
// or repo:tag with default registry
|
||||
|
@ -98,7 +98,7 @@ func pullImage(data *Data, client *dc.Client, image string) error {
|
|||
// registry:port/username/repo or registry:port/repo
|
||||
default:
|
||||
pullOpts.Registry = splitImageName[0] + ":" + splitPortRepo[0]
|
||||
pullOpts.Repository = strings.Join(splitPortRepo[1:], "/")
|
||||
pullOpts.Repository = pullOpts.Registry + "/" + strings.Join(splitPortRepo[1:], "/")
|
||||
pullOpts.Tag = "latest"
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package docker
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestAccDockerImage_basic(t *testing.T) {
|
||||
|
@ -24,9 +23,34 @@ func TestAccDockerImage_basic(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestAddDockerImage_private(t *testing.T) {
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
Steps: []resource.TestStep{
|
||||
resource.TestStep{
|
||||
Config: testAddDockerPrivateImageConfig,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
resource.TestCheckResourceAttr(
|
||||
"docker_image.foobar",
|
||||
"latest",
|
||||
"2c40b0526b6358710fd09e7b8c022429268cc61703b4777e528ac9d469a07ca1"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const testAccDockerImageConfig = `
|
||||
resource "docker_image" "foo" {
|
||||
name = "ubuntu:trusty-20150320"
|
||||
keep_updated = true
|
||||
}
|
||||
`
|
||||
|
||||
const testAddDockerPrivateImageConfig = `
|
||||
resource "docker_image" "foobar" {
|
||||
name = "gcr.io:443/google_containers/pause:0.8.0"
|
||||
keep_updated = true
|
||||
}
|
||||
`
|
||||
|
|
Loading…
Reference in New Issue