diff options
author | Tim Smith <tsmith@chef.io> | 2020-09-09 15:30:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-09 15:30:54 -0700 |
commit | 7ab54a8751be1cbe32651e8c21f07f2d9509956b (patch) | |
tree | 3b4ff75c77ca50000eb4872970f5124147ba4e2d | |
parent | b6c2173bf578a8f1b44aeea2bc5eef9288e48964 (diff) | |
parent | e3001f0e34ff33516d71d3948223a515c07903ca (diff) | |
download | chef-7ab54a8751be1cbe32651e8c21f07f2d9509956b.tar.gz |
Merge pull request #10408 from chef/cpu_quota
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/chef/resource/chef_client_systemd_timer.rb | 4 | ||||
-rw-r--r-- | spec/unit/resource/chef_client_systemd_timer_spec.rb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/resource/chef_client_systemd_timer.rb b/lib/chef/resource/chef_client_systemd_timer.rb index 119f920c18..71e05e9499 100644 --- a/lib/chef/resource/chef_client_systemd_timer.rb +++ b/lib/chef/resource/chef_client_systemd_timer.rb @@ -99,10 +99,10 @@ class Chef default: lazy { {} } property :cpu_quota, [Integer, String], - description: "The systemd CPUQuota to run the #{Chef::Dist::CLIENT} process with. This is a percentage value of the total CPU time available on the system.", + description: "The systemd CPUQuota to run the #{Chef::Dist::CLIENT} process with. This is a percentage value of the total CPU time available on the system. If the system has more than 1 core this may be a value greater than 100.", introduced: "16.5", coerce: proc { |x| Integer(x) }, - callbacks: { "should be an Integer between 1 and 100" => proc { |v| v > 0 && v <= 100 } } + callbacks: { "should be a positive Integer" => proc { |v| v > 0 } } action :add do systemd_unit "#{new_resource.job_name}.service" do diff --git a/spec/unit/resource/chef_client_systemd_timer_spec.rb b/spec/unit/resource/chef_client_systemd_timer_spec.rb index c3d69fcae0..dfe01973fb 100644 --- a/spec/unit/resource/chef_client_systemd_timer_spec.rb +++ b/spec/unit/resource/chef_client_systemd_timer_spec.rb @@ -35,8 +35,8 @@ describe Chef::Resource::ChefClientSystemdTimer do it "validates the cpu_quota property input" do expect { resource.cpu_quota(0) }.to raise_error(Chef::Exceptions::ValidationFailed) - expect { resource.cpu_quota(101) }.to raise_error(Chef::Exceptions::ValidationFailed) expect { resource.cpu_quota(50) }.not_to raise_error + expect { resource.cpu_quota(101) }.not_to raise_error end it "builds a default value for chef_binary_path dist values" do |