Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/puppet/type/node_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def insync?(is)
desc 'Environment for this group'
defaultto :production
validate do |value|
raise('Invalid environment name') unless value =~ (%r{\A[a-z0-9_]+\Z}) || (value == 'agent-specified')
raise('Invalid environment name') unless value =~ (%r{\A[a-zA-Z0-9_]+\Z}) || (value == 'agent-specified')
end
end
newproperty(:classes) do
Expand Down
27 changes: 27 additions & 0 deletions spec/unit/puppet/type/node_group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,33 @@
}.not_to raise_error
end

it 'allows uppercase environment name without underscore' do
expect {
Puppet::Type.type(:node_group).new(
name: 'stubname',
environment: 'ENVIRONMENTNAME',
)
}.not_to raise_error
end

it 'allows uppercase environment name with an underscore' do
expect {
Puppet::Type.type(:node_group).new(
name: 'stubname',
environment: 'ENVIRONMENT_NAME',
)
}.not_to raise_error
end

it 'allows capitalized environment name with an underscore' do
expect {
Puppet::Type.type(:node_group).new(
name: 'stubname',
environment: 'Environment_name',
)
}.not_to raise_error
end

it 'allows environment name with a number' do
expect {
Puppet::Type.type(:node_group).new(
Expand Down