pcf_blue_green 0.32 → 0.33

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: 8adcf8eeaa5e7d24dada0ee75e1700c28673db84
4
- data.tar.gz: 0b64fa9c0e835cde3a9a64519c6259dafa8cc810
3
+ metadata.gz: 0a4f4f1981b3ac479f39115d0e3578dedc5664aa
4
+ data.tar.gz: 5bcc132d664993edec39483667b5d2007bac015e
5
5
  SHA512:
6
- metadata.gz: 4559b483bf50ddb99c7d051f822a9bcb85fa03e10ff0d164b2afc8eeaa1bdaf386c1698c76b05e5754cf8a367d14ccd7ac81b270bdb32f79a17c6993c3d40e46
7
- data.tar.gz: 6cda3ffb2f288100e56a4e77ea53346b46a2cfe7e0d936298bff69a91fce84f4c1f56a506fabbd40254c2cc73b0a2ff0d58b5254a7a55bd3b98a3fafcaf4f564
6
+ metadata.gz: e569d397e4a7af8c782ee8415f20b1b0a51bdea1c1b5c20e552dd58600ed27f2f98b4d37abb6ef703dd19c2ef21413e2930328f12456398ec9a6e509c36e8eaf
7
+ data.tar.gz: a2c71b0849421aa4f3890d1652d04771ebe43b60e596839eca2aeb01bbbdab1c18771072f2aa8342528b9a794b930b309bd9b45cd7d54273e7b3fd1a87865bd5
@@ -22,6 +22,12 @@ module PcfBlueGreen
22
22
  @space = space
23
23
  @login_options = @options[:login]
24
24
  login if call_login
25
+ cmd = "echo $(gem which pcf_blue_green)"
26
+ shell = Mixlib::ShellOut.new(cmd)
27
+ shell.run_command
28
+ gem_path = shell.stdout
29
+ sdf_path = gem_path.gsub("pcf_blue_green.rb\n", "shared-deploy-functions.sh")
30
+ @source_cmd = "source \'#{sdf_path}\'"
25
31
  end
26
32
 
27
33
  def cleanup_blue
@@ -36,11 +42,11 @@ module PcfBlueGreen
36
42
  puts "cf_app is #{ENV['cf_app']}"
37
43
  puts "green is #{ENV['green']}"
38
44
 
39
- puts cf_routes_output
40
45
  mapped_routes = []
41
46
 
42
47
  if ENV['handle_all_paths']
43
48
  cmd = "#{cf_routes_output} | tail -n +4 | awk '($5==ENVIRON[\"cf_app\"]) {print $3\" -n \"$2 \" --path \"substr($4,2) }' | xargs -n 5 #{map_route_command} #{ENV['green']}"
49
+ puts cmd
44
50
  shell = Mixlib::ShellOut.new(cmd)
45
51
  shell.run_command
46
52
  unless shell.stderr.empty?
@@ -50,6 +56,7 @@ module PcfBlueGreen
50
56
  mapped_routes += shell.stdout.split("\n")
51
57
  end
52
58
  cmd = "#{cf_routes_output} | tail -n +4 | awk '($4==ENVIRON[\"cf_app\"]) {print $3\" -n \" $2}' | xargs -n 3 #{map_route_command} #{ENV['green']}"
59
+ puts cmd
53
60
  shell = Mixlib::ShellOut.new(cmd)
54
61
  shell.run_command
55
62
  unless shell.stderr.empty?
@@ -57,8 +64,8 @@ module PcfBlueGreen
57
64
  raise PcfBlueGreen::CleanupBlueFailed
58
65
  end
59
66
  mapped_routes += shell.stdout.split("\n")
60
-
61
- mapped_routes
67
+ puts "Mappped routes: #{mapped_routes.uniq.join(', ')} "
68
+ mapped_routes.uniq.join(",\n")
62
69
  end
63
70
 
64
71
  private
