autostacker24 1.0.58 → 1.0.59

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 72ed7bed03a37715c22a125d72d1e487e65cb6d9
4
- data.tar.gz: d47a4631f4686097ec39bf4e0c637729e713d401
3
+ metadata.gz: fef9bfd12c06f7fc2243f9c69c18940fce0ea53b
4
+ data.tar.gz: 4657a28a0e48b0ca306a09e0c66104c713f5650c
5
5
  SHA512:
6
- metadata.gz: 485b4cfe5ae6c4795279f45f81bb63a044c3a38832458728f7f7c2af2741bcc2462130fc11337e7ab79c687b9b3bb276f584d8f933bb5ce72b9654ac51cc1a20
7
- data.tar.gz: ba631ef91ddd8dd8db70879686c9a46dbb423352ead6628f3a8e873e34f266d6cf7429ed964db560b426a54cf79b49ce22d3f888a4e3ab4464719a060050a592
6
+ metadata.gz: 5efa1234f70673fada1e010cda85cc570828f8b6a66afe3e0b62f8d7db1d55d46555f35f8edef29e52ffe9ce709740b838f6012024e9f37987a83e4613146fc2
7
+ data.tar.gz: fe384b24f6c7e585acda35520e08cae612c580b73ad14a63a958ba9554855f9a5b12f79646d4be62b82c3855a635060250482c4b7327cd8a7385f7160c10fe72
@@ -8,14 +8,22 @@ module AutoStacker24
8
8
 
9
9
  def self.preprocess(template, tags = nil)
10
10
  if template =~ /^\s*\/{2}\s*/i
11
- template = template.gsub(/(\s*\/\/.*$)|(".*")/) {|m| m[0] == '"' ? m : ''} # replace comments
12
- template = preprocess_json(JSON(template))
13
- template = preprocess_tags(template, tags).to_json
11
+ processed = preprocess_json(parse_json(template))
12
+ template = preprocess_tags(processed, tags).to_json
14
13
  end
15
14
  template
16
15
  end
17
16
 
18
17
  SUPPORTED_TYPES = Set[%w(AWS::AutoScaling::AutoScalingGroup AWS::CloudTrail::Trail AWS::EC2::CustomerGateway AWS::EC2::DHCPOptions AWS::EC2::Instance AWS::EC2::InternetGateway AWS::EC2::NetworkAcl AWS::EC2::NetworkInterface AWS::EC2::RouteTable AWS::EC2::SecurityGroup AWS::EC2::Subnet AWS::EC2::Volume AWS::EC2::VPC AWS::EC2::VPCPeeringConnection AWS::EC2::VPNConnection AWS::EC2::VPNGateway AWS::ElasticBeanstalk::Environment AWS::ElasticLoadBalancing::LoadBalancer AWS::RDS::DBCluster AWS::RDS::DBClusterParameterGroup AWS::RDS::DBInstance AWS::RDS::DBParameterGroup AWS::RDS::DBSecurityGroup AWS::RDS::DBSubnetGroup AWS::RDS::OptionGroup AWS::S3::Bucket)]
18
+
19
+ def self.parse_json(template)
20
+ template = template.gsub(/(\s*\/\/.*$)|(".*")/) {|m| m[0] == '"' ? m : ''} # replace comments
21
+ JSON(template)
22
+ rescue JSON::ParserError => e
23
+ require 'json/pure' # pure ruby parser has better error diagnostics
24
+ JSON(template)
25
+ raise e
26
+ end
19
27
 
20
28
  def self.preprocess_tags(template, tags = nil)
21
29
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autostacker24
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.58
4
+ version: 1.0.59
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Mueller