Skip to content
This repository was archived by the owner on Jul 28, 2020. It is now read-only.

Commit 1f74516

Browse files
Anthony Emengopivotal
authored andcommitted
Syntax changes to provision/director.go
1 parent 891f40e commit 1f74516

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

provision/director.go

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,20 @@ const (
2020

2121
func (c *Controller) DeployBosh() error {
2222
var (
23-
// For now we determine if we have a BOSH Director with credhub deployed
24-
// by looking to see if a creds.yml is present or not
25-
// This is definitely not the most expressive solution
26-
// and should be improved..
27-
credsPath = filepath.Join(c.Config.StateBosh, "creds.yml")
28-
directorPath = filepath.Join(c.Config.StateBosh, "director.yml")
29-
cloudConfigPath = filepath.Join(c.Config.StateBosh, "cloud-config.yml")
30-
dnsConfigPath = filepath.Join(c.Config.StateBosh, "dns.yml")
31-
stateJSONPath = filepath.Join(c.Config.StateBosh, "state.json")
32-
boshRunner = runner.NewBosh(c.Config)
33-
crehubIsDeployed = doesNotExist(credsPath)
23+
credsPath = filepath.Join(c.Config.StateBosh, "creds.yml")
24+
directorPath = filepath.Join(c.Config.StateBosh, "director.yml")
25+
cloudConfigPath = filepath.Join(c.Config.StateBosh, "cloud-config.yml")
26+
dnsConfigPath = filepath.Join(c.Config.StateBosh, "dns.yml")
27+
stateJSONPath = filepath.Join(c.Config.StateBosh, "state.json")
28+
boshRunner = runner.NewBosh(c.Config)
29+
credhubIsDeployed = func() bool {
30+
// For now we determine if we have a BOSH Director with credhub deployed
31+
// by looking to see if a creds.yml is present or not
32+
// This is definitely not the most expressive solution
33+
// and should be improved..
34+
_, err := os.Stat(credsPath)
35+
return os.IsNotExist(err)
36+
}
3437
)
3538

3639
ip, err := driver.IP(c.Config)
@@ -72,7 +75,7 @@ func (c *Controller) DeployBosh() error {
7275

7376
command := "/usr/local/bin/bosh --tty create-env /bosh/director.yml --state /bosh/state.json"
7477

75-
if !crehubIsDeployed {
78+
if !credhubIsDeployed() {
7679
s.SendFile(credsPath, "/bosh/creds.yml")
7780

7881
command = command + " --vars-store /bosh/creds.yml"
@@ -123,8 +126,3 @@ func (c *Controller) DeployBosh() error {
123126

124127
return nil
125128
}
126-
127-
func doesNotExist(path string) bool {
128-
_, err := os.Stat(path)
129-
return os.IsNotExist(err)
130-
}

0 commit comments

Comments
 (0)