Class: Ufo::TaskDefinition::Erb::Json
- Defined in:
- lib/ufo/task_definition/erb/json.rb
Instance Attribute Summary
Attributes inherited from CLI::Base
Instance Method Summary collapse
Methods inherited from Base
Methods inherited from CLI::Base
Methods included from Utils::Sure
Methods included from Utils::Pretty
#pretty_home, #pretty_path, #pretty_time
Methods included from Utils::Logging
Methods included from Concerns
Methods included from Concerns::Names
Methods included from AwsServices
#acm, #applicationautoscaling, #aws_options, #cfn, #cloudwatchlogs, #ec2, #ecr, #ecs, #elb, #s3, #ssm_client, #waf_client
Methods included from AwsServices::Concerns
#find_stack, #find_stack_resources, #stack_resources, #status, #task_definition_arns
Constructor Details
This class inherits a constructor from Ufo::TaskDefinition::Erb::Base
Instance Method Details
#data ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ufo/task_definition/erb/json.rb', line 3 def data text = IO.read(@path) JSON.load(text) rescue JSON::ParserError => e # NOTE: JSON::ParserError e.message is not very useful logger.error "ERROR: #{e.class}".color(:red) logger.error <<~EOL Rendered file contains invalid JSON. For debugging, files available at: source: #{@task_definition.path} rendered: #{@path} EOL logger.error "Contents of the rendered file:\n\n" print_code(text) if jq_available? system "cat #{@path} | jq" end exit 1 end |
#jq_available? ⇒ Boolean
24 25 26 |
# File 'lib/ufo/task_definition/erb/json.rb', line 24 def jq_available? system("type jq > /dev/null 2>&1") end |