Skip to content

Commit

Permalink
Fix naming to use Resource Quota consistently
Browse files Browse the repository at this point in the history
Settings, error messages, and views use occasionally "Resource quota"
instead of "Resource Quota".
  • Loading branch information
bastian-src committed Feb 7, 2025
1 parent b99cc58 commit aa8c031
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ For more information, see [Limiting host resources](https://docs.theforeman.org/

_TODO_ Still under development: Official documentation will be added soon.

When several users share a compute resource or infrastructure, there is a concern that some users could use more than its fair share of resources. Resource quotas are a tool for administrators to address this concern. They limit access to the shared resource in order to guarantee a fair collaboration.
When several users share a compute resource or infrastructure, there is a concern that some users could use more than its fair share of resources. Resource Quotas are a tool for administrators to address this concern. They limit access to the shared resource in order to guarantee a fair collaboration.

In the context of Foreman, multiple users or groups usually share a fixed number of resources (limitation of compute resources like CPU cores, memory, and disk space). As of now, a user cannot be limited when allocating resources. They can create hosts with as many resources as they want. This could lead to over-usage or unequal balancing of resources under the users.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module HostsControllerExtensions
update_api(:create, :update) do
param :host, Hash do
param :resource_quota_id, :number, required: false,
desc: N_('Resource quota ID.
desc: N_('Resource Quota ID.
This field is required if the setting `resource_quota_optional_assignment` is set to false.')
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ module UsersControllerExtensions
update_api(:create, :update) do
param :user, Hash do
param :resource_quota_ids, Array, of: :number, required: false,
desc: N_('Resource quota IDs to be associated with this user. ')
desc: N_('Resource Quota IDs to be associated with this user. ')
param :resource_quota_is_optional, :bool,
desc: N_('When set to "true", it is optional for a user to assign a quota when creating new hosts.
The default value is "false".')
The default value is "false".')
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<%= webpacked_plugins_css_for :foreman_resource_quota %>
<% end %>

<% title _('Resource quotas') %>
<% title _('Resource Quotas') %>

<%= title_actions react_component('CreateResourceQuotaModal') %>

Expand Down
4 changes: 2 additions & 2 deletions lib/foreman_resource_quota/register.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@
type: :boolean,
default: false,
full_name: N_('Resource Quota optional assignment'),
description: N_('Make the assignment of a Resource quota, during the host creation process, optional for
description: N_('Make the assignment of a Resource Quota, during the host creation process, optional for
everyone. If this is true, user-specific "optional assignment" configurations are neglected.')
setting 'resource_quota_global_no_action',
type: :boolean,
default: true,
full_name: N_('Global Resource Quota no action'),
description: N_('Take no action when a resource quota is exceeded.')
description: N_('Take no action when a Resource Quota is exceeded.')
# Future: Overwrite quota-specific "out of resource"-action and take no ..
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/resource_quotas_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ResourceQuotasControllerTest < ActionController::TestCase
test 'should get index' do
get :index, session: set_session_user
assert_response :success
assert_select 'title', 'Resource quotas'
assert_select 'title', 'Resource Quotas'
end

test 'should destroy quota' do
Expand Down
8 changes: 4 additions & 4 deletions test/models/concerns/host_managed_extension_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ def setup

describe 'resource quota capacity' do
def validation_error_message_host(resource, exceeding, max)
/Validation failed: Resource quota Host exceeds #{resource} limit of \
/Validation failed: Resource Quota Host exceeds #{resource} limit of \
'[\w\s]+'-quota by #{exceeding} \(max\. #{max}\)/
end

def validation_error_message_quota(resource, exceeding, max)
/Validation failed: Resource quota #{resource} limit of '[\w\s]+'-quota is \
/Validation failed: Resource Quota #{resource} limit of '[\w\s]+'-quota is \
already exceeded by #{exceeding} without adding the new host \(max\. #{max}\)/
end

Expand All @@ -166,7 +166,7 @@ def validation_error_message_quota(resource, exceeding, max)
FactoryBot.create(:host, resource_quota: quota)
end

assert_match(/Resource quota Resource Quota '[\w\s]+' cannot determine resources for 1 hosts./, error.message)
assert_match(/Resource Quota Resource Quota '[\w\s]+' cannot determine resources for 1 hosts./, error.message)
end

test 'should fail at determine host resources' do
Expand All @@ -178,7 +178,7 @@ def validation_error_message_quota(resource, exceeding, max)
FactoryBot.create(:host, hostname: 'my.missing.host', resource_quota: quota)
end

assert_match(/Validation failed: Resource quota Cannot determine host resources for [\w\s]+/, error.message)
assert_match(/Validation failed: Resource Quota Cannot determine host resources for [\w\s]+/, error.message)
end

test 'should fail due to new host at verify limits (CPU cores)' do
Expand Down

0 comments on commit aa8c031

Please sign in to comment.