tass 1.0.1 → 1.0.2

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: 8f9fd0263ef1c15a5e61436732978ec1b6b0e4b7
4
- data.tar.gz: 8e67c25a049fdb7e30076b7238cfe06ab49b2196
3
+ metadata.gz: d590a141e3439e74e93e210bf0ca293e9f00480c
4
+ data.tar.gz: 54fed348eb8e7aed908d318e4561c489c15b95a2
5
5
  SHA512:
6
- metadata.gz: bbb7ac261a8cadccafcfa633dd211409b5719f32aa366703408f4cbd5e099569f3e38545d4a4fc309d11634cf6238cd53f2e71f89209ce3609e2d8f7f51ac652
7
- data.tar.gz: 0cac35b118d46990c47fcec1d1b471e137273d6c8a11cb4e8595c164d13f40f4638c7065f96ba39b53bfe33c6fd34f6864a53ca125f4fdf25a6b89e55753d931
6
+ metadata.gz: bdd2bed48875a84e91c14b90598e72e6852a512d6bb5b6d3ebc5e000af904dd1afda32a0e091ab178e5a50d992bcd254966ba71a48787ad1a30afff39c64ec82
7
+ data.tar.gz: 15ccdd755734318995c9be67e4df6668345b939df8fb3c2cd2558e5eb8fa23280b41aa3d8adcb20511b2604976274ff703d7dd2af6cd9a3cbd9960cee2fd84d4
data/bin/tass CHANGED
@@ -23,6 +23,13 @@ def configure_environment(opts)
23
23
  [config, aws_env, user_data]
24
24
  end
25
25
 
26
+ # Are we using a newer yaml schema
27
+ def newer_yaml_version?(config)
28
+ Tapjoy::AutoscalingBootstrap::Base.new.check_yaml_version(config).split(".").first.to_i >= 2
29
+ end
30
+
31
+
32
+
26
33
  SUB_COMMANDS = %w(create update audit scale)
27
34
  Trollop::options do
28
35
  usage '[SUB_COMMAND] [options]'
@@ -46,27 +53,32 @@ when 'create'
46
53
 
47
54
  config, aws_env, user_data = configure_environment(opts)
48
55
 
49
- Tapjoy::AutoscalingBootstrap::Base.new.check_clobber(opts, config)
50
- unless confirm_config(aws_env, config, opts)
51
- abort('Cannot continue if configuration is not correct. Please fix.')
52
- end
53
- Tapjoy::AutoscalingBootstrap::AutoscalingGroup.new.create(opts, config, aws_env, user_data)
54
-
55
- if config.key?(:elb)
56
- config[:elb].each do |elb|
57
- elb.each do |elb_name, elb_config|
58
- Tapjoy::AutoscalingBootstrap.elb_name = elb_name
59
- elb_hash = {
60
- elb_name => config[:default_elb_parameters].merge!(elb[elb_name])
61
- }
62
-
63
- Tapjoy::AutoscalingBootstrap::ELB.new(
64
- elb_hash, config[:clobber_elb], config[:zones],
65
- config[:security_groups])
56
+ # check the verison of the yaml we are reading, and do the new hotness if we are running v2 or higher
57
+ if newer_yaml_version?(config)
58
+ # TODO: Implement new yaml parsing routine for cloudfront
59
+ puts "Running new parsing routine with:\nconfig: #{config}\naws_env: #{aws_env}\nuser_data: #{user_data}"
60
+ else
61
+ Tapjoy::AutoscalingBootstrap::Base.new.check_clobber(opts, config)
62
+ unless confirm_config(aws_env, config, opts)
63
+ abort('Cannot continue if configuration is not correct. Please fix.')
64
+ end
65
+ Tapjoy::AutoscalingBootstrap::AutoscalingGroup.new.create(opts, config, aws_env, user_data)
66
+
67
+ if config.key?(:elb)
68
+ config[:elb].each do |elb|
69
+ elb.each do |elb_name, elb_config|
70
+ Tapjoy::AutoscalingBootstrap.elb_name = elb_name
71
+ elb_hash = {
72
+ elb_name => config[:default_elb_parameters].merge!(elb[elb_name])
73
+ }
74
+
75
+ Tapjoy::AutoscalingBootstrap::ELB.new(
76
+ elb_hash, config[:clobber_elb], config[:zones],
77
+ config[:security_groups])
78
+ end
66
79
  end
67
80
  end
68
81
  end
69
-
70
82
  when 'update'
71
83
  opts = Trollop.options do
72
84
  # Set help message
@@ -76,9 +88,16 @@ when 'update'
76
88
  end
77
89
 
78
90
  config, aws_env, user_data = configure_environment(opts)
79
- confirm_config(aws_env, config, opts)
80
91
 
81
- Tapjoy::AutoscalingBootstrap::LaunchConfiguration.new(config, aws_env, user_data)
92
+ # check the verison of the yaml we are reading, and do the new hotness if we are running v2 or higher
93
+ if newer_yaml_version?(config)
94
+ # TODO: Implement new yaml parsing routine for cloudfront
95
+ puts "Running new parsing routine with:\nconfig: #{config}\naws_env: #{aws_env}\nuser_data: #{user_data}"
96
+ else
97
+ confirm_config(aws_env, config, opts)
98
+
99
+ Tapjoy::AutoscalingBootstrap::LaunchConfiguration.new(config, aws_env, user_data)
100
+ end
82
101
  when 'audit'
83
102
  opts = Trollop.options do
84
103
  usage 'audit'
@@ -88,8 +107,14 @@ when 'audit'
88
107
 
89
108
  config, aws_env, user_data = configure_environment(opts)
90
109
 
91
- config.merge!(aws_env.merge(user_data: Base64.encode64("#{user_data}")))
92
- Tapjoy::AutoscalingBootstrap::Audit.new(config)
110
+ # check the verison of the yaml we are reading, and do the new hotness if we are running v2 or higher
111
+ if newer_yaml_version?(config)
112
+ # TODO: Implement new yaml parsing routine for cloudfront
113
+ puts "Running new parsing routine with:\nconfig: #{config}\naws_env: #{aws_env}\nuser_data: #{user_data}"
114
+ else
115
+ config.merge!(aws_env.merge(user_data: Base64.encode64("#{user_data}")))
116
+ Tapjoy::AutoscalingBootstrap::Audit.new(config)
117
+ end
93
118
  when 'scale'
94
119
  opts = Trollop.options do
95
120
  usage 'scale [options]'
@@ -99,7 +124,13 @@ when 'scale'
99
124
  end
100
125
 
101
126
  config, aws_env, user_data = configure_environment(opts)
102
- Tapjoy::AutoscalingBootstrap::Autoscaling::Group.new.scale(config)
127
+ # check the verison of the yaml we are reading, and do the new hotness if we are running v2 or higher
128
+ if newer_yaml_version?(config)
129
+ # TODO: Implement new yaml parsing routine for cloudfront
130
+ puts "This command will be covered by #update functionality in the v2 schema"
131
+ else
132
+ Tapjoy::AutoscalingBootstrap::Autoscaling::Group.new.scale(config)
133
+ end
103
134
  else
104
135
  Trollop.educate
105
136
  end
@@ -29,7 +29,6 @@ module Tapjoy
29
29
 
30
30
  puts "Creating scaling group: #{@scaler_name}"
31
31
  Tapjoy::AutoscalingBootstrap::AWS::Autoscaling::Group.create(**config)
32
- create_termination_notification(config)
33
32
  end
34
33
 
35
34
  # Check if autoscale group exists
@@ -3,7 +3,7 @@ module Tapjoy
3
3
  module Version
4
4
  MAJOR = 1
5
5
  MINOR = 0
6
- PATCH = 1
6
+ PATCH = 2
7
7
  end
8
8
 
9
9
  VERSION = [Version::MAJOR, Version::MINOR, Version::PATCH].join('.')
@@ -111,6 +111,12 @@ module Tapjoy
111
111
  create_as_group && Tapjoy::AutoscalingBootstrap.group.exists && !clobber_as
112
112
  end
113
113
 
114
+ # See what version of the yaml we are running
115
+ def check_yaml_version(config)
116
+ # If we don't have one specified assume v1
117
+ config[:version] ? config[:version] : "1.0.0"
118
+ end
119
+
114
120
  # Get AWS Environment
115
121
  def get_security_groups(config_dir, env, group)
116
122
 
@@ -168,6 +174,9 @@ module Tapjoy
168
174
  env_hash = self.load_yaml(File.join(common_path, "#{env}.yaml"))
169
175
 
170
176
  new_config = defaults_hash.merge!(env_hash).merge(facet_hash)
177
+
178
+ # TODO: Only run this part of the configuration and return aws_env and user_data for the older yaml file verison
179
+
171
180
  new_config[:config_dir] = config_dir
172
181
  new_config[:instance_ids] = opts[:instance_ids] if opts.key?(:instance_ids)
173
182
  aws_env = self.get_security_groups(common_path, env, new_config[:group])
@@ -177,7 +186,6 @@ module Tapjoy
177
186
  new_config[:tags] << {Name: new_config[:name]}
178
187
  Tapjoy::AutoscalingBootstrap.scaler_name = "#{new_config[:name]}-group"
179
188
  Tapjoy::AutoscalingBootstrap.config_name = "#{new_config[:name]}-config"
180
- # If there's no ELB, then Not a ELB
181
189
  user_data = self.generate_user_data(userdata_dir,
182
190
  new_config[:bootstrap_script], new_config)
183
191
 
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: 1.0.1
4
+ version: 1.0.2
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-24 00:00:00.000000000 Z
11
+ date: 2016-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trollop