runcible 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/runcible.rb +7 -4
- data/lib/runcible/base.rb +1 -1
- data/lib/runcible/extensions/consumer.rb +6 -6
- data/lib/runcible/extensions/distributor.rb +2 -2
- data/lib/runcible/extensions/errata.rb +24 -0
- data/lib/runcible/extensions/repository.rb +11 -4
- data/lib/runcible/extensions/rpm.rb +24 -0
- data/lib/runcible/resources/consumer.rb +14 -5
- data/lib/runcible/resources/consumer_group.rb +49 -0
- data/lib/runcible/resources/event_notifier.rb +4 -4
- data/lib/runcible/resources/repository.rb +1 -1
- data/lib/runcible/resources/repository_schedule.rb +2 -2
- data/lib/runcible/resources/role.rb +3 -3
- data/lib/runcible/resources/task.rb +1 -1
- data/lib/runcible/resources/unit.rb +0 -2
- data/lib/runcible/resources/user.rb +1 -1
- data/lib/runcible/version.rb +1 -1
- metadata +5 -4
data/lib/runcible.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2012
|
1
|
+
# Copyright (c) 2012 Red Hat
|
2
2
|
#
|
3
3
|
# MIT License
|
4
4
|
#
|
@@ -21,11 +21,14 @@
|
|
21
21
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
22
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
23
|
|
24
|
-
require "runcible/version"
|
25
|
-
require "runcible/base"
|
24
|
+
# require "runcible/version"
|
25
|
+
# require "runcible/base"
|
26
26
|
|
27
|
-
resources = Dir[File.dirname(__FILE__) + '/runcible/
|
27
|
+
resources = Dir[File.dirname(__FILE__) + '/runcible/version.rb']
|
28
|
+
resources += Dir[File.dirname(__FILE__) + '/runcible/base.rb']
|
29
|
+
resources += Dir[File.dirname(__FILE__) + '/runcible/resources/*.rb']
|
28
30
|
resources += Dir[File.dirname(__FILE__) + '/runcible/extensions/importer.rb']
|
29
31
|
resources += Dir[File.dirname(__FILE__) + '/runcible/extensions/distributor.rb']
|
30
32
|
resources += Dir[File.dirname(__FILE__) + '/runcible/extensions/*.rb']
|
33
|
+
|
31
34
|
resources.each{ |f| require f }
|
data/lib/runcible/base.rb
CHANGED
@@ -40,16 +40,16 @@ module Runcible
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
def self.
|
44
|
-
self.
|
43
|
+
def self.install_content(id, type_id, units)
|
44
|
+
self.install_units(id, generate_content(type_id, units))
|
45
45
|
end
|
46
46
|
|
47
|
-
def self.
|
48
|
-
self.
|
47
|
+
def self.update_content(id, type_id, units)
|
48
|
+
self.update_units(id, generate_content(type_id, units))
|
49
49
|
end
|
50
50
|
|
51
|
-
def self.
|
52
|
-
self.
|
51
|
+
def self.uninstall_content(id, type_id, units)
|
52
|
+
self.uninstall_units(id, generate_content(type_id, units))
|
53
53
|
end
|
54
54
|
|
55
55
|
def self.generate_content(type_id, units)
|
@@ -1,3 +1,27 @@
|
|
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
|
+
|
1
25
|
module Runcible
|
2
26
|
module Extensions
|
3
27
|
class Errata < Runcible::Base
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2012
|
1
|
+
# Copyright (c) 2012 Red Hat
|
2
2
|
#
|
3
3
|
# MIT License
|
4
4
|
#
|
@@ -45,13 +45,20 @@ module Runcible
|
|
45
45
|
|
46
46
|
optional[:distributors] = distributors.collect do |d|
|
47
47
|
if d.is_a?(Distributor)
|
48
|
-
|
48
|
+
{'distributor_type' => d.type_id,
|
49
|
+
"distributor_config" => d.config,
|
50
|
+
"auto_publish" => d.auto_publish,
|
51
|
+
"distributor_id" => d.id
|
52
|
+
}
|
49
53
|
else
|
50
|
-
|
54
|
+
{'distributor_type' => d['type_id'],
|
55
|
+
"distributor_config" => d['config'],
|
56
|
+
"auto_publish" => d['auto_publish'],
|
57
|
+
"distributor_id" => d['id']
|
58
|
+
}
|
51
59
|
end
|
52
60
|
end if !distributors.empty?
|
53
61
|
optional[:id] = id
|
54
|
-
#debugger
|
55
62
|
create(id, optional)
|
56
63
|
end
|
57
64
|
|
@@ -1,3 +1,27 @@
|
|
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
|
+
|
1
25
|
module Runcible
|
2
26
|
module Extensions
|
3
27
|
class Rpm < Runcible::Base
|
@@ -40,10 +40,10 @@ module Runcible
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def self.update(id, optional={})
|
43
|
-
|
44
|
-
call(:put, path(id), :payload => { :required => required, :optional => optional })
|
43
|
+
call(:put, path(id), :payload => { :delta => optional })
|
45
44
|
end
|
46
45
|
|
46
|
+
|
47
47
|
def self.upload_profile(id, content_type, profile)
|
48
48
|
required = required_params(binding.send(:local_variables), binding, ["id"])
|
49
49
|
call(:post, path("#{id}/profiles/"), :payload => { :required => required })
|
@@ -57,6 +57,15 @@ module Runcible
|
|
57
57
|
call(:delete, path(id))
|
58
58
|
end
|
59
59
|
|
60
|
+
def self.retrieve_binding(id, repo_id, distributor_id)
|
61
|
+
call(:get, path("#{id}/bindings/#{repo_id}/#{distributor_id}"))
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.retrieve_bindings(id)
|
65
|
+
call(:get, path("#{id}/bindings/"))
|
66
|
+
end
|
67
|
+
|
68
|
+
|
60
69
|
def self.bind(id, repo_id, distributor_id)
|
61
70
|
required = required_params(binding.send(:local_variables), binding, ["id"])
|
62
71
|
call(:post, path("#{id}/bindings"), :payload => { :required => required })
|
@@ -70,17 +79,17 @@ module Runcible
|
|
70
79
|
call(:get, path("#{id}/bindings/"))
|
71
80
|
end
|
72
81
|
|
73
|
-
def self.
|
82
|
+
def self.install_units(id, units, options="")
|
74
83
|
required = required_params(binding.send(:local_variables), binding, ["id"])
|
75
84
|
call(:post, path("#{id}/actions/content/install/"), :payload => { :required => required })
|
76
85
|
end
|
77
86
|
|
78
|
-
def self.
|
87
|
+
def self.update_units(id, units, options="")
|
79
88
|
required = required_params(binding.send(:local_variables), binding, ["id"])
|
80
89
|
call(:post, path("#{id}/actions/content/update/"), :payload => { :required => required })
|
81
90
|
end
|
82
91
|
|
83
|
-
def self.
|
92
|
+
def self.uninstall_units(id, units, options="")
|
84
93
|
required = required_params(binding.send(:local_variables), binding, ["id"])
|
85
94
|
call(:post, path("#{id}/actions/content/uninstall/"), :payload => { :required => required })
|
86
95
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# Copyright (c) 2012 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/core_ext/hash'
|
25
|
+
|
26
|
+
module Runcible
|
27
|
+
module Resources
|
28
|
+
class ConsumerGroup < Runcible::Base
|
29
|
+
|
30
|
+
def self.path(id=nil)
|
31
|
+
groups = "consumer_groups/"
|
32
|
+
id.nil? ? groups : groups + "#{id}/"
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.create(id, optional={})
|
36
|
+
required = required_params(binding.send(:local_variables), binding)
|
37
|
+
call(:post, path, :payload => { :required => required, :optional => optional })
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.delete(id)
|
41
|
+
call(:delete, path(id))
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.retrieve(id)
|
45
|
+
call(:get, path(id))
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -4,10 +4,10 @@ module Runcible
|
|
4
4
|
class EventNotifier < Runcible::Base
|
5
5
|
|
6
6
|
class EventTypes
|
7
|
-
REPO_SYNC_COMPLETE = 'repo
|
8
|
-
REPO_SYNC_START = 'repo
|
9
|
-
REPO_PUBLISH_COMPLETE = 'repo
|
10
|
-
REPO_PUBLISH_START = 'repo
|
7
|
+
REPO_SYNC_COMPLETE = 'repo.sync.finish'
|
8
|
+
REPO_SYNC_START = 'repo.sync.start'
|
9
|
+
REPO_PUBLISH_COMPLETE = 'repo.publish.finish'
|
10
|
+
REPO_PUBLISH_START = 'repo.publish.start'
|
11
11
|
end
|
12
12
|
|
13
13
|
class NotifierTypes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2012
|
1
|
+
# Copyright (c) 2012 Red Hat
|
2
2
|
#
|
3
3
|
# MIT License
|
4
4
|
#
|
@@ -29,7 +29,7 @@ module Runcible
|
|
29
29
|
|
30
30
|
def self.path(repo_id, importer, schedule_id=nil)
|
31
31
|
repo_path = Runcible::Resources::Repository.path(repo_id)
|
32
|
-
path = "#{repo_path}importers/#{importer}/
|
32
|
+
path = "#{repo_path}importers/#{importer}/schedules/sync/"
|
33
33
|
(schedule_id == nil) ? path : "#{path}#{schedule_id}/"
|
34
34
|
end
|
35
35
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2012
|
1
|
+
# Copyright (c) 2012 Red Hat
|
2
2
|
#
|
3
3
|
# MIT License
|
4
4
|
#
|
@@ -32,11 +32,11 @@ module Runcible
|
|
32
32
|
|
33
33
|
def self.add(id, login)
|
34
34
|
required = required_params(binding.send(:local_variables), binding, ["id"])
|
35
|
-
call(:post, "#{path(id)}
|
35
|
+
call(:post, "#{path(id)}users/", :payload => { :required => required })
|
36
36
|
end
|
37
37
|
|
38
38
|
def self.remove(id, login)
|
39
|
-
call(:delete, "#{path(id)}
|
39
|
+
call(:delete, "#{path(id)}users/#{login}/")
|
40
40
|
end
|
41
41
|
|
42
42
|
end
|
data/lib/runcible/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: runcible
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Eric D Helms
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-10-
|
18
|
+
date: 2012-10-25 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: Exposing Pulp's juiciest components to the Ruby world.
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- lib/runcible/resources/consumer.rb
|
49
49
|
- lib/runcible/resources/user.rb
|
50
50
|
- lib/runcible/resources/role.rb
|
51
|
+
- lib/runcible/resources/consumer_group.rb
|
51
52
|
- lib/runcible/resources/repository.rb
|
52
53
|
- lib/runcible/resources/unit.rb
|
53
54
|
homepage: https://github.com/Katello/runcible
|