runcible 0.4.1 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -96,19 +96,25 @@ module Runcible
96
96
 
97
97
  # Retrieve the set of errata that is applicable to a consumer(s)
98
98
  #
99
- # @param [String, Array] ids hash of uninstall options
100
- # @return [RestClient::Response] content applicability hash with details of errata availabel to consumer(s)
101
- def self.applicable_errata(ids)
99
+ # @param [String, Array] ids string containing a single consumer id or an array of ids
100
+ # @param [Array] repoids array of repository ids
101
+ # @param [Boolean] consumer_report if true, result will list consumers and their
102
+ # applicable errata; otherwise, it will list
103
+ # errata and the consumers they are applicable to
104
+ # @return [RestClient::Response] content applicability hash with details of errata available to consumer(s)
105
+ def self.applicable_errata(ids, repoids = [], consumer_report = true)
106
+
102
107
  ids = [ids] if ids.is_a? String
108
+ consumer_criteria = { 'filters' => { 'id' => { '$in' => ids } } } unless ids.empty?
109
+ repo_criteria = { 'filters' => { 'id' => { '$in' => repoids } } } unless repoids.empty?
110
+ report_style = (consumer_report == true) ? 'by_consumer' : 'by_units'
111
+
103
112
  criteria = {
104
- 'consumer_criteria' => {
105
- 'filters' => {'id' => {'$in' => ids}}
106
- },
107
- 'units' => {
108
- 'erratum' => []
109
- }
113
+ 'consumer_criteria' => consumer_criteria,
114
+ 'repo_criteria' => repo_criteria,
115
+ 'unit_criteria' => { 'erratum' => { } },
116
+ 'override_config' => { 'report_style' => report_style }
110
117
  }
111
-
112
118
  self.applicability(criteria)
113
119
  end
114
120
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Justin Sherrill
1
+ # Copyright (c) 2012 Red Hat Inc.
2
2
  #
3
3
  # MIT License
4
4
  #
@@ -0,0 +1,62 @@
1
+ # Copyright (c) 2013 Red Hat Inc.
2
+ #
3
+ # MIT License
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining
6
+ # a copy of this software and associated documentation files (the
7
+ # "Software"), to deal in the Software without restriction, including
8
+ # without limitation the rights to use, copy, modify, merge, publish,
9
+ # distribute, sublicense, and/or sell copies of the Software, and to
10
+ # permit persons to whom the Software is furnished to do so, subject to
11
+ # the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be
14
+ # included in all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ require 'active_support/json'
25
+ require 'securerandom'
26
+
27
+ module Runcible
28
+ module Extensions
29
+ class IsoDistributor < Distributor
30
+ #required
31
+ attr_accessor "serve_http", "serve_https"
32
+
33
+ # Instantiates an iso distributor
34
+ #
35
+ # @param [boolean] http serve the contents over http
36
+ # @param [boolean] https serve the contents over https
37
+ # @return [Runcible::Extensions::IsoDistributor]
38
+ def initialize(http, https)
39
+ @serve_http = http
40
+ @serve_https = https
41
+ super({})
42
+ end
43
+
44
+ # Distributor Type id
45
+ #
46
+ # @return [string]
47
+ def type_id
48
+ 'iso_distributor'
49
+ end
50
+
51
+ # generate the pulp config for the iso distributor
52
+ #
53
+ # @return [Hash]
54
+ def config
55
+ to_ret = self.as_json
56
+ to_ret.delete('auto_publish')
57
+ to_ret.delete('id')
58
+ to_ret
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,48 @@
1
+ # Copyright (c) 2013 Red Hat Inc.
2
+ #
3
+ # MIT License
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining
6
+ # a copy of this software and associated documentation files (the
7
+ # "Software"), to deal in the Software without restriction, including
8
+ # without limitation the rights to use, copy, modify, merge, publish,
9
+ # distribute, sublicense, and/or sell copies of the Software, and to
10
+ # permit persons to whom the Software is furnished to do so, subject to
11
+ # the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be
14
+ # included in all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ module Runcible
25
+ module Extensions
26
+ class IsoImporter < Importer
27
+ ID = 'iso_importer'
28
+
29
+ attr_accessor 'feed_url', 'ssl_ca_cert', 'ssl_client_cert', 'ssl_client_key',
30
+ 'proxy_url', 'proxy_port', 'proxy_pass', 'proxy_user',
31
+ 'remove_missing_units', 'num_threads', 'max_speed'
32
+
33
+ # Importer Type id
34
+ #
35
+ # @return [string]
36
+ def id
37
+ IsoImporter::ID
38
+ end
39
+
40
+ # generate the pulp config for the iso importer
41
+ #
42
+ # @return [Hash]
43
+ def config
44
+ self.as_json
45
+ end
46
+ end
47
+ end
48
+ end
File without changes
@@ -62,16 +62,19 @@ module Runcible
62
62
  # @return [RestClient::Response] the requested content
