bosh_openstack_cpi 1.2291.0 → 1.2311.0

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.
@@ -30,6 +30,8 @@ require "cloud/openstack/network"
30
30
  require "cloud/openstack/dynamic_network"
31
31
  require "cloud/openstack/manual_network"
32
32
  require "cloud/openstack/vip_network"
33
+ require "cloud/openstack/excon_logging_instrumentor"
34
+ require "cloud/openstack/redacted_params"
33
35
 
34
36
  module Bosh
35
37
  module Clouds
@@ -56,7 +56,7 @@ module Bosh::OpenStackCloud
56
56
  @openstack = Fog::Compute.new(openstack_params)
57
57
  rescue Exception => e
58
58
  @logger.error(e)
59
- cloud_error("Unable to connect to the OpenStack Compute API. Check task debug log for details.")
59
+ cloud_error("Unable to connect to the OpenStack Compute API. Check task debug log for details.")
60
60
  end
61
61
 
62
62
  glance_params = {
@@ -106,15 +106,15 @@ module Bosh::OpenStackCloud
106
106
  :container_format => cloud_properties["container_format"],
107
107
  :is_public => @stemcell_public_visibility.nil? ? false : @stemcell_public_visibility,
108
108
  }
109
-
109
+
110
110
  image_properties = {}
111
111
  vanilla_options = ["name", "version", "os_type", "os_distro", "architecture", "auto_disk_config"]
112
112
  vanilla_options.reject{ |o| cloud_properties[o].nil? }.each do |key|
113
113
  image_properties[key.to_sym] = cloud_properties[key]
114
- end
114
+ end
115
115
  image_params[:properties] = image_properties unless image_properties.empty?
116
-
117
- # If image_location is set in cloud properties, then pass the copy-from parm. Then Glance will fetch it
116
+
117
+ # If image_location is set in cloud properties, then pass the copy-from parm. Then Glance will fetch it
118
118
  # from the remote location on a background job and store it in its repository.
119
119
  # Otherwise, unpack image to temp directory and upload to Glance the root image.
120
120
  if cloud_properties["image_location"]
@@ -126,13 +126,13 @@ module Bosh::OpenStackCloud
126
126
  image_params[:location] = File.join(tmp_dir, "root.img")
127
127
  end
128
128
 
129
- # Upload image using Glance service
129
+ # Upload image using Glance service
130
130
  @logger.debug("Using image parms: `#{image_params.inspect}'")
131
131
  image = with_openstack { @glance.images.create(image_params) }
132
-
132
+
133
133
  @logger.info("Creating new image `#{image.id}'...")
134
134
  wait_resource(image, :active)
135
-
135
+
136
136
  image.id.to_s
137
137
  end
138
138
  rescue => e
@@ -330,7 +330,7 @@ module Bosh::OpenStackCloud
330
330
  compare_security_groups(server, network_configurator.security_groups(@default_security_groups))
331
331
 
332
332
  compare_private_ip_addresses(server, network_configurator.private_ip)
333
-
333
+
334
334
  network_configurator.configure(@openstack, server)
335
335
 
336
336
  update_agent_settings(server) do |settings|
@@ -461,7 +461,7 @@ module Bosh::OpenStackCloud
461
461
 
462
462
  devices = []
463
463
  volume.attachments.each { |attachment| devices << attachment["device"] unless attachment.empty? }
464
-
464
+
465
465
  description = [:deployment, :job, :index].collect { |key| metadata[key] }
466
466
  description << devices.first.split('/').last unless devices.empty?
