Class: Deployment
- Inherits:
-
HasOptions
- Object
- HasOptions
- Deployment
- Defined in:
- lib/conan/deployment.rb
Constant Summary collapse
- @@paas_domain =
'mtnsatcloud.com'
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
- #alternative_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.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/conan/deployment.rb', line 8 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.
6 7 8 |
# File 'lib/conan/deployment.rb', line 6 def additional_mappings @additional_mappings end |
#app_ids ⇒ Object
Returns the value of attribute app_ids.
6 7 8 |
# File 'lib/conan/deployment.rb', line 6 def app_ids @app_ids end |
#custom_smoke_test_path ⇒ Object
Returns the value of attribute custom_smoke_test_path.
6 7 8 |
# File 'lib/conan/deployment.rb', line 6 def custom_smoke_test_path @custom_smoke_test_path end |
#environment ⇒ Object
Returns the value of attribute environment.
6 7 8 |
# File 'lib/conan/deployment.rb', line 6 def environment @environment end |
#facility_id ⇒ Object
Returns the value of attribute facility_id.
6 7 8 |
# File 'lib/conan/deployment.rb', line 6 def facility_id @facility_id end |
#org ⇒ Object
Returns the value of attribute org.
6 7 8 |
# File 'lib/conan/deployment.rb', line 6 def org @org end |
#ship ⇒ Object
Returns the value of attribute ship.
6 7 8 |
# File 'lib/conan/deployment.rb', line 6 def ship @ship end |
#shipcloud ⇒ Object
Returns the value of attribute shipcloud.
6 7 8 |
# File 'lib/conan/deployment.rb', line 6 def shipcloud @shipcloud end |
Instance Method Details
#active_smoke_test_url(app) ⇒ Object
78 79 80 |
# File 'lib/conan/deployment.rb', line 78 def active_smoke_test_url(app) "http://#{dns_name(app)}/#{@custom_smoke_test_path || 'status/healthcheck'}" end |
#active_urls(app) ⇒ Object
66 67 68 |
# File 'lib/conan/deployment.rb', line 66 def active_urls(app) [ dns_name(app), agnostic_dns_name(app), alternative_agnostic_dns_name(app) ] + @additional_mappings end |
#agnostic_dns_name(app) ⇒ Object
58 59 60 |
# File 'lib/conan/deployment.rb', line 58 def agnostic_dns_name(app) "#{@environment.id}.#{app.url_segment}.#{@@paas_domain}" end |
#alternative_agnostic_dns_name(app) ⇒ Object
62 63 64 |
# File 'lib/conan/deployment.rb', line 62 def alternative_agnostic_dns_name(app) "#{@environment.id}.#{app.url_segment}.mtnsat.io" end |
#apps(*app_ids) ⇒ Object
24 25 26 |
# File 'lib/conan/deployment.rb', line 24 def apps(*app_ids) @app_ids = app_ids end |
#dns_name(app) ⇒ Object
54 55 56 |
# File 'lib/conan/deployment.rb', line 54 def dns_name(app) "#{@environment.id}.#{app.url_segment}.#{@ship}.#{@org}.#{@@paas_domain}" end |
#enabled(b) ⇒ Object
38 39 40 |
# File 'lib/conan/deployment.rb', line 38 def enabled(b) @enabled = b end |
#enabled? ⇒ Boolean
42 43 44 |
# File 'lib/conan/deployment.rb', line 42 def enabled? @enabled end |
#facility(facility_id) ⇒ Object
28 29 30 |
# File 'lib/conan/deployment.rb', line 28 def facility(facility_id) @facility_id = facility_id end |
#hostnames(*hostnames) ⇒ Object
32 33 34 35 36 |
# File 'lib/conan/deployment.rb', line 32 def hostnames(*hostnames) hostnames.each do |hostname| @additional_mappings.push(hostname) unless hostname.empty? end end |
#inactive_smoke_test_url(app) ⇒ Object
82 83 84 |
# File 'lib/conan/deployment.rb', line 82 def inactive_smoke_test_url(app) "http://x.#{dns_name(app)}/#{@custom_smoke_test_path || 'status/healthcheck'}" end |
#inactive_urls(app) ⇒ Object
70 71 72 |
# File 'lib/conan/deployment.rb', line 70 def inactive_urls(app) active_urls(app).map{ |url| "x.#{url}" } end |
#manifest_url(app) ⇒ Object
74 75 76 |
# File 'lib/conan/deployment.rb', line 74 def manifest_url(app) "http://#{dns_name(app)}/status/manifest" end |
#name(app) ⇒ Object
46 47 48 |
# File 'lib/conan/deployment.rb', line 46 def name(app) "#{app.id}-#{@environment.id}-#{@ship}" end |
#paas_target ⇒ Object
86 87 88 |
# File 'lib/conan/deployment.rb', line 86 def paas_target "https://api.paas.#{@ship}.#{@org}.#{@@paas_domain}" end |
#smoke_test_path(path = nil) ⇒ Object
94 95 96 |
# File 'lib/conan/deployment.rb', line 94 def smoke_test_path(path=nil) @custom_smoke_test_path = path end |
#to_s ⇒ Object
90 91 92 |
# File 'lib/conan/deployment.rb', line 90 def to_s "#{org}-#{ship}" end |
#unique_name(app) ⇒ Object
50 51 52 |
# File 'lib/conan/deployment.rb', line 50 def unique_name(app) "#{name(app)}-#{@randomid}" end |