Skip to content

Commit

Permalink
Revert "WIP - bosh create-env implemented for gcp"
Browse files Browse the repository at this point in the history
This reverts commit 4c8ab23.
  • Loading branch information
evanfarrar committed Feb 2, 2017
1 parent 6967e02 commit 0695cfc
Show file tree
Hide file tree
Showing 21 changed files with 127 additions and 1,102 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,3 @@
[submodule "vendor/golang.org/x/net"]
path = vendor/golang.org/x/net
url = https://go.googlesource.com/net
[submodule "vendor/github.com/cloudfoundry/bosh-deployment"]
path = vendor/github.com/cloudfoundry/bosh-deployment
url = https://github.com/cloudfoundry/bosh-deployment.git
73 changes: 0 additions & 73 deletions bbl/fakebosh/main.go

This file was deleted.

16 changes: 1 addition & 15 deletions bbl/gcp_load_balancers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ var _ = Describe("load balancers", func() {
serviceAccountKeyPath string
pathToFakeTerraform string
pathToTerraform string
pathToFakeBOSH string
pathToBOSH string
fakeBOSHCLIBackendServer *httptest.Server
fakeTerraformBackendServer *httptest.Server
fakeBOSHServer *httptest.Server
fakeBOSH *fakeBOSHDirector
Expand All @@ -57,9 +54,6 @@ var _ = Describe("load balancers", func() {
fakeBOSH.ServeHTTP(responseWriter, request)
}))

fakeBOSHCLIBackendServer = httptest.NewServer(http.HandlerFunc(func(responseWriter http.ResponseWriter, request *http.Request) {
}))

fakeTerraformBackendServer = httptest.NewServer(http.HandlerFunc(func(responseWriter http.ResponseWriter, request *http.Request) {

switch request.URL.Path {
Expand Down Expand Up @@ -110,15 +104,7 @@ var _ = Describe("load balancers", func() {
err = os.Rename(pathToFakeTerraform, pathToTerraform)
Expect(err).NotTo(HaveOccurred())

pathToFakeBOSH, err = gexec.Build("github.com/cloudfoundry/bosh-bootloader/bbl/fakebosh",
"--ldflags", fmt.Sprintf("-X main.backendURL=%s", fakeBOSHCLIBackendServer.URL))
Expect(err).NotTo(HaveOccurred())

pathToBOSH = filepath.Join(filepath.Dir(pathToFakeBOSH), "bosh")
err = os.Rename(pathToFakeBOSH, pathToBOSH)
Expect(err).NotTo(HaveOccurred())

os.Setenv("PATH", strings.Join([]string{filepath.Dir(pathToTerraform), filepath.Dir(pathToBOSH), os.Getenv("PATH")}, ":"))
os.Setenv("PATH", strings.Join([]string{filepath.Dir(pathToTerraform), os.Getenv("PATH")}, ":"))

tempDirectory, err = ioutil.TempDir("", "")
Expect(err).NotTo(HaveOccurred())
Expand Down
22 changes: 4 additions & 18 deletions bbl/gcp_up_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ var _ = Describe("bbl up gcp", func() {
serviceAccountKeyPath string
pathToFakeTerraform string
pathToTerraform string
pathToFakeBOSH string
pathToBOSH string
fakeBOSHCLIBackendServer *httptest.Server
fakeTerraformBackendServer *httptest.Server
fakeBOSHServer *httptest.Server
fakeBOSH *fakeBOSHDirector
Expand All @@ -40,9 +37,6 @@ var _ = Describe("bbl up gcp", func() {
fakeBOSH.ServeHTTP(responseWriter, request)
}))

fakeBOSHCLIBackendServer = httptest.NewServer(http.HandlerFunc(func(responseWriter http.ResponseWriter, request *http.Request) {
}))

fakeTerraformBackendServer = httptest.NewServer(http.HandlerFunc(func(responseWriter http.ResponseWriter, request *http.Request) {
switch request.URL.Path {
case "/output/external_ip":
Expand All @@ -68,15 +62,7 @@ var _ = Describe("bbl up gcp", func() {
err = os.Rename(pathToFakeTerraform, pathToTerraform)
Expect(err).NotTo(HaveOccurred())

pathToFakeBOSH, err = gexec.Build("github.com/cloudfoundry/bosh-bootloader/bbl/fakebosh",
"--ldflags", fmt.Sprintf("-X main.backendURL=%s", fakeBOSHCLIBackendServer.URL))
Expect(err).NotTo(HaveOccurred())

pathToBOSH = filepath.Join(filepath.Dir(pathToFakeBOSH), "bosh")
err = os.Rename(pathToFakeBOSH, pathToBOSH)
Expect(err).NotTo(HaveOccurred())

os.Setenv("PATH", strings.Join([]string{filepath.Dir(pathToTerraform), filepath.Dir(pathToBOSH), os.Getenv("PATH")}, ":"))
os.Setenv("PATH", strings.Join([]string{filepath.Dir(pathToTerraform), os.Getenv("PATH")}, ":"))

tempDirectory, err = ioutil.TempDir("", "")
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -243,10 +229,9 @@ var _ = Describe("bbl up gcp", func() {
Expect(session.Out.Contents()).To(ContainSubstring("terraform apply"))
})

It("invokes the bosh cli", func() {
It("invokes bosh-init", func() {
args := []string{
"--state-dir", tempDirectory,
"--debug",
"up",
"--iaas", "gcp",
"--gcp-service-account-key", serviceAccountKeyPath,
Expand All @@ -257,7 +242,8 @@ var _ = Describe("bbl up gcp", func() {

session := executeCommand(args, 0)

Expect(session.Out.Contents()).To(ContainSubstring("bosh create-env"))
Expect(session.Out.Contents()).To(ContainSubstring("bosh-init was called with [bosh-init deploy bosh.yml]"))
Expect(session.Out.Contents()).To(ContainSubstring("bosh-state.json: {}"))
})

DescribeTable("cloud config", func(fixtureLocation string) {
Expand Down
7 changes: 1 addition & 6 deletions bbl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ package main
import (
"crypto/rand"
"crypto/rsa"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"os/exec"

yaml "gopkg.in/yaml.v2"

"golang.org/x/crypto/ssh"

"github.com/cloudfoundry/bosh-bootloader/application"
Expand Down Expand Up @@ -166,8 +163,6 @@ func main() {
terraformOutputter := terraform.NewOutputter(terraformCmd)

// BOSH
boshCommand := bosh.NewCmd(os.Stdout, os.Stderr, configuration.Global.Debug)
boshDeployer := bosh.NewDeployer(boshCommand, ioutil.TempDir, ioutil.ReadFile, yaml.Unmarshal, json.Unmarshal)
boshClientProvider := bosh.NewClientProvider()
cloudConfigGenerator := bosh.NewCloudConfigGenerator()
cloudConfigurator := bosh.NewCloudConfigurator(logger, cloudConfigGenerator)
Expand Down Expand Up @@ -199,7 +194,7 @@ func main() {
gcpDeleteLBs := commands.NewGCPDeleteLBs(terraformOutputter, gcpCloudConfigGenerator, zones, logger,
boshClientProvider, stateStore, terraformExecutor)

gcpUp := commands.NewGCPUp(stateStore, gcpKeyPairUpdater, gcpClientProvider, terraformExecutor, boshDeployer, logger, boshClientProvider, gcpCloudConfigGenerator, terraformOutputter, zones)
gcpUp := commands.NewGCPUp(stateStore, gcpKeyPairUpdater, gcpClientProvider, terraformExecutor, boshinitExecutor, stringGenerator, logger, boshClientProvider, gcpCloudConfigGenerator, terraformOutputter, zones)
envGetter := commands.NewEnvGetter()

// Commands
Expand Down
Loading

0 comments on commit 0695cfc

Please sign in to comment.