Class: Deployment
- Inherits:
-
HasOptions
- Object
- HasOptions
- Deployment
- Defined in:
- lib/conan/deployment.rb
Instance Attribute Summary collapse
-
#additional_mappings ⇒ Object
Returns the value of attribute additional_mappings.
-
#app_ids ⇒ Object
Returns the value of attribute app_ids.
-
#custom_smoke_test_path ⇒ Object
Returns the value of attribute custom_smoke_test_path.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#facility_id ⇒ Object
Returns the value of attribute facility_id.
-
#org ⇒ Object
Returns the value of attribute org.
-
#ship ⇒ Object
Returns the value of attribute ship.
-
#shipcloud ⇒ Object
Returns the value of attribute shipcloud.
Attributes inherited from HasOptions
Instance Method Summary collapse
- #active_smoke_test_url(app) ⇒ Object
- #active_urls(app) ⇒ Object
- #agnostic_dns_names(app) ⇒ Object
- #apps(*app_ids) ⇒ Object
- #dns_name(app) ⇒ Object
- #dns_names(app) ⇒ Object
- #enabled(b) ⇒ Object
- #enabled? ⇒ Boolean
- #facility(facility_id) ⇒ Object
- #hostnames(*hostnames) ⇒ Object
- #inactive_smoke_test_url(app) ⇒ Object
- #inactive_urls(app) ⇒ Object
-
#initialize(environment, org, ship) ⇒ Deployment
constructor
A new instance of Deployment.
- #manifest_url(app) ⇒ Object
- #name(app) ⇒ Object
- #paas_target ⇒ Object
- #smoke_test_path(path = nil) ⇒ Object
- #to_s ⇒ Object
- #unique_name(app) ⇒ Object
Methods inherited from HasOptions
Constructor Details
#initialize(environment, org, ship) ⇒ Deployment
Returns a new instance of Deployment.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/conan/deployment.rb', line 6 def initialize(environment, org, ship) # inherit options from the environment #super(environment.options) # TODO: copy?! super({}) @environment = environment @org = org @ship = ship @shipcloud = "#{org}-#{ship}" @app_ids = [] @additional_mappings = [] @facility_id = nil @enabled = true @randomid = SecureRandom.hex(3) @custom_smoke_test_path = nil end |
Instance Attribute Details
#additional_mappings ⇒ Object
Returns the value of attribute additional_mappings.
4 5 6 |
# File 'lib/conan/deployment.rb', line 4 def additional_mappings @additional_mappings end |
#app_ids ⇒ Object
Returns the value of attribute app_ids.
4 5 6 |
# File 'lib/conan/deployment.rb', line 4 def app_ids @app_ids end |
#custom_smoke_test_path ⇒ Object
Returns the value of attribute custom_smoke_test_path.
4 5 6 |
# File 'lib/conan/deployment.rb', line 4 def custom_smoke_test_path @custom_smoke_test_path end |
#environment ⇒ Object
Returns the value of attribute environment.
4 5 6 |
# File 'lib/conan/deployment.rb', line 4 def environment @environment end |
#facility_id ⇒ Object
Returns the value of attribute facility_id.
4 5 6 |
# File 'lib/conan/deployment.rb', line 4 def facility_id @facility_id end |
#org ⇒ Object
Returns the value of attribute org.
4 5 6 |
# File 'lib/conan/deployment.rb', line 4 def org @org end |
#ship ⇒ Object
Returns the value of attribute ship.
4 5 6 |
# File 'lib/conan/deployment.rb', line 4 def ship @ship end |
#shipcloud ⇒ Object
Returns the value of attribute shipcloud.
4 5 6 |
# File 'lib/conan/deployment.rb', line 4 def shipcloud @shipcloud end |
Instance Method Details
#active_smoke_test_url(app) ⇒ Object
86 87 88 |
# File 'lib/conan/deployment.rb', line 86 def active_smoke_test_url(app) "http://#{dns_name(app)}/#{@custom_smoke_test_path || 'status/healthcheck'}" end |
#active_urls(app) ⇒ Object
74 75 76 |
# File 'lib/conan/deployment.rb', line 74 def active_urls(app) dns_names(app) + agnostic_dns_names(app) + @additional_mappings end |
#agnostic_dns_names(app) ⇒ Object
65 66 67 68 69 70 71 72 |
# File 'lib/conan/deployment.rb', line 65 def agnostic_dns_names(app) if @ship == "central" [ "#{@environment.id}.#{app.url_segment}.mtnsat.io", "#{@environment.id}.#{app.url_segment}.mtnsatcloud.com" ] else [ "#{app.url_segment}.mtnsat.io" ] end end |
#apps(*app_ids) ⇒ Object
22 23 24 |
# File 'lib/conan/deployment.rb', line 22 def apps(*app_ids) @app_ids = app_ids end |
#dns_name(app) ⇒ Object
61 62 63 |
# File 'lib/conan/deployment.rb', line 61 def dns_name(app) dns_names(app)[0] end |
#dns_names(app) ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/conan/deployment.rb', line 52 def dns_names(app) if @ship == "central" [ "#{@environment.id}-#{app.url_segment}.paasv2.#{@ship}.#{@org}.mtnsatcloud.com", "#{@environment.id}.#{app.url_segment}.#{@ship}.#{@org}.mtnsatcloud.com" ] else [ "#{app.url_segment}.#{@ship}.#{@org}.mtnsatcloud.com" ] end end |
#enabled(b) ⇒ Object
36 37 38 |
# File 'lib/conan/deployment.rb', line 36 def enabled(b) @enabled = b end |
#enabled? ⇒ Boolean
40 41 42 |
# File 'lib/conan/deployment.rb', line 40 def enabled? @enabled end |
#facility(facility_id) ⇒ Object
26 27 28 |
# File 'lib/conan/deployment.rb', line 26 def facility(facility_id) @facility_id = facility_id end |
#hostnames(*hostnames) ⇒ Object
30 31 32 33 34 |
# File 'lib/conan/deployment.rb', line 30 def hostnames(*hostnames) hostnames.each do |hostname| @additional_mappings.push(hostname) unless hostname.empty? end end |
#inactive_smoke_test_url(app) ⇒ Object
90 91 92 |
# File 'lib/conan/deployment.rb', line 90 def inactive_smoke_test_url(app) "http://x.#{dns_name(app)}/#{@custom_smoke_test_path || 'status/healthcheck'}" end |
#inactive_urls(app) ⇒ Object
78 79 80 |
# File 'lib/conan/deployment.rb', line 78 def inactive_urls(app) active_urls(app).map{ |url| "x-#{url}" } end |
#manifest_url(app) ⇒ Object
82 83 84 |
# File 'lib/conan/deployment.rb', line 82 def manifest_url(app) "http://#{dns_name(app)}/status/manifest" end |
#name(app) ⇒ Object
44 45 46 |
# File 'lib/conan/deployment.rb', line 44 def name(app) "#{app.id}-#{@environment.id}-#{@ship}" end |
#paas_target ⇒ Object
94 95 96 |
# File 'lib/conan/deployment.rb', line 94 def paas_target "https://api.paasv2.#{@ship}.#{@org}.mtnsatcloud.com" end |
#smoke_test_path(path = nil) ⇒ Object
102 103 104 |
# File 'lib/conan/deployment.rb', line 102 def smoke_test_path(path=nil) @custom_smoke_test_path = path end |
#to_s ⇒ Object
98 99 100 |
# File 'lib/conan/deployment.rb', line 98 def to_s "#{org}-#{ship}" end |
#unique_name(app) ⇒ Object
48 49 50 |
# File 'lib/conan/deployment.rb', line 48 def unique_name(app) "#{name(app)}-#{@randomid}" end |