@@ -1,3 +1,3 @@
1
1
  module PcfBlueGreen
2
- VERSION = "0.32"
2
+ VERSION = "0.33"
3
3
  end
@@ -31,7 +31,7 @@ describe PcfBlueGreen do
31
31
  @pcf_blue_green = PcfBlueGreen::Routing.new(api_url, username, password, org, space, login = false)
32
32
  @pcf_blue_green.stub(:cf_routes_output).and_return('cat spec/mocks/simple_routes.txt')
33
33
  @pcf_blue_green.stub(:map_route_command).and_return('echo')
34
- expect(expected_routes).to eq(@pcf_blue_green.remap_routes.uniq.join(",\n"))
34
+ expect(expected_routes).to eq(@pcf_blue_green.remap_routes)
35
35
  end
36
36
 
37
37
  it "it doesn't re-map routes with a path. Also doesn't re-map routes for other applications. Even with the same hostname" do
@@ -60,7 +60,7 @@ customapp-app-space-green apps.prod.domain.com -n otherapp}
60
60
  @pcf_blue_green = PcfBlueGreen::Routing.new(api_url, username, password, org, space, login = false)
61
61
  @pcf_blue_green.stub(:cf_routes_output).and_return('cat spec/mocks/custom_routes.txt')
62
62
  @pcf_blue_green.stub(:map_route_command).and_return('echo')
63
- expect(expected_routes).to eq(@pcf_blue_green.remap_routes.uniq.join(",\n"))
63
+ expect(expected_routes).to eq(@pcf_blue_green.remap_routes)
64
64
  end
65
65
  end
66
66
 
@@ -95,7 +95,7 @@ customapp-app-space-green apps.prod.domain.com -n otherapp}
95
95
  @pcf_blue_green = PcfBlueGreen::Routing.new(api_url, username, password, org, space, login = false)
96
96
  @pcf_blue_green.stub(:cf_routes_output).and_return('cat spec/mocks/custom_routes.txt')
97
97
  @pcf_blue_green.stub(:map_route_command).and_return('echo')
98
- expect(expected_routes).to eq(@pcf_blue_green.remap_routes.uniq.join(",\n"))
98
+ expect(expected_routes).to eq(@pcf_blue_green.remap_routes)
99
99
  end
100
100
  it "re-maps application routes including paths" do
101
101
 
@@ -129,7 +129,7 @@ second-app-app-space-green apps.prod.domain.com.com -n second-app}
129
129
  @pcf_blue_green = PcfBlueGreen::Routing.new(api_url, username, password, org, space, login = false)
130
130
  @pcf_blue_green.stub(:cf_routes_output).and_return('cat spec/mocks/custom_routes_domain_host.txt')
131
131
  @pcf_blue_green.stub(:map_route_command).and_return('echo')
132
- expect(expected_routes).to eq(@pcf_blue_green.remap_routes.uniq.join(",\n"))
132
+ expect(expected_routes).to eq(@pcf_blue_green.remap_routes)
133
133
  end
134
134
 
135
135
  it "re-maps application routes including paths. Also true for custom domain and host" do
@@ -160,7 +160,7 @@ third-app-app-space-green apps.prod.otherdomain.com -n third-app-other-host}
160
160
  @pcf_blue_green = PcfBlueGreen::Routing.new(api_url, username, password, org, space, login = false)
161
161
  @pcf_blue_green.stub(:cf_routes_output).and_return('cat spec/mocks/custom_routes_domain_host.txt')
162
162
  @pcf_blue_green.stub(:map_route_command).and_return('echo')
163
- expect(expected_routes).to eq(@pcf_blue_green.remap_routes.uniq.join(",\n"))
163
+ expect(expected_routes).to eq(@pcf_blue_green.remap_routes)
164
164
  end
165
165
  end
166
166
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pcf_blue_green
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.32'
4
+ version: '0.33'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pawel Bardzinski