runcible 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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.2.0-0.22.beta.el6.noarch**
7
+ Latest Live Tested Version: **pulp-server-2.2.0-0.22.beta.fc18.noarch**
8
8
 
9
9
  Current stable Runcible: https://github.com/Katello/runcible/tree/0.3
10
10
 
@@ -0,0 +1,35 @@
1
+ # Copyright (c) 2013 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 PuppetModule < Runcible::Extensions::Unit
28
+
29
+ def self.content_type
30
+ 'puppet_module'
31
+ end
32
+
33
+ end
34
+ end
35
+ end
@@ -60,6 +60,19 @@ module Runcible
60
60
  optional[:importer_config] = importer
61
61
  end if importer
62
62
 
63
+ repo_type = if importer.methods.include?(repo_type)
64
+ importer.repo_type
65
+ elsif importer.is_a?(Hash) && importer.has_key?(:repo_type)
66
+ importer[:repo_type]
67
+ else
68
+ nil
69
+ end
70
+
71
+ if optional.has_key?(:importer_type_id) && repo_type
72
+ # pulp needs _repo-type in order to determine the type of repo to create.
73
+ optional[:notes] = { '_repo-type' => importer.repo_type }
74
+ end
75
+
63
76
  optional[:distributors] = distributors.collect do |d|
64
77
  if d.is_a?(Runcible::Models::Distributor)
