Class: Runcible::Extensions::Unit
- Inherits:
-
Resources::Unit
- Object
- Base
- Resources::Unit
- Runcible::Extensions::Unit
- Defined in:
- lib/runcible/extensions/unit.rb
Direct Known Subclasses
Distribution, Errata, PackageCategory, PackageGroup, Rpm, YumRepoMetadataFile
Class Method Summary collapse
-
.all ⇒ RestClient::Response
Retrieves all content of a certain @@type.
-
.content_type ⇒ Object
The content type (e.g. rpm, errata).
-
.copy(source_repo_id, destination_repo_id, optional = {}) ⇒ RestClient::Response
copy contents from source repo to the destination repo.
-
.find(id, optional = {}) ⇒ RestClient::Response
Retrieves a single content by it’s content ID.
-
.find_all(ids, optional = {}) ⇒ RestClient::Response
Retrieves a set of content by the contents IDs.
-
.find_all_by_unit_ids(ids, fields = [], optional = {}) ⇒ RestClient::Response
Retrieves a set of content by the Pulp unit IDs.
-
.find_by_unit_id(id, optional = {}) ⇒ RestClient::Response
Retrieves a single content by it’s unit ID.
-
.unassociate_from_repo(repo_id, filters) ⇒ RestClient::Response
unassociates content units from a repository.
-
.unassociate_ids_from_repo(repo_id, ids) ⇒ RestClient::Response
unassociates content units from a repository.
-
.unassociate_unit_ids_from_repo(repo_id, ids) ⇒ RestClient::Response
unassociates content units from a repository.
Methods inherited from Resources::Unit
Methods inherited from Base
add_http_auth_header, add_oauth_header, call, combine_get_params, config, config=, generate_log_message, generate_payload, get_response, log_debug, log_exception, process_response, required_params
Class Method Details
.all ⇒ RestClient::Response
Retrieves all content of a certain @@type
37 38 39 |
# File 'lib/runcible/extensions/unit.rb', line 37 def self.all self.search(content_type, {}) end |
.content_type ⇒ Object
The content type (e.g. rpm, errata)
30 31 32 |
# File 'lib/runcible/extensions/unit.rb', line 30 def self.content_type '' end |
.copy(source_repo_id, destination_repo_id, optional = {}) ⇒ RestClient::Response
copy contents from source repo to the destination repo
121 122 123 124 125 126 127 128 129 130 |
# File 'lib/runcible/extensions/unit.rb', line 121 def self.copy(source_repo_id, destination_repo_id, optional={}) criteria = {:type_ids => [content_type], :filters => {}} criteria[:filters]['association'] = {'unit_id' => {'$in' => optional[:ids]}} if optional[:ids] criteria[:fields] = {:unit => optional[:fields]} if optional[:fields] payload = {:criteria => criteria} payload[:override_config] = {:copy_children => optional[:copy_children]} if optional.has_key?(:copy_children) Runcible::Extensions::Repository.unit_copy(destination_repo_id, source_repo_id, payload) end |
.find(id, optional = {}) ⇒ RestClient::Response
Retrieves a single content by it’s content ID
45 46 47 48 |
# File 'lib/runcible/extensions/unit.rb', line 45 def self.find(id, optional={}) optional[:include_repos] ||= true find_all([id], optional).first end |
.find_all(ids, optional = {}) ⇒ RestClient::Response
Retrieves a set of content by the contents IDs
54 55 56 57 |
# File 'lib/runcible/extensions/unit.rb', line 54 def self.find_all(ids, optional={}) optional[:include_repos] ||= true self.search(content_type, { :filters => {'id'=> {'$in'=> ids}} }, optional) end |
.find_all_by_unit_ids(ids, fields = [], optional = {}) ⇒ RestClient::Response
Retrieves a set of content by the Pulp unit IDs
73 74 75 76 77 78 |
# File 'lib/runcible/extensions/unit.rb', line 73 def self.find_all_by_unit_ids(ids, fields=[], optional={}) optional[:include_repos] ||= true criteria = { :filters => { :_id => { '$in'=> ids } } } criteria[:fields] = fields unless fields.empty? self.search(content_type, criteria, optional) end |
.find_by_unit_id(id, optional = {}) ⇒ RestClient::Response
Retrieves a single content by it’s unit ID
63 64 65 66 |
# File 'lib/runcible/extensions/unit.rb', line 63 def self.find_by_unit_id(id, optional={}) optional[:include_repos] ||= true find_all_by_unit_ids([id], [], optional).first end |
.unassociate_from_repo(repo_id, filters) ⇒ RestClient::Response
unassociates content units from a repository
85 86 87 88 89 |
# File 'lib/runcible/extensions/unit.rb', line 85 def self.unassociate_from_repo(repo_id, filters) criteria = {:type_ids => [content_type]} criteria[:filters] = filters Runcible::Extensions::Repository.unassociate_units(repo_id, criteria) end |
.unassociate_ids_from_repo(repo_id, ids) ⇒ RestClient::Response
unassociates content units from a repository
99 100 101 |
# File 'lib/runcible/extensions/unit.rb', line 99 def self.unassociate_ids_from_repo(repo_id, ids) unassociate_from_repo(repo_id, :unit => {'id' => {'$in' => ids}}) end |
.unassociate_unit_ids_from_repo(repo_id, ids) ⇒ RestClient::Response
unassociates content units from a repository
111 112 113 |
# File 'lib/runcible/extensions/unit.rb', line 111 def self.unassociate_unit_ids_from_repo(repo_id, ids) unassociate_from_repo(repo_id, :association => {'unit_id' => {'$in' => ids}}) end |