build-cloud 1.1.3 → 1.1.4

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
  SHA256:
3
- metadata.gz: ad8c7b556fc7107ea38511b167401391c61b05f7b41b7c690ebf5cb49401c1d3
4
- data.tar.gz: 0baf22d231dcab8c8e41312cce20fb616a4e7d50115f30f250e8ea13f2715887
3
+ metadata.gz: b796de3789fd255b22a0bbb3c9b31b61b1a560fd9205b6766c6e0e8459a14d72
4
+ data.tar.gz: 107602ff83bfd883c99972559de45eb7a4f67e1eaa293419faf8f520212333b1
5
5
  SHA512:
6
- metadata.gz: 833765e82f0b1314bbc8e9a076c1fe9095269d81fa81d465bcb51483304e5a42197c8b8c34117cbfe127707139777bef1acff6cdb4160f7894a046cb733ce554
7
- data.tar.gz: e242267e725571e67db99de3a9949871126c09a3a81a1ee1acec0ad279abbe6c102604d4343521dee1ce3f8c5bc4c7a12ad91956237888d150d5906a77ed2733
6
+ metadata.gz: 8510ed1ab35448dd52567c7f5ea2a4136245e8d7e57467826d773a90ae7b933ffd016c716949d83492fb7f81d72f73f477888af2cf4c6fe969f43f21559fe3e2
7
+ data.tar.gz: 6aafc72ea07eb7211ccf714c64148a6dad287fd3118e52e88b5c6eaa1420485235f4af6d5cac70bdd31cff0f9293f2271d46b3650e96971f745d7a1f11d21d5a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Changelog
2
2
 
3
+ 2018-06-18 - version 1.1.4 - Subnets now add missing tags.
4
+
3
5
  2018-04-12 - version 1.1.3 - EC2 instances and ASG now add missing tags.
4
6
 
5
7
  2018-04-12 - version 1.1.2 - version bump.
data/build-cloud.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "build-cloud"
7
- spec.version = "1.1.3"
7
+ spec.version = "1.1.4"
8
8
  spec.authors = ["The Scale Factory"]
9
9
  spec.email = ["info@scalefactory.com"]
10
10
  spec.summary = %q{Tools for building resources in AWS}
@@ -36,13 +36,21 @@ class BuildCloud::Subnet
36
36
  end
37
37
 
38
38
  def create
39
-
40
- return if exists?
41
-
42
- @log.info( "Creating subnet for #{@options[:cidr_block]} ( #{@options[:name]} )" )
43
39
 
44
40
  options = @options.dup
45
41
 
42
+ if exists?
43
+ # If exists update tags
44
+ if options[:tags]
45
+ create_tags(options[:tags])
46
+ end
47
+ return
48
+ end
49
+
50
+ return if exists?
51
+
52
+ @log.info( "Creating subnet for #{@options[:cidr_block]} ( #{options[:name]} )" )
53
+
46
54
  unless options[:vpc_id]
47
55
 
48
56
  options[:vpc_id] = BuildCloud::VPC.get_id_by_name( options[:vpc_name] )
@@ -86,5 +94,14 @@ class BuildCloud::Subnet
86
94
 
87
95
  end
88
96
 
97
+ def create_tags(tags)
98
+ # force symbols to strings in yaml tags
99
+ resolved_tags = fog_object.tag_set.dup.merge(tags.collect{|k,v| [k.to_s, v]}.to_h)
100
+ if resolved_tags != fog_object.tag_set
101
+ @log.info("Updating tags for subnet #{fog_object.subnet_id.to_s}")
102
+ @compute.create_tags( fog_object.subnet_id.to_s, tags )
103
+ end
104
+ end
105
+
89
106
  end
90
107
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: build-cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Scale Factory
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-30 00:00:00.000000000 Z
11
+ date: 2018-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler