pivotal-cf / toolsmiths-shared-scripts

Apache License 2.0
20 stars 21 forks source link

Fix director credentials extraction #15

Closed kirederik closed 7 years ago

kirederik commented 7 years ago

We are getting this error with OpsManager 1.7.15:

D, [2016-10-18T02:56:58.768499 #5] DEBUG -- : Targetting:BOSHDirector:/tmp/build/ac19200b/aws-frugal-repo/deploy_pcf/aws/aws-frugal/scripts/get_bosh_director_ip.sh pcf.env.london.cf-app.com redacted redacted
/tmp/build/ac19200b/aws-frugal-repo/deploy_pcf/aws/aws-frugal/scripts/go_to_sleep.rb:139:in `target_bosh_director': BOSHDirector:BadDataFile:10.0.16.5 (RuntimeError)
{
  "name": "redacted",
  "password": "redacted",
  "groups": [
    "bosh.admin"
  ]
}
    from /tmp/build/ac19200b/aws-frugal-repo/deploy_pcf/aws/aws-frugal/scripts/go_to_sleep.rb:199:in `go_to_sleep'
    from ./git-tile-pipeline/scripts/control-envs/run.rb:31:in `<main>'

After investigation, we found out that the latest versions of OpsManager (both 1.7 and 1.8) expose the director credentials as a JSON object.

This PR makes the script consider both the inline string credentials and the JSON object.

Thanks!

cf-gitbot commented 7 years ago

We have created an issue in Pivotal Tracker to manage this. Unfortunately, the Pivotal Tracker project is private so you may be unable to view the contents of the story.

The labels on this github issue will be updated when the story is started.

derwei commented 7 years ago

Awesome! thanks so much for the PR!