Skip to content

Instantly share code, notes, and snippets.

@sarahabimay
Last active January 20, 2021 07:51
Show Gist options
  • Save sarahabimay/c2283816d609c545e29a2443f279fddc to your computer and use it in GitHub Desktop.
Save sarahabimay/c2283816d609c545e29a2443f279fddc to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'yaml'
NAMESPACES_DIR = 'namespaces/live-1.cloud-platform.service.justice.gov.uk'
Dir["#{NAMESPACES_DIR}/**"].each do |dir|
namespace_dir = Dir["#{dir}/00-namespace.yaml"][0]
if !namespace_dir.nil?
yaml_contents = File.read(namespace_dir)
# haven't checked for yaml_contents availability
parsed_yaml = YAML.safe_load(yaml_contents)
if parsed_yaml && parsed_yaml['metadata']['labels']['cloud-platform.justice.gov.uk/is-production'] == 'true'
puts "Namespace: #{parsed_yaml['metadata']['name']}"
end
end
# Throw here for the else case..
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment