idlc-sdk-deploy 1.0.15 → 1.0.16

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9167f127ffe0bd45026007231b9879f23fb59b5415459b04f6b8bb1ca7c0d266
4
- data.tar.gz: 705f32ca26d0e3b67b0d5be994745f5484910aaa73f4c16d2475ceeb43491201
3
+ metadata.gz: 8ca29ccf9ec0260df48a59d9c51c1794fdd98a177ca681704facf892bad60b3d
4
+ data.tar.gz: d1ea345c78f83de0cbe25cd083cb77498adfcc2c310b3b99b5cb39b029b5fd9d
5
5
  SHA512:
6
- metadata.gz: b7232a5f0fd814bc03d2048a881c0b24d1198b4311b22230356296b9a4e467c03941ba76b25e077e92366e33e04484dc9ca8afe4299614a682c84ac45b06bfe1
7
- data.tar.gz: b7932f67da98cef1786b4e14e10bcfc10dded905a60673a604a913529172de35139b0798fd58c52cfadf5e9efa01c8803ef14f4c68dfc1ebd71457bccb558ecb
6
+ metadata.gz: d1ca60aee6f1406197e580e01311e1f3715dff89538407ffebdac64fa57a1666a1cd15ab9f1f66115c3a078ebda59a1119fba710a164a6205ecc79b5949eb497
7
+ data.tar.gz: 3e01334633f21e1d44cff1eea89ae4f1768a71b4b225763ca7da79b8e6f9ff60c94cc4261dbb4e922fa44f79d5c76c1caa45ecdb65be50f6fdf829342e1fbe24
@@ -85,6 +85,45 @@ module Idlc
85
85
 
86
86
  metadata
87
87
  end
88
+
89
+ def get_instance
90
+ # Get the current instance id from the instance metadata.
91
+ metadata_endpoint = 'http://169.254.169.254/latest/meta-data/'
92
+ instance_id = Net::HTTP.get( URI.parse( metadata_endpoint + 'instance-id' ) )
93
+
94
+ # Create instance object with instance id.
95
+ instance = Aws::EC2::Instance.new( id: instance_id, region: ENV['AWS_REGION'] )
96
+ instance['instance_id'] = instance_id
97
+
98
+ instance.tags.each do |tag|
99
+ # Grab all of the tags as node attributes
100
+ instance['tags'][tag.key] = tag.value
101
+ end
102
+
103
+ instance
104
+ end
105
+
106
+ def set_hostname (instance)
107
+ hostname = instance['tags']['Name']
108
+
109
+ unless (instance['tags']['Name'].start_with? 'db')
110
+ # Use instance id for unique hostname
111
+ hostname = instance['tags']['Name'][0..4] + '-' + instance['instance_id'][2..10]
112
+ end
113
+
114
+ instance.create_tags(
115
+ dry_run: false,
116
+ tags: [ # required
117
+ {
118
+ key: 'hostname',
119
+ value: hostname
120
+ }
121
+ ]
122
+ )
123
+
124
+ #return
125
+ hostname
126
+ end
88
127
  end
89
128
 
90
129
  def initialize(region)
@@ -124,45 +163,6 @@ module Idlc
124
163
 
125
164
  private
126
165
 
127
- def get_instance
128
- # Get the current instance id from the instance metadata.
129
- metadata_endpoint = 'http://169.254.169.254/latest/meta-data/'
130
- instance_id = Net::HTTP.get( URI.parse( metadata_endpoint + 'instance-id' ) )
131
-
132
- # Create instance object with instance id.
133
- instance = Aws::EC2::Instance.new( id: instance_id, region: ENV['AWS_REGION'] )
134
- instance['instance_id'] = instance_id
135
-
136
- instance.tags.each do |tag|
137
- # Grab all of the tags as node attributes
138
- instance['tags'][tag.key] = tag.value
139
- end
140
-
141
- instance
142
- end
143
-
144
- def set_hostname (instance)
145
- hostname = instance['tags']['Name']
146
-
147
- unless (instance['tags']['Name'].start_with? 'db')
148
- # Use instance id for unique hostname
149
- hostname = instance['tags']['Name'][0..4] + '-' + instance['instance_id'][2..10]
150
- end
151
-
152
- instance.create_tags(
153
- dry_run: false,
154
- tags: [ # required
155
- {
156
- key: 'hostname',
157
- value: hostname
158
- }
159
- ]
160
- )
161
-
162
- #return
163
- hostname
164
- end
165
-
166
166
  def configure_tfstatev8(bucket, sub_bucket, working_directory)
167
167
  args = []
168
168
  args << '-backend=s3'
@@ -1,5 +1,5 @@
1
1
  module Idlc
2
2
  module Deploy
3
- VERSION = '1.0.15'.freeze
3
+ VERSION = '1.0.16'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: idlc-sdk-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.15
4
+ version: 1.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Cazell