Skip to content

Commit

Permalink
Fix nice parameter to accept -20
Browse files Browse the repository at this point in the history
Without this commit the range for nice is -19 to 19 which is incorrect.
nice(1) states that the valid values range from -20 to 19.
  • Loading branch information
ghoneycutt committed Aug 10, 2015
1 parent 32c97d6 commit 4dce701
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -70,7 +70,7 @@ page.
* `instances` - optional - defaults to "UNLIMITED"
* `wait` - optional - based on $protocol will default to "yes" for udp and "no" for tcp
* `service_type` - optional - type setting in xinetd
* `nice` - optional - integer between -19 and 19
* `nice` - optional - integer between -20 and 19, inclusive.

### Sample Usage

Expand Down
4 changes: 2 additions & 2 deletions manifests/service.pp
Expand Up @@ -38,7 +38,7 @@
# $access_times - optional
# $log_type - optional
# $bind - optional
# $nice - optional
# $nice - optional - integer between -20 and 19, inclusive.
#
# Actions:
# setups up a xinetd service by creating a file in /etc/xinetd.d/
Expand Down Expand Up @@ -112,7 +112,7 @@
if $nice != undef {
validate_integer($nice)

if $nice < -19 or $nice > 19 {
if $nice < -20 or $nice > 19 {
fail("Invalid value for nice, ${nice}")
}
}
Expand Down
4 changes: 2 additions & 2 deletions spec/defines/xinetd_service_spec.rb
Expand Up @@ -87,7 +87,7 @@
end

# nice values, good
[-19,9,19].each do |i|
[-20,0,9,19].each do |i|
describe "with nice #{i}" do
let :params do
default_params.merge({ :nice => i })
Expand All @@ -98,7 +98,7 @@
end

# nice values, bad
['-20','90','foo',-20,90].each do |i|
['-21','90','foo',-21,90,20].each do |i|
describe "with nice #{i}" do
let :params do
default_params.merge({ :nice => i })
Expand Down

0 comments on commit 4dce701

Please sign in to comment.