pcf_blue_green 0.27 → 0.28

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e7d3e5b1c7a229ff7dcce2289072e1b509bb169
4
- data.tar.gz: 1f233c982995aea7b941f14b4be4c5de662a8672
3
+ metadata.gz: 327efdf015700c02e2eb763f3c9615f1446efd75
4
+ data.tar.gz: 7fd129d6e8b35938a45a88e6d1a4ed28d74389f8
5
5
  SHA512:
6
- metadata.gz: 3bcf15f653a4b4852afa21d1bf42298ea4b50cba9367f252830149260e0715565a467ec9fc0596b4ac9af46ca7483579d0f7d7888f1926fcf70bb307353d32d3
7
- data.tar.gz: 84def66c6415626b510308a80c4c63831006e466fe053a606f9057451f3710b71932ac2a1f73397a95e72e7e13f9f131cb188e39ba9403cb34eaef7143f49ba0
6
+ metadata.gz: d6a80d063f348fa1c300854bea0bb5b25ea01d5f1bc587cf170e3df03a640a3e03273ec5ef4bec733b065b0c9b707cf0eb329a8c3f7455b385e03871fce573fe
7
+ data.tar.gz: d5b2b8a3ac2718ddc10a05c36c153b752e7b87571b23a6f24c3bdb71d591711b9c8aa6ccb6321dc1250c3c4413af49764a8171331527a4be503e33dea262c8d5
@@ -1,3 +1,3 @@
1
1
  module PcfBlueGreen
2
- VERSION = "0.27"
2
+ VERSION = "0.28"
3
3
  end
@@ -132,37 +132,44 @@ function remap-routes {
132
132
  set -x
133
133
  run-cmd cf routes
134
134
 
135
- if [ -z ${sso_hostname+x} ] && [ -z ${handle_all_green_paths+x} ]; then
135
+ # Variables used:
136
+
137
+ # Some applications have extra routes that contain paths. If that's the case
138
+ # then handle_all_green_paths environmental variable is used to manage paths.
139
+ # to a different hostname
140
+
141
+ # Code logic:
142
+
143
+ # execute the code below:
144
+ if [ -z ${handle_all_green_paths+x} ]; then
136
145
  run-cmd cf routes | tail -n +4 | grep ${cf_app} | awk '{print $3" -n "$2}'
137
146
  cf routes | tail -n +4 | grep ${cf_app} | awk '{print $3" -n "$2}' | xargs -n 3 cf map-route ${green}
138
147
  fi
139
-
140
- if [ -n "$sso_hostname" ]; then
141
- run-cmd cf routes | tail -n +4 | awk '($2==ENVIRON["sso_hostname"]) && ($5==ENVIRON["cf_app"]) {print $3" -n "$2 " --path "substr($4,2) }'
142
- cf routes | tail -n +4 | awk '($2==ENVIRON["sso_hostname"]) && ($5==ENVIRON["cf_app"]) {print $3" -n "$2 " --path "substr($4,2) }' | xargs -n 5 cf map-route ${green}
143
- fi
144
148
 
149
+ # if map_main_route environmental variable is set then the main route gets mapped:
145
150
  if [ -n "$map_main_route" ]; then
146
- run-cmd cf routes | tail -n +4 | awk '($3==ENVIRON["domain"]) && ($2==ENVIRON["cf_app"]) {print $3" -n " $2 }' | xargs -n 3 cf map-route ${green}
151
+ run-cmd cf routes | awk '($4==ENVIRON["cf_app"]) {print $3" -n " $2 }' | xargs -n 3 cf map-route ${green}
147
152
  fi
148
153
 
154
+ # if handle_all_green_paths variable is set then
155
+ # 1. routes that's app name is cf_app are found
156
+ # 2. paths are mapped to the green app
149
157
  if [ -n "$handle_all_green_paths" ]; then
150
158
  run-cmd cf routes | tail -n +4 | awk '($5==ENVIRON["cf_app"]) {print $3" -n "$2 " --path "substr($4,2) }'
151
159
  cf routes | tail -n +4 | awk '($5==ENVIRON["cf_app"]) {print $3" -n "$2 " --path "substr($4,2) }' | xargs -n 5 cf map-route ${green}
152
160
  fi
153
-
154
-
155
161
  set +x
156
162
  }
157
163
 
158
164
  function remove-blue {
159
165
  run-cmd cf delete ${blue} -f
160
166
  run-cmd cf rename $green $blue
161
- run-cmd cf delete-route $domain -n $green -f
162
- if [ -n "$sso_hostname" ] || [ -n "$handle_all_green_paths" ]; then
167
+ run-cmd cf routes | awk '($4==ENVIRON["green"]) {print $3" -n " $2 " -f"}' | xargs -n 4 cf delete-route
168
+
169
+ if [ -n "$handle_all_green_paths" ]; then
163
170
  set -x
164
- run-cmd cf routes | tail -n +4 | awk '($2==ENVIRON["green"]) && $4 {print $3" -n "$2 " --path "substr($4,2)" -f"}' | xargs -n 6
165
- cf routes | tail -n +4 | awk '($2==ENVIRON["green"]) && $4 {print $3" -n "$2 " --path "substr($4,2)" -f"}' | xargs -n 6 cf delete-route
171
+ run-cmd cf routes | tail -n +4 | awk '($5==ENVIRON["green"]) {print $3" -n "$2 " --path "substr($4,2)" -f"}' | xargs -n 6
172
+ cf routes | tail -n +4 | awk '($5==ENVIRON["green"]) {print $3" -n "$2 " --path "substr($4,2)" -f"}' | xargs -n 6 cf delete-route
166
173
  set +x
167
174
  fi
168
175
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pcf_blue_green
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.27'
4
+ version: '0.28'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pawel Bardzinski
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-15 00:00:00.000000000 Z
11
+ date: 2017-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout