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
@@ -1,83 +1,101 @@
|
|
1
1
|
module HammerCLIKatello
|
2
2
|
|
3
|
-
class LifecycleEnvironmentCommand <
|
4
|
-
|
5
|
-
class ListCommand < HammerCLIForeman::ListCommand
|
6
|
-
resource KatelloApi::Resources::Environment, :index
|
3
|
+
class LifecycleEnvironmentCommand < HammerCLIKatello::Command
|
4
|
+
resource :lifecycle_environments
|
7
5
|
|
6
|
+
class ListCommand < HammerCLIKatello::ListCommand
|
8
7
|
output do
|
9
|
-
field :id, "ID"
|
10
|
-
field :name, "Name"
|
8
|
+
field :id, _("ID")
|
9
|
+
field :name, _("Name")
|
10
|
+
from :prior do
|
11
|
+
field :name, _("Prior")
|
12
|
+
end
|
11
13
|
end
|
12
14
|
|
13
|
-
|
15
|
+
build_options
|
14
16
|
end
|
15
17
|
|
16
|
-
class
|
17
|
-
|
18
|
-
|
19
|
-
identifiers :id
|
18
|
+
class PathsCommand < HammerCLIKatello::ListCommand
|
19
|
+
action :paths
|
20
|
+
command_name "paths"
|
20
21
|
|
21
22
|
output do
|
22
|
-
field :
|
23
|
-
field :name, "Name"
|
24
|
-
field :label, "Label"
|
25
|
-
field :description, "Description"
|
26
|
-
from :organization do
|
27
|
-
field :name, "Organization"
|
28
|
-
end
|
29
|
-
field :library, "Library"
|
30
|
-
field :prior, "Prior Lifecycle Environment"
|
23
|
+
field :pretty_path, _("Lifecycle Path")
|
31
24
|
end
|
32
25
|
|
33
|
-
def
|
34
|
-
|
26
|
+
def extend_data(data)
|
27
|
+
route = []
|
28
|
+
data["path"].each { |step| route << step["environment"]["name"] }
|
29
|
+
|
30
|
+
data[:pretty_path] = route.join(" >> ")
|
31
|
+
data
|
35
32
|
end
|
36
33
|
|
37
|
-
|
34
|
+
build_options
|
38
35
|
end
|
39
36
|
|
40
|
-
class
|
41
|
-
|
42
|
-
|
43
|
-
|
37
|
+
class InfoCommand < HammerCLIKatello::InfoCommand
|
38
|
+
output do
|
39
|
+
field :id, _("ID")
|
40
|
+
field :name, _("Name")
|
41
|
+
field :label, _("Label")
|
42
|
+
field :description, _("Description")
|
43
|
+
from :organization do
|
44
|
+
field :name, _("Organization")
|
45
|
+
end
|
46
|
+
field :library, _("Library")
|
47
|
+
from :prior do
|
48
|
+
field :name, _("Prior Lifecycle Environment")
|
49
|
+
end
|
50
|
+
end
|
44
51
|
|
45
|
-
|
52
|
+
build_options
|
46
53
|
end
|
47
54
|
|
48
|
-
class
|
49
|
-
success_message "Environment
|
50
|
-
failure_message "Could not
|
51
|
-
resource KatelloApi::Resources::Environment, :update
|
52
|
-
|
53
|
-
identifiers :id
|
55
|
+
class CreateCommand < HammerCLIKatello::CreateCommand
|
56
|
+
success_message _("Environment created")
|
57
|
+
failure_message _("Could not create environment")
|
54
58
|
|
55
59
|
def request_params
|
56
|
-
super
|
60
|
+
params = super
|
61
|
+
params["prior"] = resolver.lifecycle_environment_id(
|
62
|
+
HammerCLI.option_accessor_name("name") => params["prior"],
|
63
|
+
HammerCLI.option_accessor_name("organization_id") => params["organization_id"]
|
64
|
+
)
|
65
|
+
params
|
57
66
|
end
|
58
67
|
|
59
|
-
|
68
|
+
build_options
|
60
69
|
end
|
61
70
|
|
62
|
-
class
|
63
|
-
success_message "Environment
|
64
|
-
failure_message "Could not
|
65
|
-
resource KatelloApi::Resources::Environment, :destroy
|
66
|
-
|
67
|
-
identifiers :id
|
71
|
+
class UpdateCommand < HammerCLIKatello::UpdateCommand
|
72
|
+
success_message _("Environment updated")
|
73
|
+
failure_message _("Could not update environment")
|
68
74
|
|
69
75
|
def request_params
|
70
|
-
super
|
76
|
+
params = super
|
77
|
+
params["prior"] = resolver.lifecycle_environment_id(
|
78
|
+
HammerCLI.option_accessor_name("name") => params["prior"],
|
79
|
+
HammerCLI.option_accessor_name("organization_id") => params["organization_id"]
|
80
|
+
)
|
81
|
+
params
|
71
82
|
end
|
72
83
|
|
73
|
-
|
84
|
+
build_options
|
85
|
+
end
|
86
|
+
|
87
|
+
class DeleteCommand < HammerCLIKatello::DeleteCommand
|
88
|
+
success_message _("Environment deleted")
|
89
|
+
failure_message _("Could not delete environment")
|
90
|
+
|
91
|
+
build_options
|
74
92
|
end
|
75
93
|
|
76
94
|
autoload_subcommands
|
77
95
|
end
|
78
96
|
|
79
97
|
cmd_name = "lifecycle-environment"
|
80
|
-
cmd_desc = "manipulate lifecycle_environments on the server"
|
98
|
+
cmd_desc = _("manipulate lifecycle_environments on the server")
|
81
99
|
cmd_cls = HammerCLIKatello::LifecycleEnvironmentCommand
|
82
100
|
HammerCLI::MainCommand.subcommand(cmd_name, cmd_desc, cmd_cls)
|
83
101
|
end
|
@@ -3,52 +3,56 @@ module HammerCLIKatello
|
|
3
3
|
class Organization < HammerCLIForeman::Organization
|
4
4
|
|
5
5
|
class ListCommand < HammerCLIForeman::Organization::ListCommand
|
6
|
-
|
6
|
+
include HammerCLIKatello::ResolverCommons
|
7
|
+
resource :organizations, :index
|
7
8
|
|
8
9
|
output do
|
9
|
-
field :label, "Label"
|
10
|
-
field :description, "Description"
|
10
|
+
field :label, _("Label")
|
11
|
+
field :description, _("Description")
|
11
12
|
end
|
12
13
|
|
13
|
-
|
14
|
+
build_options
|
14
15
|
end
|
15
16
|
|
16
17
|
class InfoCommand < HammerCLIForeman::Organization::InfoCommand
|
17
|
-
|
18
|
+
include HammerCLIKatello::ResolverCommons
|
19
|
+
resource :organizations, :show
|
18
20
|
|
19
21
|
output do
|
20
|
-
field :label, "Label"
|
21
|
-
field :description, "Description"
|
22
|
+
field :label, _("Label")
|
23
|
+
field :description, _("Description")
|
24
|
+
field :redhat_repository_url, _("Red Hat Repository URL")
|
22
25
|
end
|
23
26
|
|
24
|
-
|
27
|
+
build_options
|
25
28
|
end
|
26
29
|
|
27
30
|
class UpdateCommand < HammerCLIForeman::Organization::UpdateCommand
|
28
|
-
|
31
|
+
include HammerCLIKatello::ResolverCommons
|
32
|
+
resource :organizations, :update
|
29
33
|
|
30
|
-
success_message "Organization updated"
|
31
|
-
failure_message "Could not update the organization"
|
34
|
+
success_message _("Organization updated")
|
35
|
+
failure_message _("Could not update the organization")
|
32
36
|
|
33
|
-
|
37
|
+
build_options
|
34
38
|
end
|
35
39
|
|
36
|
-
class CreateCommand <
|
37
|
-
resource
|
40
|
+
class CreateCommand < HammerCLIKatello::CreateCommand
|
41
|
+
resource :organizations, :create
|
38
42
|
|
39
|
-
success_message "Organization created"
|
40
|
-
failure_message "Could not create the organization"
|
43
|
+
success_message _("Organization created")
|
44
|
+
failure_message _("Could not create the organization")
|
41
45
|
|
42
|
-
|
46
|
+
build_options
|
43
47
|
end
|
44
48
|
|
45
|
-
class DeleteCommand <
|
46
|
-
resource
|
49
|
+
class DeleteCommand < HammerCLIKatello::DeleteCommand
|
50
|
+
resource :organizations, :destroy
|
47
51
|
|
48
|
-
success_message "Organization deleted"
|
49
|
-
failure_message "Could not delete the organization"
|
52
|
+
success_message _("Organization deleted")
|
53
|
+
failure_message _("Could not delete the organization")
|
50
54
|
|
51
|
-
|
55
|
+
build_options
|
52
56
|
end
|
53
57
|
|
54
58
|
autoload_subcommands
|
@@ -56,5 +60,5 @@ module HammerCLIKatello
|
|
56
60
|
|
57
61
|
end
|
58
62
|
|
59
|
-
HammerCLI::MainCommand.subcommand! 'organization', "Manipulate organizations",
|
63
|
+
HammerCLI::MainCommand.subcommand! 'organization', _("Manipulate organizations"),
|
60
64
|
HammerCLIKatello::Organization
|
@@ -1,51 +1,51 @@
|
|
1
1
|
module HammerCLIKatello
|
2
2
|
|
3
|
-
class PingCommand <
|
3
|
+
class PingCommand < HammerCLIKatello::Command
|
4
4
|
|
5
|
-
resource
|
5
|
+
resource :ping, :index
|
6
6
|
|
7
7
|
output do
|
8
8
|
from "services" do
|
9
9
|
|
10
10
|
label "candlepin" do
|
11
11
|
from "candlepin" do
|
12
|
-
field "status", "Status"
|
13
|
-
field "_response", "Server Response"
|
12
|
+
field "status", _("Status")
|
13
|
+
field "_response", _("Server Response")
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
label "candlepin_auth" do
|
18
18
|
from "candlepin_auth" do
|
19
|
-
field "status", "Status"
|
20
|
-
field "_response", "Server Response"
|
19
|
+
field "status", _("Status")
|
20
|
+
field "_response", _("Server Response")
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
label "pulp" do
|
25
25
|
from "pulp" do
|
26
|
-
field "status", "Status"
|
27
|
-
field "_response", "Server Response"
|
26
|
+
field "status", _("Status")
|
27
|
+
field "_response", _("Server Response")
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
label "pulp_auth" do
|
32
32
|
from "pulp_auth" do
|
33
|
-
field "status", "Status"
|
34
|
-
field "_response", "Server Response"
|
33
|
+
field "status", _("Status")
|
34
|
+
field "_response", _("Server Response")
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
label "elasticsearch" do
|
39
39
|
from "elasticsearch" do
|
40
|
-
field "status", "Status"
|
41
|
-
field "_response", "Server Response"
|
40
|
+
field "status", _("Status")
|
41
|
+
field "_response", _("Server Response")
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
label "katello_jobs" do
|
46
46
|
from "katello_jobs" do
|
47
|
-
field "status", "Status"
|
48
|
-
field "_response", "Server Response"
|
47
|
+
field "status", _("Status")
|
48
|
+
field "_response", _("Server Response")
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -53,15 +53,12 @@ module HammerCLIKatello
|
|
53
53
|
end # output do
|
54
54
|
|
55
55
|
def execute
|
56
|
-
d =
|
57
|
-
if HammerCLI::Settings.get(:log_api_calls)
|
58
|
-
logger.debug "Retrieved data: " + d.ai(:raw => true)
|
59
|
-
end
|
56
|
+
d = send_request
|
60
57
|
print_data d
|
61
|
-
d['status'] != "FAIL" ? HammerCLI::EX_OK : 1
|
58
|
+
d['status'] != _("FAIL") ? HammerCLI::EX_OK : 1
|
62
59
|
end
|
63
60
|
|
64
|
-
def
|
61
|
+
def send_request
|
65
62
|
super.tap do |data|
|
66
63
|
data['services'].each do |name, service|
|
67
64
|
service['_response'] = get_server_response(service)
|
@@ -73,15 +70,15 @@ module HammerCLIKatello
|
|
73
70
|
|
74
71
|
def get_server_response(service_hash)
|
75
72
|
if service_hash['duration_ms']
|
76
|
-
"Duration:
|
73
|
+
_("Duration: %sms") % service_hash['duration_ms']
|
77
74
|
else
|
78
|
-
"Message:
|
75
|
+
_("Message: %s") % service_hash['message']
|
79
76
|
end
|
80
77
|
end
|
81
78
|
|
82
79
|
end # class PingCommand
|
83
80
|
|
84
|
-
HammerCLI::MainCommand.subcommand("ping", "get the status of the server",
|
81
|
+
HammerCLI::MainCommand.subcommand("ping", _("get the status of the server"),
|
85
82
|
HammerCLIKatello::PingCommand)
|
86
83
|
|
87
84
|
end # module HammerCLIKatello
|
@@ -1,111 +1,118 @@
|
|
1
1
|
module HammerCLIKatello
|
2
2
|
|
3
|
-
class Product <
|
4
|
-
resource
|
3
|
+
class Product < HammerCLIKatello::Command
|
4
|
+
resource :products
|
5
5
|
|
6
|
-
class ListCommand <
|
6
|
+
class ListCommand < HammerCLIKatello::ListCommand
|
7
7
|
output do
|
8
|
-
field :id, "
|
9
|
-
field :name, "Name"
|
8
|
+
field :id, _("ID")
|
9
|
+
field :name, _("Name")
|
10
10
|
|
11
|
-
from :
|
12
|
-
field :name, "
|
11
|
+
from :organization do
|
12
|
+
field :name, _("Organization")
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
field :repository_count, _("Repositories")
|
16
|
+
|
17
|
+
from :sync_status do
|
18
|
+
field :state, _("Sync State")
|
17
19
|
end
|
18
20
|
|
19
|
-
field :repository_count, "Repositories"
|
20
21
|
end
|
21
22
|
|
22
|
-
|
23
|
+
build_options
|
23
24
|
end
|
24
25
|
|
25
|
-
class CreateCommand <
|
26
|
-
success_message "Product created"
|
27
|
-
failure_message "Could not create the product"
|
26
|
+
class CreateCommand < HammerCLIKatello::CreateCommand
|
27
|
+
success_message _("Product created")
|
28
|
+
failure_message _("Could not create the product")
|
28
29
|
|
29
|
-
|
30
|
+
build_options
|
30
31
|
end
|
31
32
|
|
32
|
-
class InfoCommand <
|
33
|
-
output do
|
34
|
-
field :id, "Product ID"
|
35
|
-
field :name, "Name"
|
36
|
-
field :label, "Label"
|
37
|
-
field :description, "Description"
|
33
|
+
class InfoCommand < HammerCLIKatello::InfoCommand
|
38
34
|
|
39
|
-
|
35
|
+
output do
|
36
|
+
field :id, _("ID")
|
37
|
+
field :name, _("Name")
|
38
|
+
field :label, _("Label")
|
39
|
+
field :description, _("Description")
|
40
40
|
|
41
|
-
from :
|
42
|
-
field :
|
43
|
-
field :name, "GPG Key"
|
41
|
+
from :sync_status do
|
42
|
+
field :state, _("Sync State")
|
44
43
|
end
|
45
44
|
|
46
|
-
|
47
|
-
|
45
|
+
field :sync_plan_id, _("Sync Plan ID")
|
46
|
+
|
47
|
+
label _("GPG") do
|
48
|
+
from :gpg_key do
|
49
|
+
field :id, _("GPG Key ID")
|
50
|
+
field :name, _("GPG Key")
|
51
|
+
end
|
48
52
|
end
|
49
53
|
|
50
54
|
from :organization do
|
51
|
-
field :name, "Organization"
|
55
|
+
field :name, _("Organization")
|
52
56
|
end
|
53
57
|
|
54
|
-
field :readonly, "Readonly"
|
58
|
+
field :readonly, _("Readonly")
|
55
59
|
|
56
60
|
from :permissions do
|
57
|
-
field :deletable, "Deletable"
|
61
|
+
field :deletable, _("Deletable")
|
62
|
+
end
|
63
|
+
|
64
|
+
collection :product_content, _("Content") do
|
65
|
+
from :content do
|
66
|
+
field :name, _("Repo Name")
|
67
|
+
field :contentUrl, _("URL")
|
68
|
+
end
|
58
69
|
end
|
59
70
|
end
|
60
71
|
|
61
|
-
|
72
|
+
build_options
|
62
73
|
end
|
63
74
|
|
64
|
-
class UpdateCommand <
|
65
|
-
success_message "Product updated"
|
66
|
-
failure_message "Could not update the product"
|
75
|
+
class UpdateCommand < HammerCLIKatello::UpdateCommand
|
76
|
+
success_message _("Product updated")
|
77
|
+
failure_message _("Could not update the product")
|
67
78
|
|
68
|
-
|
79
|
+
build_options
|
69
80
|
end
|
70
81
|
|
71
|
-
class DeleteCommand <
|
72
|
-
success_message "Product destroyed"
|
73
|
-
failure_message "Could not destroy the product"
|
82
|
+
class DeleteCommand < HammerCLIKatello::DeleteCommand
|
83
|
+
success_message _("Product destroyed")
|
84
|
+
failure_message _("Could not destroy the product")
|
74
85
|
|
75
|
-
|
86
|
+
build_options
|
76
87
|
end
|
77
88
|
|
78
|
-
class SetSyncPlanCommand <
|
79
|
-
|
89
|
+
class SetSyncPlanCommand < HammerCLIKatello::UpdateCommand
|
90
|
+
desc _("Assign sync plan to product.")
|
91
|
+
command_name "set-sync-plan"
|
80
92
|
|
81
|
-
|
82
|
-
|
93
|
+
success_message _("Synchronization plan assigned.")
|
94
|
+
failure_message _("Could not assign synchronization plan.")
|
83
95
|
|
84
|
-
|
85
|
-
failure_message "Could not assign synchronization plan."
|
96
|
+
resource :products, :update
|
86
97
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
[:name, :label, :provider_id, :description, :gpg_key_id]
|
91
|
-
option "--sync_plan_id", "SYNC_PLAN_ID", "plan numeric identifier",
|
98
|
+
build_options :without => [:name, :label, :provider_id, :description, :gpg_key_id]
|
99
|
+
# TODO: set to --sync-plan-id
|
100
|
+
option "--sync_plan_id", "SYNC_PLAN_ID", _("plan numeric identifier"),
|
92
101
|
:attribute_name => :option_sync_plan_id, :required => true
|
93
102
|
end
|
94
103
|
|
95
|
-
class RemoveSyncPlanCommand <
|
96
|
-
|
97
|
-
|
98
|
-
desc "Delete assignment sync plan and product."
|
99
|
-
command_name "remove_sync_plan"
|
104
|
+
class RemoveSyncPlanCommand < HammerCLIKatello::UpdateCommand
|
105
|
+
desc _("Delete assignment sync plan and product.")
|
106
|
+
command_name "remove-sync-plan"
|
100
107
|
|
101
|
-
success_message "Synchronization plan removed."
|
102
|
-
failure_message "Could not remove synchronization plan."
|
108
|
+
success_message _("Synchronization plan removed.")
|
109
|
+
failure_message _("Could not remove synchronization plan.")
|
103
110
|
|
104
|
-
resource
|
111
|
+
resource :products, :update
|
105
112
|
|
106
|
-
|
107
|
-
|
108
|
-
option "--sync_plan_id", "SYNC_PLAN_ID", "plan numeric identifier",
|
113
|
+
build_options :without => [:name, :label, :provider_id, :description,
|
114
|
+
:gpg_key_id, :sync_plan_id]
|
115
|
+
option "--sync_plan_id", "SYNC_PLAN_ID", _("plan numeric identifier"),
|
109
116
|
:attribute_name => :option_sync_plan_id, :required => true
|
110
117
|
end
|
111
118
|
|
@@ -113,5 +120,5 @@ module HammerCLIKatello
|
|
113
120
|
end
|
114
121
|
end
|
115
122
|
|
116
|
-
HammerCLI::MainCommand.subcommand "product", "Manipulate products.",
|
123
|
+
HammerCLI::MainCommand.subcommand "product", _("Manipulate products."),
|
117
124
|
HammerCLIKatello::Product
|