Permalink
Browse files

(#11523) Support partitions in define f5::config

Since we added partition support for f5, the define type f5::config have
been updated to support this option as well. The value defaults to
'Common' partition.
  • Loading branch information...
1 parent 741b780 commit da0df7e1d9e7519eba3f8b7546bd045cbd96405c Nan Liu committed Dec 27, 2011
Showing with 47 additions and 5 deletions.
  1. +6 −4 manifests/config.pp
  2. +40 −0 spec/defines/config.rb
  3. 0 spec/site.pp
  4. +1 −1 templates/config.erb
View
@@ -17,16 +17,18 @@
# Sample Usage:
#
# f5::config { 'bigip':
-# username => 'admin',
-# password => 'password',
-# url => 'f5.puppetlabs.lan',
-# target => '/etc/puppetlabs/puppet/device/bigip.conf
+# username => 'admin',
+# password => 'password',
+# url => 'f5.puppetlabs.lan',
+# partition => 'Common',
+# target => '/etc/puppetlabs/puppet/device/bigip.conf
# }
#
define f5::config(
$username = 'admin',
$password,
$url,
+ $partition = 'Common',
$target
) {
View
@@ -0,0 +1,40 @@
+require 'puppet'
+require 'rubygems'
+require 'rspec-puppet'
+
+RSpec.configure do |c|
+ c.module_path = Puppet[:modulepath]
+ c.manifest = File.join(File.dirname(__FILE__), '../site.pp')
+end
+
+describe 'f5::config', :type => :define do
+ let(:title) { 'f5.puppetlabs.lan' }
+ let(:params) {
+ { 'password' => 'password',
+ 'url' => 'f5.puppetlabs.lan',
+ 'target' => '/etc/puppetlabs/puppet/f5.puppetlabs.lan.conf',
+ }
+ }
+
+ it 'should generate a configuration file' do
+ should contain_file('/etc/puppetlabs/puppet/f5.puppetlabs.lan.conf').with_ensure("present")
+ should contain_file('/etc/puppetlabs/puppet/f5.puppetlabs.lan.conf').with_content("[f5.puppetlabs.lan]\ntype f5\nurl https://admin:password@f5.puppetlabs.lan/Common\n")
+ end
+end
+
+describe 'f5::config', :type => :define do
+ let(:title) { 'f5dev.puppetlabs.lan' }
+ let(:params) {
+ { 'username' => 'developer',
+ 'password' => 'devpwd',
+ 'url' => 'f5dev.puppetlabs.lan',
+ 'partition' => 'dev',
+ 'target' => '/etc/puppetlabs/puppet/f5dev.puppetlabs.lan.conf',
+ }
+ }
+
+ it 'should generate a configuration file' do
+ should contain_file('/etc/puppetlabs/puppet/f5dev.puppetlabs.lan.conf').with_ensure("present")
+ should contain_file('/etc/puppetlabs/puppet/f5dev.puppetlabs.lan.conf').with_content("[f5dev.puppetlabs.lan]\ntype f5\nurl https://developer:devpwd@f5dev.puppetlabs.lan/dev\n")
+ end
+end
View
No changes.
View
@@ -1,3 +1,3 @@
[<%= name %>]
type f5
-url https://<%= username %>:<%= password %>@<%= url %>
+url https://<%= username %>:<%= password %>@<%= url %>/<%= partition %>

0 comments on commit da0df7e

Please sign in to comment.