Class: Capistrano::DataPlaneApi::Deploy::ServerStats
- Inherits:
-
Object
- Object
- Capistrano::DataPlaneApi::Deploy::ServerStats
- Defined in:
- lib/capistrano/data_plane_api/deploy/server_stats.rb
Overview
Represents the stats of a deployment to a particular server
Instance Attribute Summary collapse
- #admin_state ⇒ String?
- #backend_name ⇒ String
- #end_time ⇒ Time?
- #operational_state ⇒ String?
- #server_name ⇒ String
- #start_time ⇒ Time?
-
#success ⇒ Boolean?
‘nil` when the deployment hasn’t begun ‘true` when it has finished successfully, `false` when it has failed.
Instance Method Summary collapse
-
#initialize(server_name, backend_name) ⇒ ServerStats
constructor
A new instance of ServerStats.
-
#seconds ⇒ Integer?
How much time has the deployment taken.
- #to_s ⇒ String
Constructor Details
#initialize(server_name, backend_name) ⇒ ServerStats
Returns a new instance of ServerStats.
32 33 34 35 36 37 38 39 |
# File 'lib/capistrano/data_plane_api/deploy/server_stats.rb', line 32 def initialize(server_name, backend_name) @server_name = server_name @backend_name = backend_name @success = nil @seconds = nil @admin_state = 'unknown' @operational_state = 'unknown' end |
Instance Attribute Details
#admin_state ⇒ String?
25 26 27 |
# File 'lib/capistrano/data_plane_api/deploy/server_stats.rb', line 25 def admin_state @admin_state end |
#backend_name ⇒ String
22 23 24 |
# File 'lib/capistrano/data_plane_api/deploy/server_stats.rb', line 22 def backend_name @backend_name end |
#end_time ⇒ Time?
16 17 18 |
# File 'lib/capistrano/data_plane_api/deploy/server_stats.rb', line 16 def end_time @end_time end |
#operational_state ⇒ String?
28 29 30 |
# File 'lib/capistrano/data_plane_api/deploy/server_stats.rb', line 28 def operational_state @operational_state end |
#server_name ⇒ String
19 20 21 |
# File 'lib/capistrano/data_plane_api/deploy/server_stats.rb', line 19 def server_name @server_name end |
#start_time ⇒ Time?
13 14 15 |
# File 'lib/capistrano/data_plane_api/deploy/server_stats.rb', line 13 def start_time @start_time end |
#success ⇒ Boolean?
Returns ‘nil` when the deployment hasn’t begun ‘true` when it has finished successfully, `false` when it has failed.
10 11 12 |
# File 'lib/capistrano/data_plane_api/deploy/server_stats.rb', line 10 def success @success end |
Instance Method Details
#seconds ⇒ Integer?
Returns How much time has the deployment taken.
54 55 56 |
# File 'lib/capistrano/data_plane_api/deploy/server_stats.rb', line 54 def seconds @seconds ||= Helper.seconds_since(@start_time, to: @end_time) end |
#to_s ⇒ String
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/capistrano/data_plane_api/deploy/server_stats.rb', line 42 def to_s time_string = case @success when nil then 'skipped' when false then "failed after #{Helper.humanize_time(seconds)}" when true then "took #{Helper.humanize_time(seconds)}" end " #{state_emoji} #{server_title} #{time_string}#{haproxy_states}" end |