A pain no more!
- Run
bosh-get-targetsto dump your saved BOSH targets as YAML. - Run
bosh-save-targets <TARGETS>(where<TARGETS>is the output of step 1) to merge the targets into your existing targets.
| #!/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!
bosh-get-targets to dump your saved BOSH targets as YAML.bosh-save-targets <TARGETS> (where <TARGETS> is the output of step 1) to merge the targets into your existing targets.