63
63
  def self.find_by_unit_id(id, optional={})
64
64
  optional[:include_repos] ||= true
65
- find_all_by_unit_ids([id], optional).first
65
+ find_all_by_unit_ids([id], [], optional).first
66
66
  end
67
67
 
68
68
  # Retrieves a set of content by the Pulp unit IDs
69
69
  #
70
- # @param [Array] ids list of content unit IDs to retrieve
71
- # @return [RestClient::Response] list of content
72
- def self.find_all_by_unit_ids(ids, optional={})
70
+ # @param [Array] ids list of content unit IDs to retrieve
71
+ # @param [Array] fields optional list of to retrieve
72
+ # @return [RestClient::Response] list of content
73
+ def self.find_all_by_unit_ids(ids, fields=[], optional={})
73
74
  optional[:include_repos] ||= true
74
- self.search(content_type, { :filters => {:_id=> {'$in'=> ids}} }, optional)
75
+ criteria = { :filters => { :_id => { '$in'=> ids } } }
76
+ criteria[:fields] = fields unless fields.empty?
77
+ self.search(content_type, criteria, optional)
75
78
  end
76
79
 
77
80
  # unassociates content units from a repository
@@ -118,7 +121,11 @@ module Runcible
118
121
  def self.copy(source_repo_id, destination_repo_id, optional={})
119
122
  criteria = {:type_ids => [content_type], :filters => {}}
120
123
  criteria[:filters]['association'] = {'unit_id' => {'$in' => optional[:ids]}} if optional[:ids]
124
+ criteria[:fields] = {:unit => optional[:fields]} if optional[:fields]
125
+
121
126
  payload = {:criteria => criteria}
127
+ payload[:override_config] = {:copy_children => optional[:copy_children]} if optional.has_key?(:copy_children)
128
+
122
129
  Runcible::Extensions::Repository.unit_copy(destination_repo_id, source_repo_id, payload)
123
130
  end
124
131
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Justin Sherrill
1
+ # Copyright (c) 2012 Red Hat Inc.
2
2
  #
3
3
  # MIT License
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Justin Sherrill
1
+ # Copyright (c) 2012 Red Hat Inc.
2
2
  #
3
3
  # MIT License
4
4
  #
File without changes
File without changes
@@ -1,3 +1,3 @@
1
1
  module Runcible
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.3"
3
3
  end
metadata CHANGED
@@ -1,100 +1,96 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runcible
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
5
- prerelease:
4
+ version: 0.4.3
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Eric D Helms, Justin Sherrill
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-25 00:00:00.000000000 Z
12
+ date: 2013-04-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- version_requirements: !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
17
18
  requirements:
18
- - - ">="
19
+ - - ! '>='
19
20
  - !ruby/object:Gem::Version
20
- version: !binary |-
21
- MA==
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
22
25
  none: false
23
- requirement: !ruby/object:Gem::Requirement
24
26
  requirements:
25
- - - ">="
27
+ - - ! '>='
26
28
  - !ruby/object:Gem::Version
27
- version: !binary |-
28
- MA==
29
- none: false
30
- prerelease: false
31
- type: :runtime
29
+ version: '0'
32
30
  - !ruby/object:Gem::Dependency
33
31
  name: rest-client
34
- version_requirements: !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
35
34
  requirements:
36
- - - ">="
35
+ - - ! '>='
37
36
  - !ruby/object:Gem::Version
38
37
  version: 1.6.1
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
39
41
  none: false
40
- requirement: !ruby/object:Gem::Requirement
41
42
  requirements:
42
- - - ">="
43
+ - - ! '>='
43
44
  - !ruby/object:Gem::Version
44
45
  version: 1.6.1
45
- none: false
46
- prerelease: false
47
- type: :runtime
48
46
  - !ruby/object:Gem::Dependency