467
467
  snapshot_params = {
@@ -613,12 +613,12 @@ module Bosh::OpenStackCloud
613
613
  end
614
614
 
615
615
  ##
616
- # Generates initial agent settings. These settings will be read by Bosh Agent from Bosh Registry on a target
616
+ # Generates initial agent settings. These settings will be read by Bosh Agent from Bosh Registry on a target
617
617
  # server. Disk conventions in Bosh Agent for OpenStack are:
618
618
  # - system disk: /dev/sda
619
619
  # - ephemeral disk: /dev/sdb
620
620
  # - persistent disks: /dev/sdc through /dev/sdz
621
- # As some kernels remap device names (from sd* to vd* or xvd*), Bosh Agent will lookup for the proper device name
621
+ # As some kernels remap device names (from sd* to vd* or xvd*), Bosh Agent will lookup for the proper device name
622
622
  #
623
623
  # @param [String] server_name Name of the OpenStack server (will be picked
624
624
  # up by agent to fetch registry settings)
@@ -692,13 +692,13 @@ module Bosh::OpenStackCloud
692
692
  volume_attachments = with_openstack { server.volume_attachments }
693
693
  device = volume_attachments.find { |a| a["volumeId"] == volume.id }
694
694
 
695
- if device.nil?
695
+ if device.nil?
696
696
  device_name = select_device_name(volume_attachments, first_device_name_letter(server))
697
697
  cloud_error("Server has too many disks attached") if device_name.nil?
698
698
 
699
699
  @logger.info("Attaching volume `#{volume.id}' to server `#{server.id}', device name is `#{device_name}'")
700
700
  with_openstack { volume.attach(server.id, device_name) }
701
- wait_resource(volume, :"in-use")
701
+ wait_resource(volume, :"in-use")
702
702
  else
703
703
  device_name = device["device"]
704
704
  @logger.info("Volume `#{volume.id}' is already attached to server `#{server.id}' in `#{device_name}'. Skipping.")
@@ -715,7 +715,7 @@ module Bosh::OpenStackCloud
715
715
  # @return [String] First available device name or nil is none is available
716
716
  def select_device_name(volume_attachments, first_device_name_letter)
717
717
  (first_device_name_letter.."z").each do |char|
718
- # Some kernels remap device names (from sd* to vd* or xvd*).
718
+ # Some kernels remap device names (from sd* to vd* or xvd*).
719
719
  device_names = ["/dev/sd#{char}", "/dev/vd#{char}", "/dev/xvd#{char}"]
720
720
  # Bosh Agent will lookup for the proper device name if we set it initially to sd*.
721
721
  return "/dev/sd#{char}" if volume_attachments.select { |v| device_names.include?( v["device"]) }.empty?
@@ -765,7 +765,7 @@ module Bosh::OpenStackCloud
765
765
  # @param [Fog::Compute::OpenStack::Server] server OpenStack server
766
766
  # @param [Array] specified_sg_names Security groups specified at the network spec
767
767
  # @return [void]
768
- # @raise [Bosh::Clouds:NotSupported] If the security groups change, we need to recreate the VM as you can't
768
+ # @raise [Bosh::Clouds:NotSupported] If the security groups change, we need to recreate the VM as you can't
769
769
  # change the security group of a running server, so we need to send the InstanceUpdater a request to do it for us
770
770
  def compare_security_groups(server, specified_sg_names)
771
771
  actual_sg_names = with_openstack { server.security_groups }.collect { |sg| sg.name }
@@ -783,7 +783,7 @@ module Bosh::OpenStackCloud
783
783
  # @param [Fog::Compute::OpenStack::Server] server OpenStack server
784
784
  # @param [String] specified_ip_address IP address specified at the network spec (if Manual network)
785
785
  # @return [void]
786
- # @raise [Bosh::Clouds:NotSupported] If the IP address change, we need to recreate the VM as you can't
786
+ # @raise [Bosh::Clouds:NotSupported] If the IP address change, we need to recreate the VM as you can't
787
787
  # change the IP address of a running server, so we need to send the InstanceUpdater a request to do it for us
788
788
  def compare_private_ip_addresses(server, specified_ip_address)
789
789
  actual_ip_addresses = with_openstack { server.private_ip_addresses }
@@ -0,0 +1,11 @@
1
+ module Bosh::OpenStackCloud
2
+ class ExconLoggingInstrumentor
3
+ def self.instrument(name, params = {}, &block)
4
+ params = Bosh::OpenStackCloud::RedactedParams.new(params)
5
+ Bosh::Clouds::Config.logger.debug("#{name} #{params}")
6
+ if block_given?
7
+ yield
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,29 @@
1
+ module Bosh::OpenStackCloud
2
+ class RedactedParams
3
+ REDACTED = "[REDACTED]"
4
+
5
+ def initialize(params)
6
+ @params = params
7
+ redact_authorization_params
8
+ redact_password_params
9
+ end
10
+
11
+ def to_s
12
+ @params.inspect
13
+ end
14
+
15
+ private
16
+
17
+ def redact_authorization_params
18
+ if @params.has_key?(:headers) && @params[:headers].has_key?('Authorization')
19
+ @params[:headers]['Authorization'] = REDACTED
20
+ end
21
+ end
22
+
23
+ def redact_password_params
24
+ if @params.has_key?(:password)
25
+ @params[:password] = REDACTED
26
+ end
27
+ end
28
+ end
29
+ end
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Bosh
5
5
  module OpenStackCloud
6
- VERSION = '1.2291.0'
6
+ VERSION = '1.2311.0'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh_openstack_cpi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2291.0
4
+ version: 1.2311.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-26 00:00:00.000000000 Z
12
+ date: 2014-03-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: 1.2291.0
37
+ version: 1.2311.0
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: 1.2291.0
45
+ version: 1.2311.0
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: bosh_cpi
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: 1.2291.0
53
+ version: 1.2311.0
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 1.2291.0
61
+ version: 1.2311.0
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: bosh-registry
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: 1.2291.0
69
+ version: 1.2311.0
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,7 +74,7 @@ dependencies:
74
74
  requirements:
75
75
  - - ~>
76
76
  - !ruby/object:Gem::Version
77
- version: 1.2291.0
77
+ version: 1.2311.0
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: httpclient
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: 0.8.2
110
110
  description: ! 'BOSH OpenStack CPI
111
111
 
112
- 51a1bb'
112
+ 7df356'
113
113
  email: support@cloudfoundry.com
114
114
  executables:
115
115
  - bosh_openstack_console
@@ -121,10 +121,12 @@ files:
121
121
  - lib/cloud/openstack.rb
122
122
  - lib/cloud/openstack/cloud.rb
123
123
  - lib/cloud/openstack/dynamic_network.rb
124
+ - lib/cloud/openstack/excon_logging_instrumentor.rb
124
125
  - lib/cloud/openstack/helpers.rb
125
126
  - lib/cloud/openstack/manual_network.rb
126
127
  - lib/cloud/openstack/network.rb
127
128
  - lib/cloud/openstack/network_configurator.rb
129
+ - lib/cloud/openstack/redacted_params.rb
128
130
  - lib/cloud/openstack/tag_manager.rb
129
131
  - lib/cloud/openstack/version.rb
130
132
  - lib/cloud/openstack/vip_network.rb
@@ -151,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
153
  version: '0'
152
154
  segments:
153
155
  - 0
154
- hash: -1037434515704413152
156
+ hash: -1396145754885881155
155
157
  requirements: []
156
158
  rubyforge_project:
157
159
  rubygems_version: 1.8.23