Skip to content

Commit

Permalink
(#12135) Fix profileclientssl initialization.
Browse files Browse the repository at this point in the history
Originally the implimentation alias an f5 icontrol internal API. This
causes an issue on compilation on the puppet master because it attempts
to initialize f5 device when it has no connectivity information.
  • Loading branch information
nanliu committed Jan 30, 2012
1 parent c91001e commit 3d6c028
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 20 deletions.
3 changes: 2 additions & 1 deletion lib/puppet/provider/f5.rb
Expand Up @@ -32,8 +32,9 @@ def self.transport
@device ||= Puppet::Util::NetworkDevice::F5::Device.new(Facter.value(:url))
else
@device ||= Puppet::Util::NetworkDevice.current
raise Puppet::Error, "Puppet::Util::NetworkDevice::F5: device not initialized." unless @device
raise Puppet::Error, "Puppet::Util::NetworkDevice::F5: device not initialized #{caller.join("\n")}" unless @device
end

@tranport = @device.transport
end

Expand Down
1 change: 0 additions & 1 deletion lib/puppet/provider/f5_certificate/f5_certificate.rb
@@ -1,5 +1,4 @@
require 'puppet/provider/f5'
require 'puppet/util/network_device/f5'

Puppet::Type.type(:f5_certificate).provide(:f5_certificate, :parent => Puppet::Provider::F5 ) do
@doc = "Manages f5 certificates"
Expand Down
1 change: 0 additions & 1 deletion lib/puppet/provider/f5_key/f5_key.rb
@@ -1,5 +1,4 @@
require 'puppet/provider/f5'
require 'puppet/util/network_device/f5'

Puppet::Type.type(:f5_key).provide(:f5_key, :parent => Puppet::Provider::F5) do
@doc = "Manages f5 cert"
Expand Down
33 changes: 20 additions & 13 deletions lib/puppet/provider/f5_profileclientssl/f5_profileclientssl.rb
@@ -1,7 +1,7 @@
require 'puppet/provider/f5'

Puppet::Type.type(:f5_profileclientssl).provide(:f5_profileclientssl, :parent => Puppet::Provider::F5) do
@doc = "Manages f5 device"
@doc = "Manages f5 device clientssl profile"

confine :feature => :posix
defaultfor :feature => :posix
Expand Down Expand Up @@ -37,30 +37,37 @@ def self.instances
end
end

methods = [
'certificate_file',
'key_file',
'ca_file',
'client_certificate_ca_file',
]

methods.each do |method|
define_method("#{method}=") do |profile_string|
if transport[wsdl].respond_to?("set_#{method}".to_sym)
transport[wsdl].send("set_#{method}",
resource[:name],
[:value => profile_string["value"],
:default_flag => profile_string["default_flag"]])
transport[wsdl].send("set_#{method}", resource[:name],
[ :value => profile_string["value"],
:default_flag => profile_string["default_flag"] ])
end
end
end

# Aliases for API inconsistencies
class << transport[wsdl]
alias_method :set_peer_certification_mode, :set_peer_certificate_mode
def peer_certification_mode=(value)
transport[wsdl].set_peer_certificate_mode( resource[:name],
[ :value => resource[:peer_certification_mode]["value"],
:default_flag => resource[:peer_certification_mode]["default_flag"] ])
end

def create
Puppet.debug("Puppet::Provider::F5_ProfileClientSSL: creating F5 client ssl profile #{resource[:name]}")

transport[wsdl].create([resource[:name]],
[:value => resource[:key_file]["value"],
:default_flag => resource[:key_file]["default_flag"]],
[:value => resource[:certificate_file]["value"],
:default_flag => resource[:certificate_file]["default_flag"]])
transport[wsdl].create([ resource[:name]],
[ :value => resource[:key_file]["value"] ,
:default_flag => resource[:key_file]["default_flag"] ],
[ :value => resource[:certificate_file]["value"] ,
:default_flag => resource[:certificate_file]["default_flag"] ])

# It's not clear to me the difference between these two. We've been
# setting them to be the same thing.
Expand Down
2 changes: 0 additions & 2 deletions lib/puppet/type/f5_certificate.rb
@@ -1,5 +1,3 @@
require 'puppet/util/network_device/f5'

Puppet::Type.newtype(:f5_certificate) do
@doc = "Manage F5 certificate."

Expand Down
2 changes: 0 additions & 2 deletions lib/puppet/type/f5_key.rb
@@ -1,5 +1,3 @@
require 'puppet/util/network_device/f5'

Puppet::Type.newtype(:f5_key) do
@doc = "Manage F5 key."

Expand Down

0 comments on commit 3d6c028

Please sign in to comment.