cps-property-generator 0.2.10 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generator/generator.rb +1 -1
- data/lib/generator/service.rb +13 -0
- data/lib/helpers/helpers.rb +5 -5
- data/lib/linter/services_linter.rb +2 -2
- 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: a336b0ce14011377bc50c3c669993f436fd8e31d
|
4
|
+
data.tar.gz: e9d5899eae6a9b456e3d53c97d588c7757013503
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a38fe0b448efba004406062b8bdd8736fc44195d94351b07bf1b859e327dcad44b07d194ba778784eeb7f4eee6bc592f6082628abc926a48a5d41357b360868
|
7
|
+
data.tar.gz: 914944ab88f0e717a9e4231f40ce0eb8806f27de29f7b4d1c61e79eceb05ab5a87c8869e167135ac317052b71cfbe8fa4707b3867bd92c92c80887d55f975282
|
data/lib/generator/generator.rb
CHANGED
@@ -30,7 +30,7 @@ module PropertyGenerator
|
|
30
30
|
service_instance.service
|
31
31
|
service_instance.interpolate
|
32
32
|
|
33
|
-
out = PropertyGenerator.writer(service, service_instance.service, @configs, @output_path, service_instance.
|
33
|
+
out = PropertyGenerator.writer(service, service_instance.service, @configs, @output_path, service_instance.additional_options)
|
34
34
|
(output << out).flatten!
|
35
35
|
end
|
36
36
|
output
|
data/lib/generator/service.rb
CHANGED
@@ -11,6 +11,7 @@ module PropertyGenerator
|
|
11
11
|
@globals = globals
|
12
12
|
@environment_configs = config.environment_configs
|
13
13
|
@configmapname = service_data['configname'].nil? ? nil : service_data['configname']
|
14
|
+
set_additional_options
|
14
15
|
set_service
|
15
16
|
end
|
16
17
|
|
@@ -19,6 +20,18 @@ module PropertyGenerator
|
|
19
20
|
@service = merge_service_with_globals(@globals, service_data, @environments)
|
20
21
|
end
|
21
22
|
|
23
|
+
def set_additional_options
|
24
|
+
@additional_options = {}
|
25
|
+
@additional_options['configname'] = @service_data['configname'].nil? ? nil : @service_data['configname']
|
26
|
+
@additional_options['stringdata'] = @service_data['stringdata'].nil? ? nil : @service_data['stringdata']
|
27
|
+
@additional_options['configlabels'] = @service_data['configlabels'].nil? ? nil : @service_data['configlabels']
|
28
|
+
@additional_options['secretlabels'] = @service_data['secretlabels'].nil? ? nil : @service_data['secretlabels']
|
29
|
+
end
|
30
|
+
|
31
|
+
def additional_options
|
32
|
+
@additional_options
|
33
|
+
end
|
34
|
+
|
22
35
|
def service
|
23
36
|
@service
|
24
37
|
end
|
data/lib/helpers/helpers.rb
CHANGED
@@ -54,18 +54,18 @@ module PropertyGenerator
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
def writer(service_name, finalized, configs, output_path,
|
57
|
+
def writer(service_name, finalized, configs, output_path, additional_options)
|
58
58
|
output = []
|
59
59
|
envs = configs.environments
|
60
60
|
environmental_configs = configs.environment_configs
|
61
61
|
envs.each do | env|
|
62
62
|
account = environmental_configs[env]["account"]
|
63
63
|
region = environmental_configs[env]["region"]
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
JSON.pretty_generate({"properties" => finalized[env]})
|
64
|
+
hash = { "properties" => finalized[env] }
|
65
|
+
['configname', 'stringdata', 'configlabels', 'secretlabels'].each do |setting|
|
66
|
+
hash[setting] = additional_options[setting] if [setting] unless additional_options[setting].nil?
|
68
67
|
end
|
68
|
+
json = JSON.pretty_generate(hash)
|
69
69
|
#IF users are specifing a vpc then we will drop property files under the dir that corresponds to the vpc
|
70
70
|
if environmental_configs[env].key?("vpc") && !environmental_configs[env]["vpc"].nil?
|
71
71
|
vpc_dir = "#{output_path}/#{account}/#{region}/#{environmental_configs[env]["vpc"]}"
|
@@ -48,7 +48,7 @@ module PropertyGenerator
|
|
48
48
|
|
49
49
|
def services_have_accepted_keys
|
50
50
|
status = {status: 'pass', error: ''}
|
51
|
-
accepted_keys = ['default', 'environments', 'encrypted', 'configname']
|
51
|
+
accepted_keys = ['default', 'environments', 'encrypted', 'configname', 'stringdata', 'configlabels', 'secretlabels']
|
52
52
|
services_with_unacceptable_keys = []
|
53
53
|
@services.each do |path, loaded|
|
54
54
|
loaded.keys.each do |service_key|
|
@@ -59,7 +59,7 @@ module PropertyGenerator
|
|
59
59
|
end
|
60
60
|
if services_with_unacceptable_keys != []
|
61
61
|
status[:status] = 'fail'
|
62
|
-
status[:error] = "Service files: #{services_with_unacceptable_keys} have keys other than 'default', 'environments', 'encrypted', or '
|
62
|
+
status[:error] = "Service files: #{services_with_unacceptable_keys} have keys other than 'default', 'environments', 'encrypted', 'configname', 'stringdata' 'configlabels' or 'secretlabels'"
|
63
63
|
end
|
64
64
|
status
|
65
65
|
end
|