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_name(app) ⇒ Object
- #apps(*app_ids) ⇒ Object
- #dns_name(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
72 73 74 |
# File 'lib/conan/deployment.rb', line 72 def active_smoke_test_url(app) "http://#{dns_name(app)}/#{@custom_smoke_test_path || 'status/healthcheck'}" end |
#active_urls(app) ⇒ Object
60 61 62 |
# File 'lib/conan/deployment.rb', line 60 def active_urls(app) [ dns_name(app), agnostic_dns_name(app) ] + @additional_mappings end |
#agnostic_dns_name(app) ⇒ Object
56 57 58 |
# File 'lib/conan/deployment.rb', line 56 def agnostic_dns_name(app) "#{@environment.id}-#{app.url_segment}.mtnsat.io" 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
52 53 54 |
# File 'lib/conan/deployment.rb', line 52 def dns_name(app) "#{@environment.id}-#{app.url_segment}.#{@ship}.#{@org}.mtnsatcloud.com" 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
76 77 78 |
# File 'lib/conan/deployment.rb', line 76 def inactive_smoke_test_url(app) "http://x.#{dns_name(app)}/#{@custom_smoke_test_path || 'status/healthcheck'}" end |
#inactive_urls(app) ⇒ Object
64 65 66 |
# File 'lib/conan/deployment.rb', line 64 def inactive_urls(app) active_urls(app).map{ |url| "x.#{url}" } end |
#manifest_url(app) ⇒ Object
68 69 70 |
# File 'lib/conan/deployment.rb', line 68 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
80 81 82 |
# File 'lib/conan/deployment.rb', line 80 def paas_target "https://api.paasv2.#{@ship}.#{@org}.mtnsatcloud.com" end |
#smoke_test_path(path = nil) ⇒ Object
88 89 90 |
# File 'lib/conan/deployment.rb', line 88 def smoke_test_path(path=nil) @custom_smoke_test_path = path end |
#to_s ⇒ Object
84 85 86 |
# File 'lib/conan/deployment.rb', line 84 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 |