Skip to content

Commit

Permalink
updated all references from system to content host
Browse files Browse the repository at this point in the history
  • Loading branch information
cfouant committed May 22, 2014
1 parent e946140 commit acd1505
Showing 1 changed file with 56 additions and 56 deletions.
112 changes: 56 additions & 56 deletions app/controllers/katello/api/v2/systems_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@ def organization_id_keys
end

def_param_group :system do
param :facts, Hash, :desc => N_("Key-value hash of system-specific facts"), :action_aware => true do
param :fact, String, :desc => N_("Any number of facts about this system")
param :facts, Hash, :desc => N_("Key-value hash of content host-specific facts"), :action_aware => true do
param :fact, String, :desc => N_("Any number of facts about this content host")
end
param :installed_products, Array, :desc => N_("List of products installed on the system"), :action_aware => true
param :name, String, :desc => N_("Name of the system"), :required => true, :action_aware => true
param :type, String, :desc => N_("Type of the system, it should always be 'system'"), :required => true, :action_aware => true
param :installed_products, Array, :desc => N_("List of products installed on the content host"), :action_aware => true
param :name, String, :desc => N_("Name of the content host"), :required => true, :action_aware => true
param :type, String, :desc => N_("Type of the content host, it should always be 'content host'"), :required => true, :action_aware => true
param :service_level, String, :allow_nil => true, :desc => N_("A service level for auto-healing process, e.g. SELF-SUPPORT"), :action_aware => true
param :location, String, :desc => N_("Physical location of the system")
param :location, String, :desc => N_("Physical location of the content host")
param :content_view_id, :identifier
param :environment_id, :identifier
end

api :GET, "/systems", N_("List systems")
api :GET, "/organizations/:organization_id/systems", N_("List systems in an organization")
api :GET, "/environments/:environment_id/systems", N_("List systems in environment")
api :GET, "/host_collections/:host_collection_id/systems", N_("List systems in a host collection")
api :GET, "/systems", N_("List content hosts")
api :GET, "/organizations/:organization_id/systems", N_("List content hosts in an organization")
api :GET, "/environments/:environment_id/systems", N_("List content hosts in environment")
api :GET, "/host_collections/:host_collection_id/systems", N_("List content hosts in a host collection")
param :name, String, :desc => N_("Filter content host by name")
param :pool_id, String, :desc => N_("Filter content host by subscribed pool")
param :uuid, String, :desc => N_("Filter content host by uuid")
Expand Down Expand Up @@ -89,20 +89,20 @@ def index
end

api :POST, "/systems", N_("Register a content host")
api :POST, "/environments/:environment_id/systems", N_("Register a system in environment")
api :POST, "/host_collections/:host_collection_id/systems", N_("Register a system in environment")
param :name, String, :desc => N_("Name of the system"), :required => true, :action_aware => true
param :description, String, :desc => N_("Description of the system")
param :location, String, :desc => N_("Physical location of the system")
param :facts, Hash, :desc => N_("Key-value hash of system-specific facts"), :action_aware => true, :required => true do
param :fact, String, :desc => N_("Any number of facts about this system")
api :POST, "/environments/:environment_id/systems", N_("Register a content host in environment")
api :POST, "/host_collections/:host_collection_id/systems", N_("Register a content host in environment")
param :name, String, :desc => N_("Name of the content host"), :required => true, :action_aware => true
param :description, String, :desc => N_("Description of the content host")
param :location, String, :desc => N_("Physical location of the content host")
param :facts, Hash, :desc => N_("Key-value hash of content host-specific facts"), :action_aware => true, :required => true do
param :fact, String, :desc => N_("Any number of facts about this content host")
end
param :type, String, :desc => N_("Type of the system, it should always be 'system'"), :required => true, :action_aware => true
param :guest_ids, Array, :desc => N_("IDs of the guests running on this system")
param :installed_products, Array, :desc => N_("List of products installed on the system"), :action_aware => true
param :release_ver, String, :desc => N_("Release version of the system")
param :type, String, :desc => N_("Type of the content host, it should always be 'content host'"), :required => true, :action_aware => true
param :guest_ids, Array, :desc => N_("IDs of the guests running on this content host")
param :installed_products, Array, :desc => N_("List of products installed on the content host"), :action_aware => true
param :release_ver, String, :desc => N_("Release version of the content host")
param :service_level, String, :allow_nil => true, :desc => N_("A service level for auto-healing process, e.g. SELF-SUPPORT"), :action_aware => true
param :last_checkin, String, :desc => N_("Last check-in time of this system")
param :last_checkin, String, :desc => N_("Last check-in time of this content host")
param :organization_id, :number, :desc => N_("Specify the organization"), :required => true
param :environment_id, String, :desc => N_("Specify the environment")
param :content_view_id, String, :desc => N_("Specify the content view")
Expand All @@ -116,19 +116,19 @@ def create
end

