autostacker24 1.0.58 → 1.0.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/autostacker24/template_preprocessor.rb +11 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fef9bfd12c06f7fc2243f9c69c18940fce0ea53b
|
4
|
+
data.tar.gz: 4657a28a0e48b0ca306a09e0c66104c713f5650c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
12
|
-
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
|
|