capistrano-data_plane_api 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f09bc2341ac4e11146025f5ec2fb4dac89fe856ccfa94943487af17dcc63b5f5
4
- data.tar.gz: 20cf62b4bbce05fbc1fc9fe8fef6a85fb23ebcd121d5caa8783620a590eb336d
3
+ metadata.gz: 4961a264a98074e2df17ebcc7947f3060a0c531c112f428c8d96c88c4bc60327
4
+ data.tar.gz: 2c8bc55c5748e119e1b9d088b124380b744eeb602127bb54b4ad47a075e63bf1
5
5
  SHA512:
6
- metadata.gz: ba8c47106b3f124602eb6d6214cabc918c4aadc4cba6bd29b799453416d904b4dfb82f835fdd8eee64fabac28c55900f3dfe1c6987bdb53406801d7b8b6ff6b5
7
- data.tar.gz: df2302167edfec625fbe2edc5221187025255a24263e1c481f19d130713d20767fd11ec6979b06f9cd5a4f39fb92f56eb715ff4e14d12f960f6ef09ecd77e5c4
6
+ metadata.gz: d3280f16f6c65f1df0c46439bd1089950506382d2c0e5082a131549e7a9780ffd3e96ef462f0a3db6649c05f0006e7341c2dfa2c14b0bf44f221ae86a1c87f99
7
+ data.tar.gz: 4be8ebbe7e62c395b3774ffb292706da118217349b4edf36258bff6d34baf4b0a712ee4f4b4349ca306c78d8b30b176042ccf6020775ced7eba09c559c1473c2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capistrano-data_plane_api (0.1.0)
4
+ capistrano-data_plane_api (0.1.2)
5
5
  data_plane_api (~> 0.1)
6
6
  pastel (< 1)
7
7
  shale (< 1)
data/README.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # Capistrano::DataPlaneApi
2
2
 
3
- Capistrano plugin which helps you automatically change the admin state of your HAProxy servers.
3
+ [Capistrano](https://capistranorb.com/) plugin which helps you
4
+ automatically change the admin state of your [HAProxy](https://www.haproxy.com/)
5
+ servers using the [Data Plane API](https://www.haproxy.com/documentation/dataplaneapi/community/).
6
+
7
+ [Capistrano](https://capistranorb.com/) is a remote server automation and deployment tool.
8
+ [HAProxy](https://www.haproxy.com/) is a load balancer.
4
9
 
5
10
  ## Installation
6
11
 
@@ -32,7 +37,8 @@ $ bundle exec cap_data_plane_api install
32
37
 
33
38
  This gem hooks into capistrano to add new tasks which
34
39
  enable you to change the admin state of your HAProxy
35
- servers during the deployment process.
40
+ servers during the deployment process
41
+ using using the [Data Plane API](https://www.haproxy.com/documentation/dataplaneapi/community/).
36
42
 
37
43
  We recommend creating separate Capistrano stages
38
44
  for every HAProxy server.
@@ -100,10 +100,10 @@ module Capistrano
100
100
  nil
101
101
  end
102
102
 
103
- return unless server_states
103
+ return if server_states.nil?
104
104
 
105
105
  server_states.each do |server_state|
106
- @server_stats[server_state['name']]&.then do |s|
106
+ @server_stats[server_state['name']]&.tap do |s|
107
107
  s.admin_state = server_state['admin_state']
108
108
  s.operational_state = server_state['operational_state']
109
109
  end
@@ -34,6 +34,8 @@ module Capistrano
34
34
  @backend_name = backend_name
35
35
  @success = nil
36
36
  @seconds = nil
37
+ @admin_state = 'unknown'
38
+ @operational_state = 'unknown'
37
39
  end
38
40
 
39
41
  # @return [String]
@@ -6,6 +6,7 @@ module Capistrano
6
6
  module Helper
7
7
  # @return [Hash{String => Symbol}]
8
8
  ADMIN_STATE_COLORS = {
9
+ 'unknown' => :on_red,
9
10
  'drain' => :on_blue,
10
11
  'ready' => :on_green,
11
12
  'maint' => :on_yellow
@@ -13,6 +14,7 @@ module Capistrano
13
14
 
14
15
  # @return [Hash{String => Symbol}]
15
16
  OPERATIONAL_STATE_COLORS = {
17
+ 'unknown' => :on_red,
16
18
  'up' => :on_green,
17
19
  'down' => :on_red,
18
20
  'stopping' => :on_yellow
@@ -6,14 +6,14 @@ namespace :data_plane_api do
6
6
  namespace :server do
7
7
  desc "Set the server's admin state to DRAIN through the HAProxy Data Plane API"
8
8
  task :set_drain do
9
- next if no_haproxy?
9
+ next if ::Capistrano::DataPlaneApi.no_haproxy?
10
10
 
11
- ::Capistrano::DataPlaneApi.server_set_drain fetch(:stage), force: force_haproxy?
11
+ ::Capistrano::DataPlaneApi.server_set_drain fetch(:stage), force: ::Capistrano::DataPlaneApi.force_haproxy?
12
12
  end
13
13
 
14
14
  desc "Set the server's admin state to READY through the HAProxy Data Plane API"
15
15
  task :set_ready do
16
- next if no_haproxy?
16
+ next if ::Capistrano::DataPlaneApi.no_haproxy?
17
17
 
18
18
  sleep 3
19
19
  ::Capistrano::DataPlaneApi.server_set_ready fetch(:stage)
@@ -21,7 +21,7 @@ namespace :data_plane_api do
21
21
 
22
22
  desc "Set the server's admin state to MAINT through the HAProxy Data Plane API"
23
23
  task :set_maint do
24
- next if no_haproxy?
24
+ next if ::Capistrano::DataPlaneApi.no_haproxy?
25
25
 
26
26
  sleep 3
27
27
  ::Capistrano::DataPlaneApi.server_set_maint fetch(:stage), force: true
@@ -3,6 +3,6 @@
3
3
  module Capistrano
4
4
  module DataPlaneApi
5
5
  # @return [String]
6
- VERSION = '0.1.0'
6
+ VERSION = '0.1.2'
7
7
  end
8
8
  end
@@ -13,6 +13,7 @@ basic_password: my_password # Data Plane API BasicAuth password
13
13
 
14
14
  # List of HAProxy backends
15
15
  backends:
16
+
16
17
  - name: back_production # your HAProxy backend name
17
18
  # styles defined in the `Pastel` gem, used in the terminal to uniquely identify this backend
18
19
  # by coloring its name.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-data_plane_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mateusz Drewniak
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-12-29 00:00:00.000000000 Z
12
+ date: 2023-01-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: data_plane_api
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  - !ruby/object:Gem::Version
170
170
  version: '0'
171
171
  requirements: []
172
- rubygems_version: 3.4.1
172
+ rubygems_version: 3.4.3
173
173
  signing_key:
174
174
  specification_version: 4
175
175
  summary: Capistrano plugin which helps you automatically change the admin state of