Skip to content

Instantly share code, notes, and snippets.

@abutcher
Last active March 25, 2020 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save abutcher/ad9271655e4fe63a2740 to your computer and use it in GitHub Desktop.
Save abutcher/ad9271655e4fe63a2740 to your computer and use it in GitHub Desktop.
Regenerate ose dns entries
#!/usr/bin/env oo-ruby
require "/var/www/openshift/broker/config/environment"
Rails.configuration.analytics[:enabled] = false
Mongoid.raise_not_found_error = false
class Regenerate
def self.run
entries = []
Application.all.each do |app|
app.group_instances.each do |group_instance|
group_instance.gears.each do |gear|
if app.scalable and not gear.app_dns
entries |= ["#{gear.uuid}-#{app.domain_namespace}\tCNAME\t#{gear.server_identity}"]
else
entries |= ["#{app.name}-#{app.domain_namespace}\tCNAME\t#{gear.server_identity}"]
end
end
end
end
entries.each do |entry|
puts entry
end
end
end
if __FILE__ == $0
Regenerate.run
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment