Skip to content

Commit c7b66c3

Browse files
authored
Merge pull request #95 from bastelfreak/name2
node_group type: Allow uppercase letters in environment names
2 parents 519bc30 + 2f7b3a9 commit c7b66c3

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

lib/puppet/type/node_group.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def insync?(is)
123123
desc 'Environment for this group'
124124
defaultto :production
125125
validate do |value|
126-
raise('Invalid environment name') unless value =~ (%r{\A[a-z0-9_]+\Z}) || (value == 'agent-specified')
126+
raise('Invalid environment name') unless value =~ (%r{\A[a-zA-Z0-9_]+\Z}) || (value == 'agent-specified')
127127
end
128128
end
129129
newproperty(:classes) do

spec/unit/puppet/type/node_group_spec.rb

+27
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,33 @@
2020
}.not_to raise_error
2121
end
2222

23+
it 'allows uppercase environment name without underscore' do
24+
expect {
25+
Puppet::Type.type(:node_group).new(
26+
name: 'stubname',
27+
environment: 'ENVIRONMENTNAME',
28+
)
29+
}.not_to raise_error
30+
end
31+
32+
it 'allows uppercase environment name with an underscore' do
33+
expect {
34+
Puppet::Type.type(:node_group).new(
35+
name: 'stubname',
36+
environment: 'ENVIRONMENT_NAME',
37+
)
38+
}.not_to raise_error
39+
end
40+
41+
it 'allows capitalized environment name with an underscore' do
42+
expect {
43+
Puppet::Type.type(:node_group).new(
44+
name: 'stubname',
45+
environment: 'Environment_name',
46+
)
47+
}.not_to raise_error
48+
end
49+
2350
it 'allows environment name with a number' do
2451
expect {
2552
Puppet::Type.type(:node_group).new(

0 commit comments

Comments
 (0)