Last active
March 25, 2020 13:48
-
-
Save abutcher/ad9271655e4fe63a2740 to your computer and use it in GitHub Desktop.
Regenerate ose dns entries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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