Last active
January 20, 2021 07:51
-
-
Save sarahabimay/c2283816d609c545e29a2443f279fddc to your computer and use it in GitHub Desktop.
This file contains 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 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