conan_deploy 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
data/bin/conan CHANGED
@@ -95,6 +95,10 @@ optparse = OptionParser.new do |o|
95
95
  options[:'dry-run'] = true
96
96
  end
97
97
 
98
+ o.on('-S','--stfu', 'Supress errors when compairing active and inactive domains' ) do
99
+ options[:stfu] = true
100
+ end
101
+
98
102
  o.on('-V','--verbose', 'Verbose console output' ) do
99
103
  options[:verbose] = true
100
104
  end
@@ -2,7 +2,7 @@
2
2
  class Application
3
3
 
4
4
  attr_accessor :id, :platform_type, :group_id, :artifact_id, :version, :extension, :sha1, :artifact_meta_data, :url_segment,
5
- :unique_name, :additional_mappings, :org, :infra, :smoke_test_path
5
+ :unique_name, :additional_mappings, :org, :infra, :smoke_test_path, :existing_mappings
6
6
 
7
7
  def initialize(id, project_name, platform_type, options, url_segment=nil)
8
8
  @id = id
@@ -33,7 +33,7 @@ class Application
33
33
  end
34
34
 
35
35
  def inactive_healthcheck_url
36
- "http://inactive.#{full_backchannel_domain}/#{@smoke_test_path}"
36
+ "http://x.#{full_backchannel_domain}/#{@smoke_test_path}"
37
37
  end
38
38
 
39
39
  def active_healthcheck_url
@@ -145,11 +145,11 @@ class Application
145
145
 
146
146
 
147
147
  def active_domains
148
- [full_backchannel_domain, infra_agnostic_backchannel_domain] + Array(@additional_mappings)
148
+ @existing_mappings || [full_backchannel_domain, infra_agnostic_backchannel_domain] + Array(@additional_mappings)
149
149
  end
150
150
 
151
151
  def inactive_domains
152
- active_domains.map{|domain| "inactive.#{domain}"}
152
+ active_domains.map{|domain| "x.#{domain}"}
153
153
  end
154
154
 
155
155
  private
@@ -64,7 +64,7 @@ class Deployment < HasOptions
64
64
  end
65
65
 
66
66
  def inactive_urls(app)
67
- active_urls(app).map{ |url| "inactive.#{url}" }
67
+ active_urls(app).map{ |url| "x.#{url}" }
68
68
  end
69
69
 
70
70
  def manifest_url(app)
@@ -76,7 +76,7 @@ class Deployment < HasOptions
76
76
  end
77
77
 
78
78
  def inactive_smoke_test_url(app)
79
- "http://inactive.#{dns_name(app)}/#{@custom_smoke_test_path || 'status/healthcheck'}"
79
+ "http://x.#{dns_name(app)}/#{@custom_smoke_test_path || 'status/healthcheck'}"
80
80
  end
81
81
 
82
82
  def paas_target
@@ -28,6 +28,7 @@ class Stackato
28
28
  def self.static_login(options)
29
29
  org = options[:'deploy-shipcloud'].split('-')[0]
30
30
  infra = options[:'deploy-shipcloud'].split('-')[1]
31
+ @@options = options
31
32
 
32
33
  puts "logging in at https://api.paas.#{infra}.#{org}.mtnsatcloud.com"
33
34
  @@stackato_command = "stackato --target https://api.paas.#{infra}.#{org}.mtnsatcloud.com --token-file #{@@paas_token_file}"
@@ -72,6 +73,7 @@ class Stackato
72
73
  if /#{Regexp.escape(newly_deployed_app.stackato_base_name)}/ =~ app["name"] and app["name"] != newly_deployed_app.unique_name
73
74
  old_app = newly_deployed_app.clone
74
75
  old_app.unique_name = app["name"]
76
+ old_app.existing_mappings = app["uris"]
75
77
  old_apps << old_app
76
78
  end
77
79
  end
@@ -201,18 +203,18 @@ class Stackato
201
203
  active_urls = deployment.active_urls(app)
202
204
  inactive_urls = deployment.inactive_urls(app)
203
205
 
204
- StackatoApplicationInfo.new(list_json, base_name, active_urls, inactive_urls)
206
+ StackatoApplicationInfo.new(list_json, base_name, active_urls, inactive_urls, @@options)
205
207
  end
206
208
  end
207
209
 
208
210
  class StackatoApplicationInfo
209
- def initialize(list_json, base_name, active_urls, inactive_urls)
211
+ def initialize(list_json, base_name, active_urls, inactive_urls, options)
210
212
  app_list = JSON.parse(list_json)
211
213
 
212
214
  active_app_names = []
213
215
  inactive_app_names = []
214
216
 
215
- app_list.each { |app_hash|
217
+ app_list.each do |app_hash|
216
218
  if !(app_hash.has_key? 'name' and app_hash.has_key? 'uris')
217
219
  raise "Stackato list json is malformed: " + list_json
218
220
  end
@@ -226,11 +228,12 @@ class StackatoApplicationInfo
226
228
  elsif app_uris.sort == inactive_urls.sort
227
229
  inactive_app_names << app_name
228
230
  else
229
- raise 'Stackato app "' + app_name +
230
- '" needs to be mapped exclusively to either the active or inactive set of URLs. Please reconcile before continuing.'
231
+ unless options[:stfu]
232
+ raise "Stackato app '#{app_name}' needs to be mapped exclusively to either the active or inactive set of URLs. Please reconcile before continuing."
233
+ end
231
234
  end
232
235
  end
233
- }
236
+ end
234
237
 
235
238
  if active_app_names.length > 1
236
239
  raise "More than one app is mapped to the active URL(s). Please reconcile before continuing."
data/lib/conan/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Conan
2
- VERSION = "0.0.15"
2
+ VERSION = "0.0.16"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conan_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-06-11 00:00:00.000000000 Z
13
+ date: 2014-07-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: daphne_util