Skip to content

Commit

Permalink
Merge branch 'akshaymankar-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
drich10 committed Aug 24, 2018
2 parents 7efeb2b + a2a4c6e commit 503bac5
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 20 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ resource_types:
the BOSH director will be dialed directly.
* `jumpbox_ssh_key`: *Optional.* The private key of the jumpbox. If set, `jumpbox_url` must also be set.
* `jumpbox_username`: *Optional.* The username for the jumpbox. If not set, will default to `jumpbox`.
* `skip_check`: *Optional* Setting this will avoid failing checks when using this resource in dynamic configuration. If not set, will default to `false`.
* `vars_store`: *Optional.* Configuration for a persisted variables store. Currently only the Google Cloud Storage (GCS)
provider is supported. `json_key` must be the the JSON key for your service account. Example:

Expand Down
47 changes: 27 additions & 20 deletions cmd/check/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,35 @@ func main() {
os.Exit(1)
}

hostKeyGetter := proxy.NewHostKey()
socks5Proxy := proxy.NewSocks5Proxy(hostKeyGetter, log.New(ioutil.Discard, "", log.LstdFlags))
cliCoordinator := bosh.NewCLICoordinator(checkRequest.Source, os.Stderr, socks5Proxy)
commandRunner := bosh.NewCommandRunner(cliCoordinator)
cliDirector, err := cliCoordinator.Director()
if err != nil {
fmt.Fprint(os.Stderr, err)
os.Exit(1)
}
var checkResponse []concourse.Version

director := bosh.NewBoshDirector(
checkRequest.Source,
commandRunner,
cliDirector,
os.Stderr,
)
if checkRequest.Source.SkipCheck {
checkResponse = []concourse.Version{}
} else {

checkCommand := check.NewCheckCommand(director)
checkResponse, err := checkCommand.Run(checkRequest)
if err != nil {
fmt.Fprint(os.Stderr, err)
os.Exit(1)
hostKeyGetter := proxy.NewHostKey()
socks5Proxy := proxy.NewSocks5Proxy(hostKeyGetter, log.New(ioutil.Discard, "", log.LstdFlags))
cliCoordinator := bosh.NewCLICoordinator(checkRequest.Source, os.Stderr, socks5Proxy)
commandRunner := bosh.NewCommandRunner(cliCoordinator)
cliDirector, err := cliCoordinator.Director()
if err != nil {
fmt.Fprint(os.Stderr, err)
os.Exit(1)
}

director := bosh.NewBoshDirector(
checkRequest.Source,
commandRunner,
cliDirector,
os.Stderr,
)

checkCommand := check.NewCheckCommand(director)
checkResponse, err = checkCommand.Run(checkRequest)
if err != nil {
fmt.Fprint(os.Stderr, err)
os.Exit(1)
}
}

concourseOutputFormatted, err := json.MarshalIndent(checkResponse, "", " ")
Expand Down
1 change: 1 addition & 0 deletions concourse/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Source struct {
JumpboxURL string `json:"jumpbox_url,omitempty" yaml:"jumpbox_url"`
JumpboxUsername string `json:"jumpbox_username,omitempty" yaml:"jumpbox_username"`
VarsStore VarsStore `json:"vars_store,omitempty" yaml:"vars_store"`
SkipCheck bool `json:"skip_check,omitempty" yaml:"skip_check"`
}

type sourceRequest struct {
Expand Down

0 comments on commit 503bac5

Please sign in to comment.