49
47
  name: oauth
50
- version_requirements: !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
51
50
  requirements:
52
- - - ">="
51
+ - - ! '>='
53
52
  - !ruby/object:Gem::Version
54
- version: !binary |-
55
- MA==
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
56
57
  none: false
57
- requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
- version: !binary |-
62
- MA==
63
- none: false
64
- prerelease: false
65
- type: :runtime
61
+ version: '0'
66
62
  - !ruby/object:Gem::Dependency
67
63
  name: activesupport
68
- version_requirements: !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
69
66
  requirements:
70
- - - ">="
67
+ - - ! '>='
71
68
  - !ruby/object:Gem::Version
72
69
  version: 3.0.10
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
73
  none: false
74
- requirement: !ruby/object:Gem::Requirement
75
74
  requirements:
76
- - - ">="
75
+ - - ! '>='
77
76
  - !ruby/object:Gem::Version
78
77
  version: 3.0.10
79
- none: false
80
- prerelease: false
81
- type: :runtime
82
78
  - !ruby/object:Gem::Dependency
83
79
  name: i18n
84
- version_requirements: !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
85
82
  requirements:
86
- - - ">="
83
+ - - ! '>='
87
84
  - !ruby/object:Gem::Version
88
85
  version: 0.5.0
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
89
  none: false
90
- requirement: !ruby/object:Gem::Requirement
91
90
  requirements:
92
- - - ">="
91
+ - - ! '>='
93
92
  - !ruby/object:Gem::Version
94
93
  version: 0.5.0
95
- none: false
96
- prerelease: false
97
- type: :runtime
98
94
  description: Exposing Pulp's juiciest components to the Ruby world.
99
95
  email:
100
96
  - ehelms@redhat.com, jsherril@redhat.com
@@ -103,16 +99,16 @@ extensions: []
103
99
  extra_rdoc_files: []
104
100
  files:
105
101
  - lib/runcible.rb
106
- - lib/runcible/version.rb
107
- - lib/runcible/base.rb
108
102
  - lib/runcible/extensions/package_category.rb
109
103
  - lib/runcible/extensions/errata.rb
110
104
  - lib/runcible/extensions/distributor.rb
111
105
  - lib/runcible/extensions/consumer_group.rb
112
106
  - lib/runcible/extensions/consumer.rb
113
107
  - lib/runcible/extensions/repository.rb
108
+ - lib/runcible/extensions/iso_importer.rb
114
109
  - lib/runcible/extensions/yum_distributor.rb
115
110
  - lib/runcible/extensions/rpm.rb
111
+ - lib/runcible/extensions/iso_distributor.rb
116
112
  - lib/runcible/extensions/unit.rb
117
113
  - lib/runcible/extensions/yum_importer.rb
118
114
  - lib/runcible/extensions/package_group.rb
@@ -128,30 +124,31 @@ files:
128
124
  - lib/runcible/resources/user.rb
129
125
  - lib/runcible/resources/unit.rb
130
126
  - lib/runcible/resources/repository_group.rb
127
+ - lib/runcible/version.rb
128
+ - lib/runcible/base.rb
131
129
  homepage: https://github.com/Katello/runcible
132
130
  licenses: []
133
- post_install_message:
131
+ post_install_message:
134
132
  rdoc_options: []
135
133
  require_paths:
136
134
  - lib
137
135
  required_ruby_version: !ruby/object:Gem::Requirement
136
+ none: false
138
137
  requirements:
139
- - - ">="
138
+ - - ! '>='
140
139
  - !ruby/object:Gem::Version
141
- version: !binary |-
142
- MA==
143
- none: false
140
+ version: '0'
144
141
  required_rubygems_version: !ruby/object:Gem::Requirement
142
+ none: false
145
143
  requirements:
146
- - - ">="
144
+ - - ! '>='
147
145
  - !ruby/object:Gem::Version
148
- version: !binary |-
149
- MA==
150
- none: false
146
+ version: '0'
151
147
  requirements: []
152
- rubyforge_project:
153
- rubygems_version: 1.8.24
154
- signing_key:
148
+ rubyforge_project:
149
+ rubygems_version: 1.8.25
150
+ signing_key:
155
151
  specification_version: 3
156
152
  summary: ''
157
153
  test_files: []
154
+ has_rdoc: