diff --git a/lib/puppet/type/node_group.rb b/lib/puppet/type/node_group.rb index d798e0d..8e5176c 100644 --- a/lib/puppet/type/node_group.rb +++ b/lib/puppet/type/node_group.rb @@ -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 diff --git a/spec/unit/puppet/type/node_group_spec.rb b/spec/unit/puppet/type/node_group_spec.rb index 90c17ad..831961e 100644 --- a/spec/unit/puppet/type/node_group_spec.rb +++ b/spec/unit/puppet/type/node_group_spec.rb @@ -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(