Skip to content

Commit 4584395

Browse files
authored
Merge pull request #30 from mrwulf/issue_29
Allow route domain `%0` to be on end of node names
2 parents b453839 + 8a580aa commit 4584395

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
require 'puppet/parameter'
2+
require File.join(File.dirname(__FILE__), 'f5_name.rb')
3+
4+
class Puppet::Parameter::F5NameWithRouteDomain < Puppet::Parameter::F5Name
5+
validate do |value|
6+
fail ArgumentError, "#{name} must be a String" unless value.is_a?(String)
7+
fail ArgumentError, "#{name} must match the pattern /Partition/name" unless value.match(%r{/[\w\.-]+/[\w\.-]+(\%\d+)?$})
8+
end
9+
end

lib/puppet/type/f5_node.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','puppet/parameter/f5_name.rb'))
1+
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','puppet/parameter/f5_namewithroutedomain.rb'))
22
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','puppet/property/f5_address.rb'))
33
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','puppet/property/f5_availability_requirement.rb'))
44
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','puppet/property/f5_connection_limit.rb'))
@@ -14,7 +14,7 @@
1414
apply_to_device
1515
ensurable
1616

17-
newparam(:name, :parent => Puppet::Parameter::F5Name, :namevar => true)
17+
newparam(:name, :parent => Puppet::Parameter::F5NameWithRouteDomain, :namevar => true)
1818
newproperty(:address, :parent => Puppet::Property::F5Address)
1919
newproperty(:state, :parent => Puppet::Property::F5State)
2020
newproperty(:description, :parent => Puppet::Property::F5Description)

spec/acceptance/f5_node/rest_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@
1212
run_device(:allow_changes => true)
1313
run_device(:allow_changes => false)
1414
end
15+
it 'creates a node with a route domain' do
16+
pp=<<-EOS
17+
f5_node { '/Common/10.10.10.10%0':
18+
ensure => present,
19+
address => '10.10.10.10',
20+
}
21+
EOS
22+
make_site_pp(pp)
23+
run_device(:allow_changes => true)
24+
run_device(:allow_changes => false)
25+
end
1526
it 'updates a basic monitor called my_node' do
1627
pp=<<-EOS
1728
f5_node { '/Common/my_node':

0 commit comments

Comments
 (0)