tass 0.1.2 → 0.1.3
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/bin/tass +2 -22
- data/lib/tapjoy/autoscaling_bootstrap/version.rb +1 -1
- data/lib/tapjoy/autoscaling_bootstrap.rb +22 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7477b740521cfffcab21dc81e51ab3d81c76457d
|
4
|
+
data.tar.gz: 724f1459c3ddfa7997e5975d4dc325caeb8e6e14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c09942370add8729fbf7480e1819da06b1029d3aee25677d670886f1eb82f457146013d2cd3e05d37cfa899cf7b1f9b4aec7045d6a87b1e05513c1814eabc8bf
|
7
|
+
data.tar.gz: c65b5f549e3ece2517df0ff1d0c70fcd8191f71d6070d32b3823070d77e0d4afb5222d1de3fff871f02672232d546059f194cdb4fadb4072eba761ac23221dfb
|
data/bin/tass
CHANGED
@@ -11,16 +11,6 @@ def confirm_config(aws_env, misc_config, opts)
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
def supported_envs(listing)
|
15
|
-
envs = []
|
16
|
-
Dir.entries("#{listing}/config/common").each do |file|
|
17
|
-
next unless file.end_with?('yaml')
|
18
|
-
next if file.start_with?('defaults')
|
19
|
-
envs << file.chomp!('.yaml')
|
20
|
-
end
|
21
|
-
envs
|
22
|
-
end
|
23
|
-
|
24
14
|
SUB_COMMANDS = %w(create update audit)
|
25
15
|
Trollop::options do
|
26
16
|
usage '[SUB_COMMAND] [options]'
|
@@ -39,17 +29,12 @@ when 'create'
|
|
39
29
|
|
40
30
|
opt :filename, 'Specify config file to load', type: :string, required: true
|
41
31
|
opt :config_dir, 'Specify the directory for configuration files', type: :string, short: :none, default: Tapjoy::AutoscalingBootstrap.config_dir
|
42
|
-
opt :env, 'Specify which environment config to load',
|
32
|
+
opt :env, 'Specify which environment config to load', type: :string
|
43
33
|
opt :clobber_elb, 'Force ELB creation', default: false, short: :none
|
44
34
|
opt :clobber_as, 'Force AS group creation', default: false, short: :none
|
45
35
|
opt :prompt, 'Enable/disable prompts', default: true
|
46
36
|
end
|
47
37
|
|
48
|
-
env_list = supported_envs(opts[:config_dir])
|
49
|
-
unless env_list.include?(opts[:env])
|
50
|
-
Trollop.die :env, "Currently supported enviroments are #{env_list.join(',')}"
|
51
|
-
end
|
52
|
-
|
53
38
|
config, aws_env, user_data = Tapjoy::AutoscalingBootstrap::Base.new.configure_environment(opts[:filename], opts[:env], opts[:config_dir])
|
54
39
|
Aws.config[:region] = config[:aws_region]
|
55
40
|
confirm_config(aws_env, config, opts)
|
@@ -63,15 +48,10 @@ when 'update'
|
|
63
48
|
synopsis 'This command creates new launch configurations based on existing autoscaling groups using local instance configuration files as overrides.'
|
64
49
|
opt :filename, 'Specify config file to load', type: :string, required: true
|
65
50
|
opt :config_dir, 'Specify the directory for configuration files', type: :string, short: :none, default: Tapjoy::AutoscalingBootstrap.config_dir
|
66
|
-
opt :env, 'Specify which environment config to load',
|
51
|
+
opt :env, 'Specify which environment config to load', type: :string
|
67
52
|
opt :prompt, 'Enable/disable prompts', default: true
|
68
53
|
end
|
69
54
|
|
70
|
-
env_list = supported_envs(opts[:config_dir])
|
71
|
-
unless env_list.include?(opts[:env])
|
72
|
-
Trollop.die :env, "Currently supported enviroments are #{env_list.join(',')}"
|
73
|
-
end
|
74
|
-
|
75
55
|
config, aws_env, user_data = Tapjoy::AutoscalingBootstrap::Base.new.configure_environment(opts[:filename], opts[:env], opts[:config_dir])
|
76
56
|
Aws.config[:region] = config[:aws_region]
|
77
57
|
confirm_config(aws_env, config, opts)
|
@@ -63,6 +63,24 @@ module Tapjoy
|
|
63
63
|
def config_dir
|
64
64
|
@config_dir ||= ENV['TASS_CONFIG_DIR'] || "#{ENV['HOME']}/.tass"
|
65
65
|
end
|
66
|
+
|
67
|
+
def is_valid_env?(config_dir, env)
|
68
|
+
env_list = self.supported_envs(config_dir)
|
69
|
+
puts config_dir
|
70
|
+
unless env_list.include?(env)
|
71
|
+
Trollop.die :env, "Currently supported enviroments are #{env_list.join(',')}"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def supported_envs(listing)
|
76
|
+
envs = []
|
77
|
+
Dir.entries("#{listing}/config/common").each do |file|
|
78
|
+
next unless file.end_with?('yaml')
|
79
|
+
next if file.start_with?('defaults')
|
80
|
+
envs << file.chomp!('.yaml')
|
81
|
+
end
|
82
|
+
envs
|
83
|
+
end
|
66
84
|
end
|
67
85
|
|
68
86
|
# Base class for generic methods used throughout the gem
|
@@ -136,9 +154,12 @@ module Tapjoy
|
|
136
154
|
end
|
137
155
|
|
138
156
|
# configure environment
|
139
|
-
def configure_environment(filename, env, config_dir)
|
157
|
+
def configure_environment(filename, env=nil, config_dir)
|
140
158
|
defaults_hash = self.load_yaml("#{config_dir}/config/common/defaults.yaml")
|
141
159
|
facet_hash = self.load_yaml("#{config_dir}/config/clusters/#{filename}")
|
160
|
+
env ||= facet_hash[:environment]
|
161
|
+
env ||= defaults_hash[:environment]
|
162
|
+
Tapjoy::AutoscalingBootstrap.is_valid_env?(config_dir, env)
|
142
163
|
env_hash = self.load_yaml("#{config_dir}/config/common/#{env}.yaml")
|
143
164
|
|
144
165
|
new_config = defaults_hash.merge!(env_hash).merge(facet_hash)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ali Tayarani
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trollop
|