hammer_cli_katello 0.0.3 → 0.0.4
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.
- checksums.yaml +8 -8
- data/lib/hammer_cli_katello.rb +26 -6
- data/lib/hammer_cli_katello/activation_key.rb +176 -0
- data/lib/hammer_cli_katello/associating_commands.rb +67 -0
- data/lib/hammer_cli_katello/capsule.rb +100 -0
- data/lib/hammer_cli_katello/commands.rb +55 -0
- data/lib/hammer_cli_katello/content_host.rb +90 -0
- data/lib/hammer_cli_katello/content_view.rb +193 -0
- data/lib/hammer_cli_katello/content_view_puppet_module.rb +74 -0
- data/lib/hammer_cli_katello/content_view_version.rb +81 -0
- data/lib/hammer_cli_katello/exception_handler.rb +40 -0
- data/lib/hammer_cli_katello/filter.rb +83 -0
- data/lib/hammer_cli_katello/filter_rule.rb +73 -0
- data/lib/hammer_cli_katello/gpg_key.rb +34 -56
- data/lib/hammer_cli_katello/host_collection.rb +91 -0
- data/lib/hammer_cli_katello/i18n.rb +24 -0
- data/lib/hammer_cli_katello/id_resolver.rb +39 -0
- data/lib/hammer_cli_katello/lifecycle_environment.rb +63 -45
- data/lib/hammer_cli_katello/organization.rb +27 -23
- data/lib/hammer_cli_katello/ping.rb +20 -23
- data/lib/hammer_cli_katello/product.rb +69 -62
- data/lib/hammer_cli_katello/puppet_module.rb +47 -0
- data/lib/hammer_cli_katello/repository.rb +147 -0
- data/lib/hammer_cli_katello/repository_set.rb +88 -0
- data/lib/hammer_cli_katello/subscription.rb +59 -12
- data/lib/hammer_cli_katello/sync_plan.rb +74 -0
- data/lib/hammer_cli_katello/version.rb +1 -1
- data/locale/hammer-cli-katello.pot +1215 -0
- data/locale/zanata.xml +29 -0
- metadata +28 -13
- data/lib/hammer_cli_katello/provider.rb +0 -68
- data/lib/hammer_cli_katello/resource.rb +0 -0
- data/lib/hammer_cli_katello/system.rb +0 -94
- data/lib/hammer_cli_katello/system_group.rb +0 -48
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzM5ZDExYmNkY2MxMDAyMTdjMGUwZTMyZWYyMTQwMmZlOTNjMDQyZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODYxMzRhMzNmMzQxZjYxOWJkOTY4OWNjYTcxMGRlNzY1OTA3ZTk1MQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjA1ODNmMzZmYzllNjMzNzExYmI1MjhlOTkyOGIyYTJlMWY2MGQzNzRlMGU1
|
10
|
+
OTUzN2ZkMjQ5MjQzYzc0NWI3MTIxYjhiZWMxMDFlZmM0M2ViOTljNTRmNDUw
|
11
|
+
OWViNWI0NmQ3YzJlNmQxYzJlOWYzMjU5ZmY3MGY1MjU1YWZjZmE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjZmMDRiMGJiMjQ3OTczY2VlMzBmNmM3YzNjYWExMzUzMDM5MDNmMmM3MmZk
|
14
|
+
MTIyNzAxYjE1NmE2YTQ3YTI2ZjA2MDgyYTE0OWUzZGM5ZDkyZGY5ZGE4MjA5
|
15
|
+
NTNhOGZiYzc5ZTA3ZGZmNzViMmIwMTU0OThmODMyNDI0MTMyN2I=
|
data/lib/hammer_cli_katello.rb
CHANGED
@@ -3,17 +3,37 @@ require 'hammer_cli_foreman'
|
|
3
3
|
require 'hammer_cli/exit_codes'
|
4
4
|
require 'hammer_cli_foreman/commands'
|
5
5
|
require 'hammer_cli_foreman/output/fields'
|
6
|
-
|
7
|
-
require 'katello_api'
|
6
|
+
require 'hammer_cli_foreman_tasks'
|
8
7
|
|
9
8
|
module HammerCLIKatello
|
10
9
|
|
11
10
|
def self.exception_handler_class
|
12
|
-
|
11
|
+
HammerCLIKatello::ExceptionHandler
|
13
12
|
end
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
require "hammer_cli_katello/commands"
|
15
|
+
require "hammer_cli_katello/associating_commands"
|
16
|
+
require "hammer_cli_katello/version"
|
17
|
+
require "hammer_cli_katello/exception_handler"
|
18
|
+
require 'hammer_cli_katello/i18n'
|
19
|
+
require "hammer_cli_katello/version"
|
20
|
+
require 'hammer_cli_katello/id_resolver'
|
21
|
+
|
22
|
+
# commands
|
23
|
+
require "hammer_cli_katello/activation_key"
|
24
|
+
require "hammer_cli_katello/gpg_key"
|
25
|
+
require "hammer_cli_katello/lifecycle_environment"
|
26
|
+
require "hammer_cli_katello/organization"
|
27
|
+
require "hammer_cli_katello/ping"
|
28
|
+
require "hammer_cli_katello/product"
|
29
|
+
require "hammer_cli_katello/puppet_module"
|
30
|
+
require "hammer_cli_katello/repository"
|
31
|
+
require "hammer_cli_katello/repository_set"
|
32
|
+
require "hammer_cli_katello/subscription"
|
33
|
+
require "hammer_cli_katello/sync_plan"
|
34
|
+
require "hammer_cli_katello/host_collection"
|
35
|
+
require "hammer_cli_katello/content_host"
|
36
|
+
require "hammer_cli_katello/content_view"
|
37
|
+
require "hammer_cli_katello/capsule"
|
18
38
|
|
19
39
|
end
|
@@ -0,0 +1,176 @@
|
|
1
|
+
module HammerCLIKatello
|
2
|
+
|
3
|
+
class ActivationKeyCommand < HammerCLIKatello::Command
|
4
|
+
resource :activation_keys
|
5
|
+
|
6
|
+
class ListCommand < HammerCLIKatello::ListCommand
|
7
|
+
action :index
|
8
|
+
|
9
|
+
output do
|
10
|
+
field :id, _("ID")
|
11
|
+
field :name, _("Name")
|
12
|
+
field :format_consumed, _("Consumed")
|
13
|
+
from :environment do
|
14
|
+
field :name, _("Lifecycle Environment")
|
15
|
+
end
|
16
|
+
from :content_view do
|
17
|
+
field :name, _("Content View")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def extend_data(data)
|
22
|
+
data["format_consumed"] = _("%{consumed} of %{limit}") %
|
23
|
+
{
|
24
|
+
:consumed => data["usage_count"],
|
25
|
+
:limit => data["usage_limit"] == -1 ? _("Unlimited") : data["usage_limit"]
|
26
|
+
}
|
27
|
+
data
|
28
|
+
end
|
29
|
+
|
30
|
+
build_options
|
31
|
+
end
|
32
|
+
|
33
|
+
class InfoCommand < HammerCLIKatello::InfoCommand
|
34
|
+
action :show
|
35
|
+
|
36
|
+
output do
|
37
|
+
field :name, _("Name")
|
38
|
+
field :id, _("ID")
|
39
|
+
field :description, _("Description")
|
40
|
+
from :environment do
|
41
|
+
field :name, _("Lifecycle Environment")
|
42
|
+
end
|
43
|
+
from :content_view do
|
44
|
+
field :name, _("Content View")
|
45
|
+
end
|
46
|
+
|
47
|
+
collection :host_collections, _("Host Collections") do
|
48
|
+
field :id, _("ID")
|
49
|
+
field :name, _("Name")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
build_options
|
54
|
+
end
|
55
|
+
|
56
|
+
class CreateCommand < HammerCLIKatello::CreateCommand
|
57
|
+
action :create
|
58
|
+
success_message _("Activation key created")
|
59
|
+
failure_message _("Could not create the activation key")
|
60
|
+
|
61
|
+
build_options
|
62
|
+
end
|
63
|
+
|
64
|
+
class UpdateCommand < HammerCLIKatello::UpdateCommand
|
65
|
+
action :update
|
66
|
+
success_message _("Activation key updated")
|
67
|
+
failure_message _("Could not update the activation key")
|
68
|
+
|
69
|
+
build_options
|
70
|
+
end
|
71
|
+
|
72
|
+
class SubscriptionsCommand < HammerCLIKatello::ListCommand
|
73
|
+
resource :subscriptions, :index
|
74
|
+
desc _("List associated subscriptions")
|
75
|
+
command_name "subscriptions"
|
76
|
+
|
77
|
+
output do
|
78
|
+
field :id, _("ID")
|
79
|
+
field :product_name, _("Name")
|
80
|
+
end
|
81
|
+
|
82
|
+
option '--id', 'ID', _("resource ID")
|
83
|
+
|
84
|
+
def request_params
|
85
|
+
{
|
86
|
+
'activation_key_id' => option_id
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
90
|
+
validate_options do
|
91
|
+
all(:option_id).required
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
class AddSubscriptionCommand < HammerCLIKatello::UpdateCommand
|
96
|
+
resource :subscriptions, :create
|
97
|
+
|
98
|
+
desc "Add subscription"
|
99
|
+
command_name "add-subscription"
|
100
|
+
|
101
|
+
option '--id', 'ID', _("resource ID")
|
102
|
+
option '--subscription-id', 'ID', _("subscription ID")
|
103
|
+
option '--quantity', 'QUANTITY', _("subscription quantity")
|
104
|
+
|
105
|
+
def request_params
|
106
|
+
{
|
107
|
+
'activation_key_id' => option_id,
|
108
|
+
'id' => option_subscription_id,
|
109
|
+
'quantity' => option_quantity
|
110
|
+
}
|
111
|
+
end
|
112
|
+
|
113
|
+
validate_options do
|
114
|
+
all(:option_id, :option_subscription_id).required
|
115
|
+
end
|
116
|
+
|
117
|
+
success_message _("Subscription added to activation key")
|
118
|
+
failure_message _("Could not add subscription to activation key")
|
119
|
+
end
|
120
|
+
|
121
|
+
class RemoveSubscriptionCommand < HammerCLIKatello::UpdateCommand
|
122
|
+
resource :subscriptions, :destroy
|
123
|
+
|
124
|
+
desc _("Remove subscription")
|
125
|
+
command_name "remove-subscription"
|
126
|
+
|
127
|
+
option '--id', 'ID', _("resource ID")
|
128
|
+
option '--subscription-id', 'ID', _("subscription ID")
|
129
|
+
|
130
|
+
def request_params
|
131
|
+
{
|
132
|
+
'id' => option_subscription_id,
|
133
|
+
'activation_key_id' => option_id
|
134
|
+
}
|
135
|
+
end
|
136
|
+
|
137
|
+
validate_options do
|
138
|
+
all(:option_id, :option_subscription_id).required
|
139
|
+
end
|
140
|
+
success_message _("Subscription removed from activation key")
|
141
|
+
failure_message _("Could not remove subscription from activation key")
|
142
|
+
end
|
143
|
+
|
144
|
+
class HostCollectionsCommand < HammerCLIKatello::ListCommand
|
145
|
+
resource :host_collections, :index
|
146
|
+
|
147
|
+
desc _("List associated host collections")
|
148
|
+
command_name "host-collections"
|
149
|
+
|
150
|
+
output do
|
151
|
+
field :id, _("ID")
|
152
|
+
field :name, _("Name")
|
153
|
+
end
|
154
|
+
|
155
|
+
option '--id', 'ID', _("resource ID")
|
156
|
+
|
157
|
+
def request_params
|
158
|
+
{
|
159
|
+
'activation_key_id' => option_id
|
160
|
+
}
|
161
|
+
end
|
162
|
+
|
163
|
+
validate_options do
|
164
|
+
all(:option_id).required
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
HammerCLIKatello::AssociatingCommands::HostCollection.extend_command(self)
|
169
|
+
|
170
|
+
autoload_subcommands
|
171
|
+
end
|
172
|
+
|
173
|
+
end
|
174
|
+
|
175
|
+
HammerCLI::MainCommand.subcommand("activation-key", _("Manipulate activation keys."),
|
176
|
+
HammerCLIKatello::ActivationKeyCommand)
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module HammerCLIKatello
|
2
|
+
module AssociatingCommands
|
3
|
+
|
4
|
+
module Repository
|
5
|
+
extend HammerCLIForeman::AssociatingCommands::CommandExtension
|
6
|
+
|
7
|
+
class AddRepositoryCommand < HammerCLIKatello::AddAssociatedCommand
|
8
|
+
command_name 'add-repository'
|
9
|
+
associated_resource :repositories
|
10
|
+
|
11
|
+
success_message _("The repository has been associated")
|
12
|
+
failure_message _("Could not add repository")
|
13
|
+
end
|
14
|
+
|
15
|
+
class RemoveRepositoryCommand < HammerCLIKatello::RemoveAssociatedCommand
|
16
|
+
command_name 'remove-repository'
|
17
|
+
associated_resource :repositories
|
18
|
+
|
19
|
+
success_message _("The repository has been removed")
|
20
|
+
failure_message _("Could not remove repository")
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
module HostCollection
|
26
|
+
extend HammerCLIForeman::AssociatingCommands::CommandExtension
|
27
|
+
|
28
|
+
class AddHostCollectionCommand < HammerCLIKatello::AddAssociatedCommand
|
29
|
+
command_name 'add-host-collection'
|
30
|
+
associated_resource :host_collections
|
31
|
+
|
32
|
+
success_message _("The host collection has been associated")
|
33
|
+
failure_message _("Could not add host collection")
|
34
|
+
end
|
35
|
+
|
36
|
+
class RemoveHostCollectionCommand < HammerCLIKatello::RemoveAssociatedCommand
|
37
|
+
command_name 'remove-repository'
|
38
|
+
associated_resource :host_collections
|
39
|
+
|
40
|
+
success_message _("The host collection has been removed")
|
41
|
+
failure_message _("Could not remove host collection")
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
module ContentHost
|
47
|
+
extend HammerCLIForeman::AssociatingCommands::CommandExtension
|
48
|
+
|
49
|
+
class AddContentHostCommand < HammerCLIKatello::AddAssociatedCommand
|
50
|
+
command_name 'add-content-host'
|
51
|
+
associated_resource :systems
|
52
|
+
|
53
|
+
success_message _("The content host has been added")
|
54
|
+
failure_message _("Could not add content host")
|
55
|
+
end
|
56
|
+
|
57
|
+
class RemoveContentHostCommand < HammerCLIKatello::RemoveAssociatedCommand
|
58
|
+
command_name 'remove-content-host'
|
59
|
+
associated_resource :systems
|
60
|
+
|
61
|
+
success_message _("The content host has been removed")
|
62
|
+
failure_message _("Could not remove content host")
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
module HammerCLIKatello
|
2
|
+
class Capsule < HammerCLIForeman::Command
|
3
|
+
resource :capsules
|
4
|
+
|
5
|
+
class ListCommand < HammerCLIKatello::ListCommand
|
6
|
+
action :index
|
7
|
+
|
8
|
+
output do
|
9
|
+
field :id, _("Id")
|
10
|
+
field :name, _("Name")
|
11
|
+
field :url, _("URL")
|
12
|
+
end
|
13
|
+
|
14
|
+
build_options
|
15
|
+
end
|
16
|
+
|
17
|
+
class InfoCommand < HammerCLIKatello::InfoCommand
|
18
|
+
|
19
|
+
action :show
|
20
|
+
|
21
|
+
output ListCommand.output_definition do
|
22
|
+
field :_features, _("Features"), Fields::List
|
23
|
+
field :created_at, _("Created at"), Fields::Date
|
24
|
+
field :updated_at, _("Updated at"), Fields::Date
|
25
|
+
end
|
26
|
+
|
27
|
+
def extend_data(proxy)
|
28
|
+
proxy['_features'] = proxy['features'].map { |f| f['name'] }
|
29
|
+
proxy
|
30
|
+
end
|
31
|
+
|
32
|
+
build_options
|
33
|
+
end
|
34
|
+
|
35
|
+
class Content < HammerCLI::AbstractCommand
|
36
|
+
command_name 'content'
|
37
|
+
desc _('Manage the capsule content')
|
38
|
+
|
39
|
+
class ListLifecycleEnvironmentsCommand < HammerCLIKatello::ListCommand
|
40
|
+
resource :capsule_content, :lifecycle_environments
|
41
|
+
command_name 'lifecycle-environments'
|
42
|
+
|
43
|
+
output do
|
44
|
+
field :id, _("ID")
|
45
|
+
field :name, _("Name")
|
46
|
+
end
|
47
|
+
|
48
|
+
build_options
|
49
|
+
end
|
50
|
+
|
51
|
+
class ListAvailableLifecycleEnvironmentsCommand < HammerCLIKatello::ListCommand
|
52
|
+
resource :capsule_content, :available_lifecycle_environments
|
53
|
+
command_name 'available-lifecycle-environments'
|
54
|
+
|
55
|
+
output do
|
56
|
+
field :id, _("ID")
|
57
|
+
field :name, _("Name")
|
58
|
+
end
|
59
|
+
|
60
|
+
build_options
|
61
|
+
end
|
62
|
+
|
63
|
+
class AddLifecycleEnvironmentCommand < HammerCLIKatello::Command
|
64
|
+
resource :capsule_content, :add_lifecycle_environment
|
65
|
+
command_name 'add-lifecycle-environment'
|
66
|
+
|
67
|
+
success_message _("Lifecycle environment successfully added to the capsule")
|
68
|
+
failure_message _("Could not add the lifecycle environment to the capsule")
|
69
|
+
|
70
|
+
build_options
|
71
|
+
end
|
72
|
+
|
73
|
+
class RemoveLifecycleEnvironmentCommand < HammerCLIKatello::Command
|
74
|
+
resource :capsule_content, :remove_lifecycle_environment
|
75
|
+
command_name 'remove-lifecycle-environment'
|
76
|
+
|
77
|
+
success_message _("Lifecycle environment successfully removed from the capsule")
|
78
|
+
failure_message _("Could not remove the lifecycle environment from the capsule")
|
79
|
+
|
80
|
+
build_options
|
81
|
+
end
|
82
|
+
|
83
|
+
class SyncCommand < HammerCLIForemanTasks::AsyncCommand
|
84
|
+
resource :capsule_content, :sync
|
85
|
+
command_name "synchronize"
|
86
|
+
|
87
|
+
success_message _("Capsule content is being synchronized in task %{id}")
|
88
|
+
failure_message _("Could not synchronize capsule content")
|
89
|
+
|
90
|
+
build_options
|
91
|
+
end
|
92
|
+
|
93
|
+
autoload_subcommands
|
94
|
+
end
|
95
|
+
|
96
|
+
autoload_subcommands
|
97
|
+
end
|
98
|
+
|
99
|
+
HammerCLI::MainCommand.subcommand "capsule", _("Manipulate capsule"), Capsule
|
100
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module HammerCLIKatello
|
2
|
+
|
3
|
+
module ResolverCommons
|
4
|
+
|
5
|
+
def self.included(base)
|
6
|
+
base.extend(ClassMethods)
|
7
|
+
end
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
|
11
|
+
def resolver
|
12
|
+
api = HammerCLI::Connection.get("foreman").api
|
13
|
+
HammerCLIKatello::IdResolver.new(api, HammerCLIKatello::Searchables.new)
|
14
|
+
end
|
15
|
+
|
16
|
+
def searchables
|
17
|
+
@searchables ||= HammerCLIKatello::Searchables.new
|
18
|
+
@searchables
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class Command < HammerCLIForeman::Command
|
25
|
+
include HammerCLIKatello::ResolverCommons
|
26
|
+
end
|
27
|
+
|
28
|
+
class ListCommand < HammerCLIForeman::ListCommand
|
29
|
+
include HammerCLIKatello::ResolverCommons
|
30
|
+
end
|
31
|
+
|
32
|
+
class InfoCommand < HammerCLIForeman::InfoCommand
|
33
|
+
include HammerCLIKatello::ResolverCommons
|
34
|
+
end
|
35
|
+
|
36
|
+
class CreateCommand < HammerCLIForeman::CreateCommand
|
37
|
+
include HammerCLIKatello::ResolverCommons
|
38
|
+
end
|
39
|
+
|
40
|
+
class UpdateCommand < HammerCLIForeman::UpdateCommand
|
41
|
+
include HammerCLIKatello::ResolverCommons
|
42
|
+
end
|
43
|
+
|
44
|
+
class DeleteCommand < HammerCLIForeman::DeleteCommand
|
45
|
+
include HammerCLIKatello::ResolverCommons
|
46
|
+
end
|
47
|
+
|
48
|
+
class AddAssociatedCommand < HammerCLIForeman::AddAssociatedCommand
|
49
|
+
include HammerCLIKatello::ResolverCommons
|
50
|
+
end
|
51
|
+
|
52
|
+
class RemoveAssociatedCommand < HammerCLIForeman::RemoveAssociatedCommand
|
53
|
+
include HammerCLIKatello::ResolverCommons
|
54
|
+
end
|
55
|
+
end
|