Skip to content

Instantly share code, notes, and snippets.

@henryaj
Last active November 1, 2016 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save henryaj/51b55001970840b79ecea60ace2ba5fd to your computer and use it in GitHub Desktop.
Save henryaj/51b55001970840b79ecea60ace2ba5fd to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require "yaml"
raw_bosh_config = File.read(File.expand_path("~/.bosh_config"))
config = YAML.load(raw_bosh_config)
targets = config.fetch("aliases").fetch("target")
puts YAML.dump(targets)
#!/usr/bin/ruby
require "yaml"
raw_new_targets = ARGV[0]
new_targets = YAML.load(raw_new_targets)
raw_bosh_config = File.read(File.expand_path("~/.bosh_config"))
config = YAML.load(raw_bosh_config)
config.fetch("aliases").fetch("target").merge!(new_targets)
# strip out targets with dupe urls?
# ...
File.open(File.expand_path("~/.bosh_config"), 'w') do |file|
file.write(YAML.dump(config))
end

A pain no more!

  1. Run bosh-get-targets to dump your saved BOSH targets as YAML.
  2. Run bosh-save-targets <TARGETS> (where <TARGETS> is the output of step 1) to merge the targets into your existing targets.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment