hammer_cli_katello 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Yjk4ZTUyN2E0Y2I3MTMyOWNhYmY2MTE1ZGQzOTFiY2YwNjNlZmU1OQ==
4
+ ZDU1YjI4NmM1OGNmNzJhZDM1ZGQ3ODIyNTBjMjM0ZDc0ZTcxOTY3Mw==
5
5
  data.tar.gz: !binary |-
6
- YTAzZjUzNGY0ZDFjYmQ5OTFjOWRhNTNhNjc3NWM3ZjVlNzA2Yjg2OQ==
6
+ ZGQzNDRlNTk0MjQ5NmVmZDYzOGI4Y2Y1YjMzZjQxNGM2MDRjZWVmMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MTYwZDIyMGMxMTc0NGM0NzRjODFiOWRmYzhjYjBjNzBjNjQ0N2ExZDljNjM0
10
- Y2I2MzNhYmRiMTc4OTdjY2NmMjQ4M2ExYzMwMzVmYjI2NmJmYTE3NDM0YTk0
11
- ZjEzNWU5MjBiODk1ZjFhNmZjMDA0ZTU0MjI2ZGY3MGI1ZTA3Yzg=
9
+ OTBlYmExNzNhOWNiMmU3OTRiNDY4ODA2M2NlMjhiOTljNjQ1ZWJmMDNjNDM3
10
+ YzMwM2NlNmEyYWIxZTM0MmQxZDY3OGIzZjdiNzY1NzczYjU0NjAwOTRhNzg5
11
+ NDA2YzEwZGNhNjE4OTljOTRmY2FjODQ1MGEyMmNiMzdlNWY2ODI=
12
12
  data.tar.gz: !binary |-
13
- ZTVlYTUyZDVmNjFlNTRjYzkwYzI2NzZjZGQ5NDJjMTkzZjNlMjAxMDBiOWMz
14
- YjYzZDZmMjFkNjczZTUwYzMwZjUzMGNkOThiOGVjYjRjNDkwNzdkZmZmMDUw
15
- NmU3OWQ3MTY5MzlkZWY2MTJhMjQ4MDg0NzliOTM1MGFiNTI3ZWM=
13
+ ZmI5N2U0NTc0YzNhODIwZTQ4OGQ0ODFkY2NjMGE0NmM2NGZhNGJlYzdiZGFh
14
+ NzNjNzZkMWQ0YjZiNmIyZDQ1OTNhNjlmY2IzNzhhODNiY2I4M2Q1MGQ3NDgx
15
+ NDFjZjMxOTEzOWRiYjIxYTcxODhlMWU5NzkxNThkZTI5MjkzMmU=
@@ -0,0 +1,97 @@
1
+ module HammerCLIKatello
2
+
3
+ class GpgKeyCommand < HammerCLI::AbstractCommand
4
+
5
+ class ListCommand < HammerCLIForeman::ListCommand
6
+ resource KatelloApi::Resources::GpgKey, :index
7
+
8
+ output do
9
+ field :id, "ID"
10
+ field :name, "Name"
11
+ end
12
+
13
+ apipie_options
14
+ end
15
+
16
+ class InfoCommand < HammerCLIForeman::InfoCommand
17
+ resource KatelloApi::Resources::GpgKey, :show
18
+ output do
19
+ field :id, "ID"
20
+ field :name, "Name"
21
+ from :organization do
22
+ field :name, "Organization"
23
+ end
24
+
25
+ collection :repositories, "Repositories" do
26
+ field :id, "ID"
27
+ field :name, "Name"
28
+ field :content_type, "Content Type"
29
+ from :product do
30
+ field :name, "Product"
31
+ end
32
+ end
33
+
34
+ # TODO: Below!
35
+ # Need a better way to say
36
+ # Contents
37
+ # <content>
38
+
39
+ field "", "Content"
40
+ field :content, nil
41
+ end
42
+
43
+ def request_params
44
+ super.merge(method_options)
45
+ end
46
+
47
+ apipie_options
48
+ end
49
+
50
+ class CreateCommand < HammerCLIForeman::CreateCommand
51
+ resource KatelloApi::Resources::GpgKey, :create
52
+ success_message "GPG Key created"
53
+ failure_message "Could not create GPG Key"
54
+ apipie_options :without => [:content]
55
+ option "--key", "GPG_KEY_FILE", "GPG Key file",
56
+ :attribute_name => :option_content,
57
+ :required => true,
58
+ :format => HammerCLI::Options::Normalizers::File.new
59
+ end
60
+
61
+ class UpdateCommand < HammerCLIForeman::UpdateCommand
62
+ success_message "GPG Key updated"
63
+ failure_message "Could not update GPG Key"
64
+ resource KatelloApi::Resources::GpgKey, :update
65
+
66
+ identifiers :id
67
+
68
+ def request_params
69
+ super.merge(method_options)
70
+ end
71
+
72
+ apipie_options :without => [:content]
73
+ option "--key", "GPG_KEY_FILE", "GPG Key file",
74
+ :attribute_name => :option_content,
75
+ :format => HammerCLI::Options::Normalizers::File.new
76
+ end
77
+
78
+ class DeleteCommand < HammerCLIForeman::DeleteCommand
79
+ success_message "GPG Key deleted"
80
+ failure_message "Could not delete the GPG Key"
81
+ resource KatelloApi::Resources::GpgKey, :destroy
82
+
83
+ identifiers :id
84
+ def request_params
85
+ super.merge(method_options)
86
+ end
87
+
88
+ apipie_options
89
+ end
90
+
91
+ autoload_subcommands
92
+ end
93
+
94
+ HammerCLI::MainCommand.subcommand("gpg",
95
+ "manipulate GPG Key actions on the server",
96
+ HammerCLIKatello::GpgKeyCommand)
97
+ end
@@ -16,6 +16,8 @@ module HammerCLIKatello
16
16
  class InfoCommand < HammerCLIForeman::InfoCommand
17
17
  resource KatelloApi::Resources::Environment, :show
18
18
 
19
+ identifiers :id
20
+
19
21
  output do
20
22
  field :id, "ID"
21
23
  field :name, "Name"
@@ -48,7 +50,7 @@ module HammerCLIKatello
48
50
  failure_message "Could not update environment"
49
51
  resource KatelloApi::Resources::Environment, :update
50
52
 
51
- identifiers :id, :name
53
+ identifiers :id
52
54
 
53
55
  def request_params
54
56
  super.merge(method_options)
@@ -62,7 +64,7 @@ module HammerCLIKatello
62
64
  failure_message "Could not delete environment"
63
65
  resource KatelloApi::Resources::Environment, :destroy
64
66
 
65
- identifiers :id, :name
67
+ identifiers :id
66
68
 
67
69
  def request_params
68
70
  super.merge(method_options)
@@ -10,54 +10,75 @@ module HammerCLIKatello
10
10
  label "candlepin" do
11
11
  from "candlepin" do
12
12
  field "status", "Status"
13
- field "duration_ms", "Duration"
14
- field "message", "Message"
13
+ field "_response", "Server Response"
15
14
  end
16
15
  end
17
16
 
18
17
  label "candlepin_auth" do
19
18
  from "candlepin_auth" do
20
19
  field "status", "Status"
21
- field "duration_ms", "Duration"
22
- field "message", "Message"
20
+ field "_response", "Server Response"
23
21
  end
24
22
  end
25
23
 
26
24
  label "pulp" do
27
25
  from "pulp" do
28
26
  field "status", "Status"
29
- field "duration_ms", "Duration"
30
- field "message", "Message"
27
+ field "_response", "Server Response"
31
28
  end
32
29
  end
33
30
 
34
31
  label "pulp_auth" do
35
32
  from "pulp_auth" do
36
33
  field "status", "Status"
37
- field "duration_ms", "Duration"
38
- field "message", "Message"
34
+ field "_response", "Server Response"
39
35
  end
40
36
  end
41
37
 
42
38
  label "elasticsearch" do
43
39
  from "elasticsearch" do
44
40
  field "status", "Status"
45
- field "duration_ms", "Duration"
46
- field "message", "Message"
41
+ field "_response", "Server Response"
47
42
  end
48
43
  end
49
44
 
50
45
  label "katello_jobs" do
51
46
  from "katello_jobs" do
52
47
  field "status", "Status"
53
- field "duration_ms", "Duration"
54
- field "message", "Message"
48
+ field "_response", "Server Response"
55
49
  end
56
50
  end
57
51
 
58
52
  end # from "services"
59
53
  end # output do
60
54
 
55
+ def execute
56
+ d = retrieve_data
57
+ if HammerCLI::Settings.get(:log_api_calls)
58
+ logger.debug "Retrieved data: " + d.ai(:raw => true)
59
+ end
60
+ print_data d
61
+ d['status'] != "FAIL" ? HammerCLI::EX_OK : 1
62
+ end
63
+
64
+ def retrieve_data
65
+ super.tap do |data|
66
+ data['services'].each do |name, service|
67
+ service['_response'] = get_server_response(service)
68
+ end
69
+ end
70
+ end
71
+
72
+ private
73
+
74
+ def get_server_response(service_hash)
75
+ if service_hash['duration_ms']
76
+ "Duration: #{service_hash['duration_ms']}ms"
77
+ else
78
+ "Message: #{service_hash['message']}"
79
+ end
80
+ end
81
+
61
82
  end # class PingCommand
62
83
 
63
84
  HammerCLI::MainCommand.subcommand("ping", "get the status of the server",
@@ -1,5 +1,5 @@
1
1
  module HammerCLIKatello
2
2
  def self.version
3
- @version ||= Gem::Version.new('0.0.2')
3
+ @version ||= Gem::Version.new('0.0.3')
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hammer_cli_katello
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katello
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-24 00:00:00.000000000 Z
11
+ date: 2014-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hammer_cli_foreman
@@ -173,6 +173,7 @@ extensions: []
173
173
  extra_rdoc_files: []
174
174
  files:
175
175
  - lib/hammer_cli_katello.rb
176
+ - lib/hammer_cli_katello/gpg_key.rb
176
177
  - lib/hammer_cli_katello/lifecycle_environment.rb
177
178
  - lib/hammer_cli_katello/organization.rb
178
179
  - lib/hammer_cli_katello/ping.rb
@@ -203,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
203
204
  version: '0'
204
205
  requirements: []
205
206
  rubyforge_project:
206
- rubygems_version: 2.2.0
207
+ rubygems_version: 2.2.1
207
208
  signing_key:
208
209
  specification_version: 4
209
210
  summary: Katello commands for Hammer