idlc-sdk-deploy 1.0.0.rc5 → 1.0.0.rc6

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: df1ba5e7ca567e8cb91a2c8d27fa546345b2cc81
4
- data.tar.gz: fb2e864db7e94b5b09837618efc65bfd1a194a18
3
+ metadata.gz: '0805f4e4ae3a4a7950804f0c5d4a2204c688121a'
4
+ data.tar.gz: 445b0e06b2265d4bcedc84c98bcdb07d51407935
5
5
  SHA512:
6
- metadata.gz: 5f1b758deb9508d534f4e7f92f7b032b3af7b96b1ae7425010856ae85373116303199e8fca10926aea4b33b31264ff8eeb37c146153c7b3ee0bb0a2de3cdbebb
7
- data.tar.gz: 1a71a95b56982fc52821f9ea9f74f44ab1e1932cbbface6325dd7347546063ae746765138b739437b89ce3362f920ac71f55cd0ba582b3517573ae6504ecfbe1
6
+ metadata.gz: 357e09b221657a3b84a46ad3f6d4e7f1f5de9e5f8c2d405b31c0ade1cca8ca8afee75a98e1852905040628fd5f866bad1ba857e3746817eed71c595ff140cd6b
7
+ data.tar.gz: 1d26441c6408bf9efa9f389d3e31e86c5c7fc85152042eaaf11e8f263954574d18a8bf0c4f4e876d304c82b2661ad14e699d790f0b9803d014565e3e6ad0bbba
@@ -33,7 +33,7 @@ module Idlc
33
33
  tags: [ # required
34
34
  {
35
35
  key: 'keep_alive',
36
- value: 'true'
36
+ value: "true-#{Time.now.to_i}"
37
37
  }
38
38
  ]
39
39
  )
@@ -127,18 +127,39 @@ module Idlc
127
127
 
128
128
  def keep_alive?(tags)
129
129
  k = 'false'
130
+ k = get_keep_alive(tags)
130
131
 
131
- tags.each do |t|
132
- k = t.value if t.key == 'keep_alive'
133
- end
132
+ return !keep_alive_expired?(k) if true?(k.split('-')[0])
133
+ false
134
+ end
135
+
136
+ def keep_alive_expired?(tag)
137
+ tag_parts = tag.split('-')
134
138
 
135
- true?(k)
139
+ msg("keep_alive expired..") if one_week_old?(tag_parts[1].to_i)
140
+ msg("keep_alive expires in #{((Time.now.to_i - (tag_parts[1].to_i + (7*24*3600)))/24/3600).abs} days..") unless one_week_old?(tag_parts[1].to_i)
141
+
142
+ one_week_old?(tag_parts[1].to_i)
136
143
  end
137
144
 
138
145
  def true?(string)
139
146
  string.to_s == 'true'
140
147
  end
141
148
 
149
+ def one_week_old?(ts)
150
+ (Time.now.to_i - ts) > (7*(24*3600))
151
+ end
152
+
153
+ def get_keep_alive(tags)
154
+ v = ''
155
+
156
+ tags.each do |t|
157
+ v = t.value if t.key == 'keep_alive'
158
+ end
159
+
160
+ # Return
161
+ v
162
+ end
142
163
 
143
164
  def http_request(endpoint)
144
165
  uri = URI.parse endpoint
@@ -1,5 +1,5 @@
1
1
  module Idlc
2
2
  module Deploy
3
- VERSION = '1.0.0.rc5'.freeze
3
+ VERSION = '1.0.0.rc6'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: idlc-sdk-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc5
4
+ version: 1.0.0.rc6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Cazell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-13 00:00:00.000000000 Z
11
+ date: 2017-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler