runcible 0.4.9 → 0.4.10

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Exposing Pulp's juiciest parts. http://www.pulpproject.org/
6
6
 
7
- Latest Live Tested Version: **pulp-server-2.1.1-0.10.beta.el6.noarch**
7
+ Latest Live Tested Version: **pulp-server-2.1.2-0.2.beta.el6.noarch**
8
8
 
9
9
  Current stable Runcible: https://github.com/Katello/runcible/tree/0.3
10
10
 
data/lib/runcible/base.rb CHANGED
@@ -37,6 +37,8 @@ module Runcible
37
37
  # :headers Additional headers e.g. content-type => "application/json"
38
38
  # :url Scheme and hostname for the pulp server e.g. https://localhost/
39
39
  # :api_path URL path for the api e.g. pulp/api/v2/
40
+ # :timeout timeout in seconds for the connection (defaults to rest client's default)
41
+ # :open_timeout timeout in seconds for the connection to open(defaults to rest client's default)
40
42
  def self.config=(conf={})
41
43
  @@config = {
42
44
  :api_path => '/pulp/api/v2/',
@@ -72,12 +74,18 @@ module Runcible
72
74
  get_params = options[:params] if options[:params]
73
75
  path = combine_get_params(path, get_params) if get_params
74
76
 
77
+ client_options = {}
78
+ client_options[:timeout] = clone_config[:timeout] if clone_config[:timeout]
79
+ client_options[:open_timeout] = clone_config[:open_timeout] if clone_config[:open_timeout]
80
+
75
81
  if clone_config[:oauth]
76
82
  headers = add_oauth_header(method, path, headers) if clone_config[:oauth]
77
83
  headers["pulp-user"] = clone_config[:user]
78
- client = RestClient::Resource.new(clone_config[:url])
84
+ client = RestClient::Resource.new(clone_config[:url], client_options)
79
85
  else
80
- client = RestClient::Resource.new(clone_config[:url], :user => clone_config[:user], :password => config[:http_auth][:password])
86
+ client_options[:user] = clone_config[:user]
87
+ client_options[:password] = config[:http_auth][:password]
88
+ client = RestClient::Resource.new(clone_config[:url], client_options)
81
89
  end
82
90
 
83
91
  args = [method]
@@ -61,9 +61,10 @@ module Runcible
61
61
  # @param [String] id the consumer group ID
62
62
  # @param [String] type_id the type of content to install (e.g. rpm, errata)
63
63
  # @param [Array] units array of units to install
64
+ # @param [Hash] options to pass to content install
64
65
  # @return [RestClient::Response] task representing the install operation
65
- def self.install_content(id, type_id, units)
66
- self.install_units(id, generate_content(type_id, units))
66
+ def self.install_content(id, type_id, units, options={})
67
+ self.install_units(id, generate_content(type_id, units), options)
67
68
  end
68
69
 
69
70
  # Update content on a consumer group
@@ -71,9 +72,10 @@ module Runcible
71
72
  # @param [String] id the consumer group ID
72
73
  # @param [String] type_id the type of content to update (e.g. rpm, errata)
73
74
  # @param [Array] units array of units to update
75
+ # @param [Hash] options to pass to content update
74
76
  # @return [RestClient::Response] task representing the update operation
75
- def self.update_content(id, type_id, units)
76
- self.update_units(id, generate_content(type_id, units))
77
+ def self.update_content(id, type_id, units, options={})
78
+ self.update_units(id, generate_content(type_id, units), options)
77
79
  end
78
80
 
79
81
  # Uninstall content from a consumer group
@@ -93,10 +95,20 @@ module Runcible
93
95
  # @return [Array] array of formatted content units
94
96
  def self.generate_content(type_id, units)
95
97
  content = []
98
+
99
+ case type_id
100
+ when 'rpm', 'package_group'
101
+ unit_key = :name
102
+ when 'erratum'
103
+ unit_key = :id
104
+ else
105
+ unit_key = :id
106
+ end
107
+
96
108
  units.each do |unit|
97
109
  content_unit = {}
98
110
  content_unit[:type_id] = type_id
99
- content_unit[:unit_key] = { :name => unit }
111
+ content_unit[:unit_key] = { unit_key => unit }
100
112
  content.push(content_unit)
101
113
  end
102
114
  content
@@ -109,12 +109,27 @@ module Runcible
109
109
 
110
110
  # Retrieves the RPM IDs for a single repository
111
111
  #
112
- # @param [String] id the ID of the repository
113
- # @return [RestClient::Response] the set of repository RPM IDs
112
+ # @param [String] id the ID of the repository
113
+ # @return [Array<String>] the array of repository RPM IDs
114
114
  def self.rpm_ids(id)
115
- criteria = {:type_ids=>[Runcible::Extensions::Rpm.content_type],
116
- :fields=>{:unit=>[], :association=>['unit_id']}}
117
- self.unit_search(id, criteria).collect{|i| i['unit_id']}
115
+ # lazy evaluated iterator from zero to infinite
116
+ pages = Enumerator.new { |y| page = 0; loop { y << page; page += 1 } }
117
+
118
+ # TODO this is hotfix, pagination support should be added to Runcible
119
+ pages.inject([]) do |rpm_ids, page|
120
+ page_size = 500
121
+ criteria = { :type_ids => [Runcible::Extensions::Rpm.content_type],
122
+ :fields => { :unit => [], :association => ['unit_id'] },
123
+ :limit => page_size,
124
+ :skip => 0 + page*page_size }
125
+ result = self.unit_search(id, criteria).collect { |i| i['unit_id'] }
126
+ rpm_ids.concat(result)
127
+ if result.empty? || result.size < 500
128
+ break rpm_ids
129
+ else
130
+ rpm_ids
131
+ end
132
+ end
118
133
  end
119
134
 
120
135
  # Retrieves the RPMs for a single repository
@@ -0,0 +1,35 @@
1
+ # Copyright (c) 2012 Red Hat
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
+
25
+ module Runcible
26
+ module Extensions
27
+ class YumRepoMetadataFile < Runcible::Extensions::Unit
28
+
29
+ def self.content_type
30
+ 'yum_repo_metadata_file'
31
+ end
32
+
33
+ end
34
+ end
35
+ end
@@ -1,3 +1,3 @@
1
1
  module Runcible
2
- VERSION = "0.4.9"
2
+ VERSION = "0.4.10"
3
3
  end
metadata CHANGED
@@ -1,136 +1,128 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runcible
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.9
5
- prerelease:
4
+ version: 0.4.10
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-06-04 00:00:00.000000000 Z
12
+ date: 2013-06-13 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
  - !ruby/object:Gem::Dependency
99
95
  name: yard
100
- version_requirements: !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
101
98
  requirements:
102
- - - ">="
99
+ - - ! '>='
103
100
  - !ruby/object:Gem::Version
104
- version: !binary |-
105
- MA==
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
106
105
  none: false
107
- requirement: !ruby/object:Gem::Requirement
108
106
  requirements:
109
- - - ">="
107
+ - - ! '>='
110
108
  - !ruby/object:Gem::Version
111
- version: !binary |-
112
- MA==
113
- none: false
114
- prerelease: false
115
- type: :development
109
+ version: '0'
116
110
  - !ruby/object:Gem::Dependency
117
111
  name: maruku
118
- version_requirements: !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
119
114
  requirements:
120
- - - ">="
115
+ - - ! '>='
121
116
  - !ruby/object:Gem::Version
122
- version: !binary |-
123
- MA==
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
124
121
  none: false
125
- requirement: !ruby/object:Gem::Requirement
126
122
  requirements:
127
- - - ">="
123
+ - - ! '>='
128
124
  - !ruby/object:Gem::Version
129
- version: !binary |-
130
- MA==
131
- none: false
132
- prerelease: false
133
- type: :development
125
+ version: '0'
134
126
  description: Exposing Pulp's juiciest components to the Ruby world.
135
127
  email:
136
128
  - ehelms@redhat.com, jsherril@redhat.com
@@ -139,8 +131,6 @@ extensions: []
139
131
  extra_rdoc_files: []
140
132
  files:
141
133
  - lib/runcible.rb
142
- - lib/runcible/version.rb
143
- - lib/runcible/base.rb
144
134
  - lib/runcible/extensions/package_category.rb
145
135
  - lib/runcible/extensions/errata.rb
146
136
  - lib/runcible/extensions/distributor.rb
@@ -156,6 +146,7 @@ files:
156
146
  - lib/runcible/extensions/yum_importer.rb
157
147
  - lib/runcible/extensions/package_group.rb
158
148
  - lib/runcible/extensions/importer.rb
149
+ - lib/runcible/extensions/yum_repo_metadata_file.rb
159
150
  - lib/runcible/extensions/distribution.rb
160
151
  - lib/runcible/resources/role.rb
161
152
  - lib/runcible/resources/consumer_group.rb
@@ -167,6 +158,8 @@ files:
167
158
  - lib/runcible/resources/user.rb
168
159
  - lib/runcible/resources/unit.rb
169
160
  - lib/runcible/resources/repository_group.rb
161
+ - lib/runcible/version.rb
162
+ - lib/runcible/base.rb
170
163
  - LICENSE
171
164
  - Rakefile
172
165
  - Gemfile
@@ -174,28 +167,27 @@ files:
174
167
  - CONTRIBUTING.md
175
168
  homepage: https://github.com/Katello/runcible
176
169
  licenses: []
177
- post_install_message:
170
+ post_install_message:
178
171
  rdoc_options: []
179
172
  require_paths:
180
173
  - lib
181
174
  required_ruby_version: !ruby/object:Gem::Requirement
175
+ none: false
182
176
  requirements:
183
- - - ">="
177
+ - - ! '>='
184
178
  - !ruby/object:Gem::Version
185
- version: !binary |-
186
- MA==
187
- none: false
179
+ version: '0'
188
180
  required_rubygems_version: !ruby/object:Gem::Requirement
181
+ none: false
189
182
  requirements:
190
- - - ">="
183
+ - - ! '>='
191
184
  - !ruby/object:Gem::Version
192
- version: !binary |-
193
- MA==
194
- none: false
185
+ version: '0'
195
186
  requirements: []
196
- rubyforge_project:
197
- rubygems_version: 1.8.24
198
- signing_key:
187
+ rubyforge_project:
188
+ rubygems_version: 1.8.25
189
+ signing_key:
199
190
  specification_version: 3
200
191
  summary: ''
201
192
  test_files: []
193
+ has_rdoc: