vominator 0.0.10 → 0.0.11

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: 2a02ad514384d37adef6b9b192716141a451ecc2
4
- data.tar.gz: 2403c7628daa6c9d83238b84a1d44e13add078b4
3
+ metadata.gz: 838a4285c80d644368f923558bba78f0bd15ff1c
4
+ data.tar.gz: 8c89c085df0b45cb7a4fb54f42ec1f858b62c304
5
5
  SHA512:
6
- metadata.gz: 537766126b490442bac154d4c36c2b76e790a27249bd3c19394d4fd58d3c27b1a2c171811d355ae02076131fc658423fae5cdb7798dc4b63d71e7776d849856d
7
- data.tar.gz: a444493590528de6b5c47cc55da40ab1403734415d887506d4324c37e6a88d22473c6a67f31f92a9e42b54c97a1efc0968fc3e287da3d86c81f45a30087cb332
6
+ metadata.gz: cb81c2d796cce7c58b12bf752de5ac1925483f1e9a92f59c5a75d022a2bc4bc944eb9ff481c6d11663dfb14407ccea12b10443e9793c717cd2307e7d1fba9c3d
7
+ data.tar.gz: d4f8bedad5d9f09359c52b001e9c8403e421d771b107d74b2281898ac65341d7b5ec5f746657fa986536ef693a20bef3e756ae680c621b1530d2729448d27e8c
data/lib/ec2/instances.rb CHANGED
@@ -144,6 +144,7 @@ instances.each do |instance|
144
144
  key_name = Vominator.get_key_pair(VOMINATOR_CONFIG)
145
145
  ssm_documents = instance['ssm_documents'].nil? ? [] : instance['ssm_documents']
146
146
  instance_az = instance['az'][options[:environment]] || instance['az']
147
+ instance_tags = instance['tags']
147
148
 
148
149
  LOGGER.info("Working on #{fqdn}")
149
150
 
@@ -178,6 +179,7 @@ instances.each do |instance|
178
179
  ec2_instance = Vominator::EC2.get_instance(ec2, ec2_instances[instance_ip][:instance_id])
179
180
  ec2_instance_security_groups = ec2_instances[instance_ip][:security_groups].uniq.sort
180
181
  ec2_instance_ebs_volumes = Vominator::EC2.get_instance_ebs_volumes(ec2, ec2_instances[instance_ip][:instance_id])
182
+ ec2_instance_tags = Hash[ec2_instance.tags.map{ |x| [x.key, x.value]}]
181
183
 
182
184
  if options[:disable_term_protection]
183
185
  unless test?("Would disable instance termination protection for #{fqdn}")
@@ -341,6 +343,16 @@ instances.each do |instance|
341
343
  end
342
344
  end
343
345
  end
346
+
347
+ instance_tags.each do |tag|
348
+ key = tag.split('=')[0]
349
+ value = tag.split('=')[1]
350
+ unless ec2_instance_tags.key?(key) || (ec2_instance_tags.key?(key) && ec2_instance_tags[key] != value)
351
+ unless test?("Would create or update tag #{key}:#{value}")
352
+ Vominator::EC2.tag_resource(ec2_client, ec2_instance.id, [{key: key, value: value}])
353
+ end
354
+ end
355
+ end
344
356
 
345
357
  else #The instance does not exist, in which case we want to create it.
346
358
  user_data = Vominator::Instances.generate_cloud_config(hostname, options[:environment], options[:environment].gsub('.','-'), instance['family'], instance['chef_roles'], instance['chef_recipes'])
@@ -1,3 +1,3 @@
1
1
  module Vominator
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vominator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Kelly
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-07-11 00:00:00.000000000 Z
13
+ date: 2016-08-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: aws-sdk