65
78
  {'distributor_type' => d.type_id,
@@ -223,6 +236,26 @@ module Runcible
223
236
  unit_search(id, criteria).collect{|i| i['metadata'].with_indifferent_access}
224
237
  end
225
238
 
239
+ # Retrieves the puppet module IDs for a single repository
240
+ #
241
+ # @param [String] id the ID of the repository
242
+ # @return [RestClient::Response] the set of repository puppet module IDs
243
+ def puppet_module_ids(id)
244
+ criteria = {:type_ids=>[Runcible::Extensions::PuppetModule.content_type],
245
+ :fields=>{:unit=>[], :association=>['unit_id']}}
246
+
247
+ unit_search(id, criteria).collect{|i| i['unit_id']}
248
+ end
249
+
250
+ # Retrieves the puppet modules for a single repository
251
+ #
252
+ # @param [String] id the ID of the repository
253
+ # @return [RestClient::Response] the set of repository puppet modules
254
+ def puppet_modules(id)
255
+ criteria = {:type_ids=>[Runcible::Extensions::PuppetModule.content_type]}
256
+ unit_search(id, criteria).collect{|i| i['metadata'].with_indifferent_access}
257
+ end
258
+
226
259
  # Creates or updates a sync schedule for a repository
227
260
  #
228
261
  # @param [String] repo_id the ID of the repository
@@ -0,0 +1,51 @@
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 Models
29
+ class PuppetDistributor < Distributor
30
+ attr_accessor 'serve_http', 'serve_https', 'http_dir', 'https_dir', 'absolute_path'
31
+
32
+ def initialize(absolute_path, http, https, params={})
33
+ @absolute_path = absolute_path
34
+ @serve_http = http
35
+ @serve_https = https
36
+ super(params)
37
+ end
38
+
39
+ def type_id
40
+ 'puppet_distributor'
41
+ end
42
+
43
+ def config
44
+ to_ret = self.as_json
45
+ to_ret.delete('auto_publish')
46
+ to_ret.delete('id')
47
+ to_ret
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,45 @@
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 Models
26
+ class PuppetImporter < Importer
27
+ ID = 'puppet_importer'
28
+ REPO_TYPE = 'puppet-repo'
29
+
30
+ attr_accessor 'feed', 'queries', 'remove_missing'
31
+
32
+ def id
33
+ PuppetImporter::ID
34
+ end
35
+
36
+ def repo_type
37
+ PuppetImporter::REPO_TYPE
38
+ end
39
+
40
+ def config
41
+ self.as_json
42
+ end
43
+ end
44
+ end
45
+ end
@@ -25,19 +25,24 @@ module Runcible
25
25
  module Models
26
26
  class YumImporter < Importer
27
27
  ID = 'yum_importer'
28
+ REPO_TYPE = 'rpm-repo'
28
29
 
29
30
  #https://github.com/pulp/pulp/blob/master/rpm-support/plugins/importers/yum_importer/importer.py
30
31
  attr_accessor 'feed', 'ssl_verify', 'ssl_ca_cert', 'ssl_client_cert', 'ssl_client_key',
31
- 'proxy_url', 'proxy_port', 'proxy_pass', 'proxy_user',
32
- 'max_speed', 'verify_size', 'verify_checksum', 'num_threads',
33
- 'newest', 'remove_old', 'num_old_packages', 'purge_orphaned', 'skip', 'checksum_type',
34
- 'num_retries', 'retry_delay'
32
+ 'proxy_url', 'proxy_port', 'proxy_pass', 'proxy_user',
33
+ 'max_speed', 'verify_size', 'verify_checksum', 'num_threads',
34
+ 'newest', 'remove_old', 'num_old_packages', 'purge_orphaned', 'skip', 'checksum_type',
35
+ 'num_retries', 'retry_delay'
35
36
  def id
36
- YumImporter::ID
37
+ YumImporter::ID
38
+ end
39
+
40
+ def repo_type
41
+ YumImporter::REPO_TYPE
37
42
  end
38
43
 
39
44
  def config
40
- as_json
45
+ as_json
41
46
  end
42
47
  end
43
48
  end
@@ -0,0 +1,90 @@
1
+ # Copyright (c) 2013 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
+ require 'active_support/core_ext/hash'
25
+
26
+ module Runcible
27
+ module Resources
28
+ # @see https://pulp-dev-guide.readthedocs.org/en/latest/rest-api/content/index.html
29
+ class Content < Runcible::Base
30
+ # Generates the API path for Contents
31
+ #
32
+ # @param [String] upload_id the id of the upload_request
33
+ # @return [String] the content path, may contain the upload_id if passed
34
+ def self.path(upload_id=nil)
35
+ (upload_id == nil) ? "content/uploads/" : "content/uploads/#{upload_id}/"
36
+ end
37
+
38
+ # Creates an Upload Request
39
+ #
40
+ # Request Body Contents: None
41
+ # @return [RestClient::Response] Pulp returns the upload_id which is used for subsequent operations
42
+ def create_upload_request
43
+ call(:post, path)
44
+ end
45
+
46
+ # Upload bits
47
+ #
48
+ # @param [String] upload_id the id of the upload_request returned by create_upload_request
49
+ # @param [Numeric] offset offset for file assembly
50
+ # @param [File] content content of the file being uploaded to the server
51
+ # @return [RestClient::Response] none
52
+ def upload_bits(upload_id, offset, content)
53
+ required = required_params(binding.send(:local_variables), binding)
54
+ call(:put, path("#{upload_id}/#{offset}/"), :payload => { :required => required })
55
+ end
56
+
57
+ # Import into a repository
58
+ #
59
+ # @param [String] repo_id identifies the associated repository
60
+ # @param [String] unit_type_id identifies the type of unit the upload represents
61
+ # @param [String] upload_id the id of the upload_request returned by create_upload_request
62
+ # @param [Object] unit_key unique identifier for the new unit; the contents are contingent on the type of unit being uploaded
63
+ # @param [Hash] optional container for all optional parameters
64
+ # @return [RestClient::Response] none
65
+ def import_into_repo(repo_id, unit_type_id, upload_id, unit_key, optional={})
66
+ required = required_params(binding.send(:local_variables), binding)
67
+ call(:post, Repository.path("#{repo_id}/actions/import_upload/"), :payload => { :required =>required, :optional => optional })
68
+ end
69
+
70
+ # Delete an upload request
71
+ #
72
+ # @param [String] upload_id the id of the upload_request returned by create_upload_request
73
+ # Query Parameters: None
74
+ # @return [RestClient::Response] none
75
+ def delete_upload_request(upload_id)
76
+ call(:delete, path("#{upload_id}/"))
77
+ end
78
+
79
+ # List all upload requests
80
+ #
81
+ # Query Parameters: None
82
+ # @return [RestClient::Response] the list of IDs for all upload requests on the server; empty list if there are none
83
+ def list_all_requests
84
+ call(:get, path)
85
+ end
86
+
87
+ end
88
+ end
89
+ end
90
+
@@ -1,3 +1,3 @@
1
1
  module Runcible
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runcible
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-04 00:00:00.000000000 Z
12
+ date: 2013-08-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -132,36 +132,40 @@ extra_rdoc_files: []
132
132
  files:
133
133
  - lib/runcible.rb
134
134
  - lib/runcible/instance.rb
135
+ - lib/runcible/version.rb
136
+ - lib/runcible/models/puppet_distributor.rb
137
+ - lib/runcible/models/puppet_importer.rb
135
138
  - lib/runcible/models/iso_distributor.rb
136
- - lib/runcible/models/yum_importer.rb
137
- - lib/runcible/models/yum_distributor.rb
138
- - lib/runcible/models/iso_importer.rb
139
139
  - lib/runcible/models/importer.rb
140
- - lib/runcible/models/export_distributor.rb
141
140
  - lib/runcible/models/yum_clone_distributor.rb
142
141
  - lib/runcible/models/distributor.rb
143
- - lib/runcible/resources/role.rb
144
- - lib/runcible/resources/unit.rb
145
- - lib/runcible/resources/consumer_group.rb
146
- - lib/runcible/resources/user.rb
147
- - lib/runcible/resources/task.rb
148
- - lib/runcible/resources/repository_group.rb
149
- - lib/runcible/resources/repository.rb
150
- - lib/runcible/resources/event_notifier.rb
151
- - lib/runcible/resources/consumer.rb
152
- - lib/runcible/resources/repository_schedule.rb
142
+ - lib/runcible/models/export_distributor.rb
143
+ - lib/runcible/models/yum_distributor.rb
144
+ - lib/runcible/models/iso_importer.rb
145
+ - lib/runcible/models/yum_importer.rb
153
146
  - lib/runcible/base.rb
154
- - lib/runcible/version.rb
147
+ - lib/runcible/extensions/repository.rb
148
+ - lib/runcible/extensions/rpm.rb
155
149
  - lib/runcible/extensions/unit.rb
156
150
  - lib/runcible/extensions/consumer_group.rb
157
- - lib/runcible/extensions/repository.rb
158
- - lib/runcible/extensions/yum_repo_metadata_file.rb
159
- - lib/runcible/extensions/package_category.rb
160
151
  - lib/runcible/extensions/consumer.rb
161
- - lib/runcible/extensions/package_group.rb
162
- - lib/runcible/extensions/rpm.rb
163
152
  - lib/runcible/extensions/distribution.rb
153
+ - lib/runcible/extensions/package_group.rb
154
+ - lib/runcible/extensions/puppet_module.rb
155
+ - lib/runcible/extensions/package_category.rb
164
156
  - lib/runcible/extensions/errata.rb
157
+ - lib/runcible/extensions/yum_repo_metadata_file.rb
158
+ - lib/runcible/resources/repository.rb
159
+ - lib/runcible/resources/user.rb
160
+ - lib/runcible/resources/unit.rb
161
+ - lib/runcible/resources/consumer_group.rb
162
+ - lib/runcible/resources/consumer.rb
163
+ - lib/runcible/resources/role.rb
164
+ - lib/runcible/resources/content.rb
165
+ - lib/runcible/resources/repository_schedule.rb
166
+ - lib/runcible/resources/repository_group.rb
167
+ - lib/runcible/resources/event_notifier.rb
168
+ - lib/runcible/resources/task.rb
165
169
  - LICENSE
166
170
  - Rakefile
167
171
  - Gemfile