api :PUT, "/systems/:id", N_("Update content host information")
param :id, String, :desc => N_("UUID of the Content Host"), :required => true
param :name, String, :desc => N_("Name of the system"), :required => true, :action_aware => true
param :description, String, :desc => N_("Description of the system")
param :location, String, :desc => N_("Physical location of the system")
param :facts, Hash, :desc => N_("Key-value hash of system-specific facts"), :action_aware => true, :required => true do
param :fact, String, :desc => N_("Any number of facts about this system")
param :id, String, :desc => N_("UUID of the content host"), :required => true
param :name, String, :desc => N_("Name of the content host"), :required => true, :action_aware => true
param :description, String, :desc => N_("Description of the content host")
param :location, String, :desc => N_("Physical location of the content host")
param :facts, Hash, :desc => N_("Key-value hash of content host-specific facts"), :action_aware => true, :required => true do
param :fact, String, :desc => N_("Any number of facts about this content host")
end
param :type, String, :desc => N_("Type of the system, it should always be 'system'"), :required => true, :action_aware => true
param :guest_ids, Array, :desc => N_("IDs of the guests running on this system")
param :installed_products, Array, :desc => N_("List of products installed on the system"), :action_aware => true
param :release_ver, String, :desc => N_("Release version of the system")
param :type, String, :desc => N_("Type of the content host, it should always be 'content host'"), :required => true, :action_aware => true
param :guest_ids, Array, :desc => N_("IDs of the guests running on this content host")
param :installed_products, Array, :desc => N_("List of products installed on the content host"), :action_aware => true
param :release_ver, String, :desc => N_("Release version of the content host")
param :service_level, String, :allow_nil => true, :desc => N_("A service level for auto-healing process, e.g. SELF-SUPPORT"), :action_aware => true
param :last_checkin, String, :desc => N_("Last check-in time of this system")
param :last_checkin, String, :desc => N_("Last check-in time of this content host")
param :environment_id, String, :desc => N_("Specify the environment")
param :content_view_id, String, :desc => N_("Specify the content view")
def update
Expand All @@ -137,15 +137,15 @@ def update
respond_for_update
end

api :GET, "/systems/:id", N_("Show a system")
param :id, String, :desc => N_("UUID of the Content Host"), :required => true
api :GET, "/systems/:id", N_("Show a content host")
param :id, String, :desc => N_("UUID of the content host"), :required => true
def show
@host_collections = @system.host_collections
@custom_info = @system.custom_info
respond
end

api :GET, "/systems/:id/available_host_collections", N_("List host collections the system does not belong to")
api :GET, "/systems/:id/available_host_collections", N_("List host collections the content host does not belong to")
param_group :search, Api::V2::ApiController
param :name, String, :desc => N_("host collection name to filter by")
def available_host_collections
Expand All @@ -161,15 +161,15 @@ def available_host_collections
respond_for_index(:collection => host_collections)
end

api :DELETE, "/systems/:id", N_("Unregister a system")
param :id, String, :desc => N_("UUID of the Content Host"), :required => true
api :DELETE, "/systems/:id", N_("Unregister a content host")
param :id, String, :desc => N_("UUID of the content host"), :required => true
def destroy
@system.destroy
respond :message => _("Deleted system '%s'") % params[:id], :status => 204
respond :message => _("Deleted content host '%s'") % params[:id], :status => 204
end

api :GET, "/systems/:id/packages", N_("List packages installed on the system")
param :id, String, :desc => N_("UUID of the Content Host"), :required => true
api :GET, "/systems/:id/packages", N_("List packages installed on the content host")
param :id, String, :desc => N_("UUID of the content host"), :required => true
def package_profile
packages = @system.simple_packages.sort { |a, b| a.name.downcase <=> b.name.downcase }
response = {
Expand All @@ -181,14 +181,14 @@ def package_profile
end

api :PUT, "/systems/:id/refresh_subscriptions", N_("Trigger a refresh of subscriptions, auto-attaching if enabled")
param :id, String, :desc => N_("UUID of the Content Host"), :required => true
param :id, String, :desc => N_("UUID of the content host"), :required => true
def refresh_subscriptions
@system.refresh_subscriptions
respond_for_show(:resource => @system)
end

api :GET, "/systems/:id/errata", N_("List errata available for the system")
param :id, String, :desc => N_("UUID of the Content Host"), :required => true
api :GET, "/systems/:id/errata", N_("List errata available for the content host")
param :id, String, :desc => N_("UUID of the content host"), :required => true
def errata
errata = @system.errata
response = {
Expand All @@ -200,8 +200,8 @@ def errata
respond_for_index :collection => response
end

api :GET, "/systems/:id/tasks", N_("List async tasks for the system")
param :id, String, :desc => N_("UUID of the Content Host"), :required => true
api :GET, "/systems/:id/tasks", N_("List async tasks for the content host")
param :id, String, :desc => N_("UUID of the content host"), :required => true
def tasks
@system.refresh_tasks

Expand All @@ -215,8 +215,8 @@ def tasks
end

# TODO: break this mehtod up
api :GET, "/environments/:environment_id/systems/report", N_("Get system reports for the environment")
api :GET, "/organizations/:organization_id/systems/report", N_("Get system reports for the organization")
api :GET, "/environments/:environment_id/systems/report", N_("Get content host reports for the environment")
api :GET, "/organizations/:organization_id/systems/report", N_("Get content host reports for the organization")
def report # rubocop:disable MethodLength
data = @environment.nil? ? @organization.systems.readable : @environment.systems.readable

Expand Down Expand Up @@ -246,9 +246,9 @@ def report # rubocop:disable MethodLength
end
end

api :GET, "/systems/:id/pools", N_("List pools a system is subscribed to")
param :id, String, :desc => N_("UUID of the Content Host"), :required => true
param :match_system, [true, false], :desc => N_("Match pools to system")
api :GET, "/systems/:id/pools", N_("List pools a content host is subscribed to")
param :id, String, :desc => N_("UUID of the content host"), :required => true
param :match_system, [true, false], :desc => N_("Match pools to content host")
param :match_installed, [true, false], :desc => N_("Match pools to installed")
param :no_overlap, [true, false], :desc => N_("allow overlap")
def pools
Expand All @@ -264,8 +264,8 @@ def pools
respond_for_index :collection => response
end

api :GET, "/systems/:id/releases", N_("Show releases available for the system")
param :id, String, :desc => N_("UUID of the Content Host"), :required => true
api :GET, "/systems/:id/releases", N_("Show releases available for the content host")
param :id, String, :desc => N_("UUID of the content host"), :required => true
desc <<-DESC
A hint for choosing the right value for the releaseVer param
DESC
Expand All @@ -282,7 +282,7 @@ def find_system
@system = System.first(:conditions => { :uuid => params[:id] })
if @system.nil?
Resources::Candlepin::Consumer.get params[:id] # check with candlepin if system is Gone, raises RestClient::Gone
fail HttpErrors::NotFound, _("Couldn't find system '%s'") % params[:id]
fail HttpErrors::NotFound, _("Couldn't find content host '%s'") % params[:id]
end
end

Expand All @@ -304,7 +304,7 @@ def find_host_collection
def find_only_environment
if !@environment && @organization && !params.key?(:environment_id)
if @organization.kt_environments.empty?
fail HttpErrors::BadRequest, _("Organization %{org} has the '%{env}' environment only. Please create an environment for system registration.") %
fail HttpErrors::BadRequest, _("Organization %{org} has the '%{env}' environment only. Please create an environment for content host registration.") %
{ :org => @organization.name, :env => "Library" }
end

Expand All @@ -317,7 +317,7 @@ def find_only_environment
if current_user.default_environment && current_user.default_environment.organization == @organization
@environment = current_user.default_environment
else
fail HttpErrors::BadRequest, _("Organization %s has more than one environment. Please specify target environment for system registration.") % @organization.name
fail HttpErrors::BadRequest, _("Organization %s has more than one environment. Please specify target environment for content host registration.") % @organization.name
end
else
if @environment = @organization.kt_environments.first
Expand Down

0 comments on commit acd1505

Please sign in to comment.