hammer_cli_katello 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ M2YzMWUzNjU0M2M4NzU5Njk5Nzk4ZGUwM2Y2NGE5OGFhYjc4MzhjMw==
5
+ data.tar.gz: !binary |-
6
+ OGNlZGY3MWUxZTRjMjZhZjU3NTQ4NWQwYWEyNjU2NDQzMGQzMDI4MA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MDgxNDc1MDlhNjJkNDBmYjJmZjEyNWFlM2E5NzkyMTBmOGEwMzUxZjg4OGM1
10
+ YzcxMzQ1MjAyYzIwYjhlOTFkNjRhZTBiMDQzMjUxNTU0ZWZkM2MxMzkyY2Q1
11
+ MDJjMmE5ZTBkODlkNjJlNjA2NTAzNDc3MWY1MDliMmFlOTAyYTU=
12
+ data.tar.gz: !binary |-
13
+ MzhkYmY4M2Y1OTY2NGE4NjE5ZDJmOTY2MGFkODgzMzRjODZiYWQ3YTAyYmQ1
14
+ NmVkNWYzMzg0M2NjYTIyNzFiZWY5ZmI0ODhhNDQyMjNkZDdkYTRkMmUyZjU5
15
+ ZGY4Mzg4ZmE2ZTdjMmI3NDVlNTg2ZDkyODQ2MjI1N2NhMTI1Mzk=
@@ -0,0 +1,82 @@
1
+ require 'hammer_cli'
2
+ require 'hammer_cli_foreman'
3
+ require 'hammer_cli_foreman/commands'
4
+
5
+ module HammerCLIKatello
6
+
7
+ class LifecycleEnvironmentCommand < HammerCLI::AbstractCommand
8
+
9
+ class ListCommand < HammerCLIForeman::ListCommand
10
+ resource KatelloApi::Resources::Environment, :index
11
+
12
+ output do
13
+ field :id, "ID"
14
+ field :name, "Name"
15
+ end
16
+
17
+ apipie_options
18
+ end
19
+
20
+ class InfoCommand < HammerCLIForeman::InfoCommand
21
+ resource KatelloApi::Resources::Environment, :show
22
+
23
+ output do
24
+ field :id, "ID"
25
+ field :name, "Name"
26
+ field :label, "Label"
27
+ field :description, "Description"
28
+ from :organization do
29
+ field :name, "Organization"
30
+ end
31
+ field :library, "Library"
32
+ field :prior, "Prior Lifecycle Environment"
33
+ end
34
+
35
+ def request_params
36
+ super.merge(method_options)
37
+ end
38
+
39
+ apipie_options
40
+ end
41
+
42
+ class CreateCommand < HammerCLIForeman::CreateCommand
43
+ resource KatelloApi::Resources::Environment, :create
44
+ success_message "Environment created"
45
+ failure_message "Could not create environment"
46
+
47
+ apipie_options
48
+ end
49
+
50
+ class UpdateCommand < HammerCLIForeman::UpdateCommand
51
+ success_message "Environment updated"
52
+ failure_message "Could not update environment"
53
+ resource KatelloApi::Resources::Environment, :update
54
+
55
+ identifiers :id, :name
56
+
57
+ def request_params
58
+ super.merge(method_options)
59
+ end
60
+
61
+ apipie_options
62
+ end
63
+
64
+ class DeleteCommand < HammerCLIForeman::DeleteCommand
65
+ success_message "Environment deleted"
66
+ failure_message "Could not delete environment"
67
+ resource KatelloApi::Resources::Environment, :destroy
68
+
69
+ identifiers :id, :name
70
+
71
+ def request_params
72
+ super.merge(method_options)
73
+ end
74
+
75
+ apipie_options
76
+ end
77
+
78
+ autoload_subcommands
79
+ end
80
+
81
+ HammerCLI::MainCommand.subcommand("lifecycle-environment", "manipulate lifecycle_environments on the server", HammerCLIKatello::LifecycleEnvironmentCommand)
82
+ end
@@ -0,0 +1,64 @@
1
+ require 'hammer_cli'
2
+ require 'katello_api'
3
+ require 'hammer_cli_foreman/commands'
4
+
5
+ module HammerCLIKatello
6
+
7
+ class Organization < HammerCLIForeman::Organization
8
+
9
+ class ListCommand < HammerCLIForeman::Organization::ListCommand
10
+ resource KatelloApi::Resources::Organization, "index"
11
+
12
+ output do
13
+ field :label, "Label"
14
+ field :description, "Description"
15
+ end
16
+
17
+ apipie_options
18
+ end
19
+
20
+ class InfoCommand < HammerCLIForeman::Organization::InfoCommand
21
+ resource KatelloApi::Resources::Organization, "show"
22
+
23
+ output do
24
+ field :label, "Label"
25
+ field :description, "Description"
26
+ end
27
+
28
+ apipie_options
29
+ end
30
+
31
+ class UpdateCommand < HammerCLIForeman::Organization::UpdateCommand
32
+ resource KatelloApi::Resources::Organization, "update"
33
+
34
+ success_message "Organization updated"
35
+ failure_message "Could not update the organization"
36
+
37
+ apipie_options
38
+ end
39
+
40
+ class CreateCommand < HammerCLIForeman::CreateCommand
41
+ resource KatelloApi::Resources::Organization, "create"
42
+
43
+ success_message "Organization created"
44
+ failure_message "Could not create the organization"
45
+
46
+ apipie_options
47
+ end
48
+
49
+ class DeleteCommand < HammerCLIForeman::DeleteCommand
50
+ resource KatelloApi::Resources::Organization, "destroy"
51
+
52
+ success_message "Organization deleted"
53
+ failure_message "Could not delete the organization"
54
+
55
+ apipie_options
56
+ end
57
+
58
+
59
+ autoload_subcommands
60
+ end
61
+
62
+ end
63
+
64
+ HammerCLI::MainCommand.subcommand! 'organization', "Manipulate organizations", HammerCLIKatello::Organization
@@ -0,0 +1,70 @@
1
+ require 'hammer_cli'
2
+ require 'katello_api'
3
+ require 'hammer_cli_foreman/commands'
4
+
5
+ module HammerCLIKatello
6
+
7
+ class PingCommand < HammerCLI::Apipie::ReadCommand
8
+
9
+ resource KatelloApi::Resources::Ping, :index
10
+
11
+
12
+ output do
13
+ from "services" do
14
+
15
+ label "candlepin" do
16
+ from "candlepin" do
17
+ field "status", "Status"
18
+ field "duration_ms", "Duration"
19
+ field "message", "Message"
20
+ end
21
+ end
22
+
23
+ label "candlepin_auth" do
24
+ from "candlepin_auth" do
25
+ field "status", "Status"
26
+ field "duration_ms", "Duration"
27
+ field "message", "Message"
28
+ end
29
+ end
30
+
31
+ label "pulp" do
32
+ from "pulp" do
33
+ field "status", "Status"
34
+ field "duration_ms", "Duration"
35
+ field "message", "Message"
36
+ end
37
+ end
38
+
39
+ label "pulp_auth" do
40
+ from "pulp_auth" do
41
+ field "status", "Status"
42
+ field "duration_ms", "Duration"
43
+ field "message", "Message"
44
+ end
45
+ end
46
+
47
+ label "elasticsearch" do
48
+ from "elasticsearch" do
49
+ field "status", "Status"
50
+ field "duration_ms", "Duration"
51
+ field "message", "Message"
52
+ end
53
+ end
54
+
55
+ label "katello_jobs" do
56
+ from "katello_jobs" do
57
+ field "status", "Status"
58
+ field "duration_ms", "Duration"
59
+ field "message", "Message"
60
+ end
61
+ end
62
+
63
+ end # from "services"
64
+ end # output do
65
+
66
+ end # class PingCommand
67
+
68
+ HammerCLI::MainCommand.subcommand("ping", "get the status of the server", HammerCLIKatello::PingCommand)
69
+
70
+ end # module HammerCLIKatello
@@ -0,0 +1,101 @@
1
+ require 'hammer_cli'
2
+ require 'hammer_cli_foreman'
3
+ require 'hammer_cli_foreman/commands'
4
+
5
+ module HammerCLIKatello
6
+
7
+ class Provider < HammerCLI::Apipie::Command
8
+ resource KatelloApi::Resources::Provider
9
+
10
+ class ListCommand < HammerCLIForeman::ListCommand
11
+ output do
12
+ field :id, "ID"
13
+ field :name, "Name"
14
+ field :provider_type, "Type"
15
+ field :total_products, "Products"
16
+ field :total_repositories, "Repositories"
17
+ end
18
+
19
+ apipie_options
20
+ end
21
+
22
+
23
+ class InfoCommand < HammerCLIForeman::InfoCommand
24
+ output ListCommand.output_definition do
25
+ field :created_at, "Created at", Fields::Date
26
+ field :updated_at, "Updated at", Fields::Date
27
+ end
28
+ end
29
+
30
+
31
+ class CreateCommand < HammerCLIForeman::CreateCommand
32
+ success_message "Provider created"
33
+ failure_message "Could not create the provider"
34
+
35
+ apipie_options
36
+ end
37
+
38
+
39
+ class DeleteCommand < HammerCLIForeman::DeleteCommand
40
+ success_message "Provider deleted"
41
+ failure_message "Could not delete the provider"
42
+ end
43
+
44
+
45
+ class UpdateCommand < HammerCLIForeman::UpdateCommand
46
+ success_message "Provider updated"
47
+ failure_message "Could not update the provider"
48
+
49
+ apipie_options
50
+ end
51
+
52
+
53
+ class UploadManifestCommand < HammerCLIForeman::WriteCommand
54
+ class FileNormalizer
55
+ class File < HammerCLI::Options::Normalizers::AbstractNormalizer
56
+ def format(path)
57
+ ::File.read(::File.expand_path(path), :encoding => 'ASCII-8BIT')
58
+ end
59
+ end
60
+ end
61
+
62
+ action "import_manifest"
63
+ command_name "import_manifest"
64
+
65
+ option "--file", "MANIFEST", "Path to a file that contains the manifest", :attribute_name => :import, :required => true,
66
+ :format => FileNormalizer.new
67
+
68
+ success_message "Manifest is being uploaded"
69
+ failure_message "Manifest upload failed"
70
+
71
+ apipie_options :without => [:import]
72
+ end
73
+
74
+
75
+ class RefreshManifestCommand < HammerCLIForeman::WriteCommand
76
+ action "refresh_manifest"
77
+ command_name "refresh_manifest"
78
+
79
+ success_message "Manifest is being refreshed"
80
+ failure_message "Could not refresh the manifest"
81
+
82
+ apipie_options
83
+ end
84
+
85
+
86
+ class DeleteManifestCommand < HammerCLIForeman::DeleteCommand
87
+ action "delete_manifest"
88
+ command_name "delete_manifest"
89
+
90
+ success_message "Manifest deleted"
91
+ failure_message "Could not delete the manifest"
92
+
93
+ apipie_options
94
+ end
95
+
96
+ autoload_subcommands
97
+ end
98
+
99
+ end
100
+
101
+ HammerCLI::MainCommand.subcommand 'provider', "Manipulate providers", HammerCLIKatello::Provider
@@ -0,0 +1,17 @@
1
+ require 'hammer_cli'
2
+
3
+ module HammerCLIKatello
4
+
5
+ module Resource
6
+
7
+ def resource_config
8
+ config = {}
9
+ config[:base_url] = HammerCLI::Settings.get(:katello, :host)
10
+ config[:username] = HammerCLI::Settings.get(:katello, :username)
11
+ config[:password] = HammerCLI::Settings.get(:katello, :password)
12
+ config
13
+ end
14
+
15
+ end
16
+
17
+ end
@@ -0,0 +1,94 @@
1
+ require 'hammer_cli'
2
+ require 'hammer_cli_foreman'
3
+ require 'hammer_cli_foreman/commands'
4
+
5
+ module HammerCLIKatello
6
+
7
+ class SystemCommand < HammerCLI::AbstractCommand
8
+
9
+ class ListCommand < HammerCLIForeman::ListCommand
10
+ resource KatelloApi::Resources::System, :index
11
+
12
+ output do
13
+ field :uuid, "ID"
14
+ field :name, "Name"
15
+ end
16
+
17
+ apipie_options :without => [:environment_id]
18
+ end
19
+
20
+ class InfoCommand < HammerCLIForeman::InfoCommand
21
+ resource KatelloApi::Resources::System, :show
22
+
23
+ identifiers :id
24
+
25
+ output do
26
+ field :name, "Name"
27
+ field :id, "ID"
28
+ field :uuid, "UUID"
29
+ field :description, "Description"
30
+ field :location, "Location"
31
+ from :environment do
32
+ field :name, "Lifecycle Environment"
33
+ end
34
+ from :content_view do
35
+ field :name, "Content View"
36
+ end
37
+ field :entitlementStatus, "Entitlement Status"
38
+ field :releaseVer, "Release Version"
39
+ field :autoheal, "Autoheal"
40
+ end
41
+
42
+ apipie_options
43
+ end
44
+
45
+ class CreateCommand < HammerCLIForeman::CreateCommand
46
+ success_message "System created"
47
+ failure_message "Could not create system"
48
+ resource KatelloApi::Resources::System, :create
49
+
50
+ def request_params
51
+ super.tap do |params|
52
+ params['type'] = "system"
53
+ params['facts'] = {"uname.machine" => "unknown"} # facts can't be blank, bro
54
+ end
55
+ end
56
+
57
+ apipie_options :without => [:facts, :type, :installed_products]
58
+ end
59
+
60
+ class UpdateCommand < HammerCLIForeman::UpdateCommand
61
+ success_message "System updated"
62
+ failure_message "Could not update system"
63
+ resource KatelloApi::Resources::System, :update
64
+
65
+ identifiers :id
66
+
67
+ apipie_options :without => [:facts, :type, :installed_products]
68
+ end
69
+
70
+ class DeleteCommand < HammerCLIForeman::DeleteCommand
71
+ success_message "System deleted"
72
+ failure_message "Could not delete system"
73
+ resource KatelloApi::Resources::System, :destroy
74
+
75
+ identifiers :id
76
+
77
+ apipie_options
78
+ end
79
+
80
+ class TasksCommand < HammerCLIForeman::ListCommand
81
+ resource KatelloApi::Resources::System, :tasks
82
+
83
+ command_name "tasks"
84
+
85
+ identifiers :id
86
+
87
+ apipie_options
88
+ end
89
+
90
+ autoload_subcommands
91
+ end
92
+
93
+ HammerCLI::MainCommand.subcommand("system", "manipulate systems on the server", HammerCLIKatello::SystemCommand)
94
+ end
@@ -0,0 +1,54 @@
1
+
2
+ require 'hammer_cli'
3
+ require 'hammer_cli_foreman'
4
+ require 'hammer_cli_foreman/commands'
5
+
6
+ module HammerCLIKatello
7
+
8
+ class SystemGroup < HammerCLI::AbstractCommand
9
+ class ListCommand < HammerCLIForeman::ListCommand
10
+ resource KatelloApi::Resources::SystemGroup, "index"
11
+
12
+ output do
13
+ field :id, "ID"
14
+ field :name, "Name"
15
+ field :max_systems, "Limit"
16
+ field :description, "Description"
17
+ end
18
+
19
+ apipie_options
20
+ end
21
+
22
+ class CreateCommand < HammerCLIForeman::CreateCommand
23
+ success_message "System group created"
24
+ failure_message "Could not create the system group"
25
+ resource KatelloApi::Resources::SystemGroup, "create"
26
+
27
+ apipie_options
28
+ end
29
+
30
+ class InfoCommand < HammerCLIForeman::InfoCommand
31
+ resource KatelloApi::Resources::SystemGroup, "show"
32
+
33
+ output ListCommand.output_definition do
34
+ end
35
+ end
36
+
37
+ class CopyCommand < HammerCLIForeman::CreateCommand
38
+ success_message "System group created"
39
+ failure_message "Could not create the system group"
40
+ command_name "copy"
41
+ action "copy"
42
+
43
+ validate_options do
44
+ unless option(:id).exist?
45
+ all(:name).required
46
+ end
47
+ end
48
+ end
49
+
50
+ autoload_subcommands
51
+ end
52
+ end
53
+
54
+ HammerCLI::MainCommand.subcommand 'systemgroup', "Manipulate system groups", HammerCLIKatello::SystemGroup
@@ -0,0 +1,5 @@
1
+ module HammerCLIKatello
2
+ def self.version
3
+ @version ||= Gem::Version.new('0.0.1')
4
+ end
5
+ end
@@ -0,0 +1,13 @@
1
+ require 'hammer_cli'
2
+ require 'hammer_cli/exit_codes'
3
+ require 'hammer_cli_foreman/output/fields'
4
+
5
+ module HammerCLIKatello
6
+
7
+ def self.exception_handler_class
8
+ HammerCLIForeman::ExceptionHandler
9
+ end
10
+
11
+ Dir["#{File.dirname(__FILE__)}/hammer_cli_katello/*.rb"].each { |f| require f }
12
+
13
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hammer_cli_katello
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Katello
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: hammer_cli
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: hammer_cli_foreman
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: katello_api
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Hammer-CLI-Katello is a plugin for Hammer to provide connectivity to
56
+ a Katello server.
57
+ email:
58
+ - katello-devel@redhat.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - lib/hammer_cli_katello.rb
64
+ - lib/hammer_cli_katello/lifecycle_environment.rb
65
+ - lib/hammer_cli_katello/organization.rb
66
+ - lib/hammer_cli_katello/ping.rb
67
+ - lib/hammer_cli_katello/provider.rb
68
+ - lib/hammer_cli_katello/resource.rb
69
+ - lib/hammer_cli_katello/system.rb
70
+ - lib/hammer_cli_katello/system_group.rb
71
+ - lib/hammer_cli_katello/version.rb
72
+ homepage:
73
+ licenses: []
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.2.0
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: Katello commands for Hammer
95
+ test_files: []