hammer_cli_katello 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +8 -8
  2. data/lib/hammer_cli_katello.rb +81 -15
  3. data/lib/hammer_cli_katello/activation_key.rb +34 -4
  4. data/lib/hammer_cli_katello/associating_commands.rb +3 -1
  5. data/lib/hammer_cli_katello/capsule.rb +8 -1
  6. data/lib/hammer_cli_katello/commands.rb +12 -0
  7. data/lib/hammer_cli_katello/content_host.rb +38 -5
  8. data/lib/hammer_cli_katello/content_host_errata.rb +39 -0
  9. data/lib/hammer_cli_katello/content_host_package.rb +58 -0
  10. data/lib/hammer_cli_katello/content_host_package_group.rb +38 -0
  11. data/lib/hammer_cli_katello/content_view.rb +19 -7
  12. data/lib/hammer_cli_katello/content_view_puppet_module.rb +11 -35
  13. data/lib/hammer_cli_katello/content_view_version.rb +46 -11
  14. data/lib/hammer_cli_katello/exception_handler.rb +7 -1
  15. data/lib/hammer_cli_katello/filter_rule.rb +0 -4
  16. data/lib/hammer_cli_katello/gpg_key.rb +1 -4
  17. data/lib/hammer_cli_katello/host_collection.rb +47 -9
  18. data/lib/hammer_cli_katello/id_resolver.rb +85 -10
  19. data/lib/hammer_cli_katello/lifecycle_environment.rb +19 -27
  20. data/lib/hammer_cli_katello/lifecycle_environment_name_resolvable.rb +33 -0
  21. data/lib/hammer_cli_katello/organization.rb +5 -4
  22. data/lib/hammer_cli_katello/output/fields.rb +15 -0
  23. data/lib/hammer_cli_katello/output/formatters.rb +34 -0
  24. data/lib/hammer_cli_katello/ping.rb +3 -6
  25. data/lib/hammer_cli_katello/product.rb +5 -8
  26. data/lib/hammer_cli_katello/puppet_module.rb +13 -10
  27. data/lib/hammer_cli_katello/repository.rb +112 -11
  28. data/lib/hammer_cli_katello/repository_scoped_to_product.rb +13 -0
  29. data/lib/hammer_cli_katello/repository_set.rb +0 -2
  30. data/lib/hammer_cli_katello/subscription.rb +14 -7
  31. data/lib/hammer_cli_katello/sync_plan.rb +0 -3
  32. data/lib/hammer_cli_katello/version.rb +1 -1
  33. data/locale/Makefile +65 -0
  34. data/locale/README.md +18 -0
  35. data/locale/en/LC_MESSAGES/hammer-cli-katello.mo +0 -0
  36. data/locale/en/hammer-cli-katello.po +1215 -0
  37. data/locale/hammer-cli-katello.pot +833 -639
  38. metadata +32 -5
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzM5ZDExYmNkY2MxMDAyMTdjMGUwZTMyZWYyMTQwMmZlOTNjMDQyZQ==
4
+ ZmI2YjgxNzYzMjZkNWU1OWRjNDk5ZTU3NGFmZDM4OTVjYjk0YjY3Yg==
5
5
  data.tar.gz: !binary |-
6
- ODYxMzRhMzNmMzQxZjYxOWJkOTY4OWNjYTcxMGRlNzY1OTA3ZTk1MQ==
6
+ Y2E0ZjJjYTc4YmE0OTc4ZmM5MmYxYTY4Y2Q3OGUxOWM1NWZjYzY1Zg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NjA1ODNmMzZmYzllNjMzNzExYmI1MjhlOTkyOGIyYTJlMWY2MGQzNzRlMGU1
10
- OTUzN2ZkMjQ5MjQzYzc0NWI3MTIxYjhiZWMxMDFlZmM0M2ViOTljNTRmNDUw
11
- OWViNWI0NmQ3YzJlNmQxYzJlOWYzMjU5ZmY3MGY1MjU1YWZjZmE=
9
+ YTA2MmJjYWEwZjVhYzMyYzRkZjk0NjkxOWI2MmU1NDE3OTFmYjljYWI5MWE4
10
+ MTcxZWEwOGFjYzk4YTI4OWZlMDFkYTY0YTZmYzZkZWQyMmVlNzYwYzhkYzk0
11
+ ZmU3YTQyMTNlZjRjMmZmMWNkYjljZDM3MzIwMTI4ZTI5MjgwNzA=
12
12
  data.tar.gz: !binary |-
13
- YjZmMDRiMGJiMjQ3OTczY2VlMzBmNmM3YzNjYWExMzUzMDM5MDNmMmM3MmZk
14
- MTIyNzAxYjE1NmE2YTQ3YTI2ZjA2MDgyYTE0OWUzZGM5ZDkyZGY5ZGE4MjA5
15
- NTNhOGZiYzc5ZTA3ZGZmNzViMmIwMTU0OThmODMyNDI0MTMyN2I=
13
+ ZWVhMmZjMzRlZjJmYjZmYWFiODY3MzEzMjIzMWMxNWRmODhlOTY3ZmI5ZmUx
14
+ ODkyODg3MDA5ZmNkNDQ0YjYyODAyZTY3NWRkM2I2ZThlODQ0YWRkZWQ0NzBk
15
+ NzBkNzIxZTJmMGRmYmZmOTA4MDRiMTMzNzkwYTRjMmM0ZDE2ZjE=
@@ -11,6 +11,10 @@ module HammerCLIKatello
11
11
  HammerCLIKatello::ExceptionHandler
12
12
  end
13
13
 
14
+ require 'hammer_cli_katello/output/fields'
15
+ require 'hammer_cli_katello/output/formatters'
16
+ require 'hammer_cli_katello/lifecycle_environment_name_resolvable'
17
+ require 'hammer_cli_katello/repository_scoped_to_product'
14
18
  require "hammer_cli_katello/commands"
15
19
  require "hammer_cli_katello/associating_commands"
16
20
  require "hammer_cli_katello/version"
@@ -20,20 +24,82 @@ module HammerCLIKatello
20
24
  require 'hammer_cli_katello/id_resolver'
21
25
 
22
26
  # 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"
27
+ HammerCLI::MainCommand.lazy_subcommand("activation-key", _("Manipulate activation keys."),
28
+ 'HammerCLIKatello::ActivationKeyCommand',
29
+ 'hammer_cli_katello/activation_key'
30
+ )
31
+
32
+ HammerCLI::MainCommand.lazy_subcommand!("organization", _("Manipulate organizations"),
33
+ 'HammerCLIKatello::Organization',
34
+ 'hammer_cli_katello/organization'
35
+ )
36
+
37
+ HammerCLI::MainCommand.lazy_subcommand("gpg", _("manipulate GPG Key actions on the server"),
38
+ 'HammerCLIKatello::GpgKeyCommand',
39
+ 'hammer_cli_katello/gpg_key'
40
+ )
41
+
42
+ HammerCLI::MainCommand.lazy_subcommand("lifecycle-environment",
43
+ _("manipulate lifecycle_environments on the server"),
44
+ 'HammerCLIKatello::LifecycleEnvironmentCommand',
45
+ 'hammer_cli_katello/lifecycle_environment'
46
+ )
47
+
48
+ HammerCLI::MainCommand.lazy_subcommand("ping", _("get the status of the server"),
49
+ 'HammerCLIKatello::PingCommand',
50
+ 'hammer_cli_katello/ping'
51
+ )
52
+
53
+ HammerCLI::MainCommand.lazy_subcommand("product", _("Manipulate products."),
54
+ 'HammerCLIKatello::Product',
55
+ 'hammer_cli_katello/product'
56
+ )
57
+
58
+ HammerCLI::MainCommand.lazy_subcommand("puppet-module", _("View Puppet Module details."),
59
+ 'HammerCLIKatello::PuppetModule',
60
+ 'hammer_cli_katello/puppet_module'
61
+ )
62
+
63
+ HammerCLI::MainCommand.lazy_subcommand("repository", _("Manipulate repositories"),
64
+ 'HammerCLIKatello::Repository',
65
+ 'hammer_cli_katello/repository'
66
+ )
67
+
68
+ HammerCLI::MainCommand.lazy_subcommand("repository-set",
69
+ _("manipulate repository sets on the server"),
70
+ 'HammerCLIKatello::RepositorySetCommand',
71
+ 'hammer_cli_katello/repository_set'
72
+ )
73
+
74
+ HammerCLI::MainCommand.lazy_subcommand("subscription", _("Manipulate subscriptions."),
75
+ 'HammerCLIKatello::SubscriptionCommand',
76
+ 'hammer_cli_katello/subscription'
77
+ )
78
+
79
+ HammerCLI::MainCommand.lazy_subcommand('sync-plan', _("Manipulate sync plans"),
80
+ 'HammerCLIKatello::SyncPlan',
81
+ 'hammer_cli_katello/sync_plan'
82
+ )
83
+
84
+ HammerCLI::MainCommand.lazy_subcommand('host-collection', _("Manipulate host collections"),
85
+ 'HammerCLIKatello::HostCollection',
86
+ 'hammer_cli_katello/host_collection'
87
+ )
88
+
89
+ HammerCLI::MainCommand.lazy_subcommand("content-host",
90
+ _("manipulate content hosts on the server"),
91
+ 'HammerCLIKatello::ContentHostCommand',
92
+ 'hammer_cli_katello/content_host'
93
+ )
94
+
95
+ HammerCLI::MainCommand.lazy_subcommand("content-view", _("Manipulate content views."),
96
+ 'HammerCLIKatello::ContentView',
97
+ 'hammer_cli_katello/content_view'
98
+ )
99
+
100
+ HammerCLI::MainCommand.lazy_subcommand("capsule", _("Manipulate capsule"),
101
+ 'HammerCLIKatello::Capsule',
102
+ 'hammer_cli_katello/capsule'
103
+ )
38
104
 
39
105
  end
@@ -2,8 +2,12 @@ module HammerCLIKatello
2
2
 
3
3
  class ActivationKeyCommand < HammerCLIKatello::Command
4
4
  resource :activation_keys
5
+ class Common
6
+ INTEGER_FORMAT = /^-?\d+/
7
+ end
5
8
 
6
9
  class ListCommand < HammerCLIKatello::ListCommand
10
+ include LifecycleEnvironmentNameResolvable
7
11
  action :index
8
12
 
9
13
  output do
@@ -22,7 +26,7 @@ module HammerCLIKatello
22
26
  data["format_consumed"] = _("%{consumed} of %{limit}") %
23
27
  {
24
28
  :consumed => data["usage_count"],
25
- :limit => data["usage_limit"] == -1 ? _("Unlimited") : data["usage_limit"]
29
+ :limit => data["unlimited"] ? _("Unlimited") : data["usage_limit"]
26
30
  }
27
31
  data
28
32
  end
@@ -31,8 +35,18 @@ module HammerCLIKatello
31
35
  end
32
36
 
33
37
  class InfoCommand < HammerCLIKatello::InfoCommand
38
+ include LifecycleEnvironmentNameResolvable
34
39
  action :show
35
40
 
41
+ def request_params
42
+ params = super
43
+ if options.keys.any? { |o| o.match(/\Aoption_organization.*/) }
44
+ params['organization_id'] = resolver.organization_id(
45
+ resolver.scoped_options('organization', all_options))
46
+ end
47
+ params
48
+ end
49
+
36
50
  output do
37
51
  field :name, _("Name")
38
52
  field :id, _("ID")
@@ -54,14 +68,24 @@ module HammerCLIKatello
54
68
  end
55
69
 
56
70
  class CreateCommand < HammerCLIKatello::CreateCommand
71
+ include LifecycleEnvironmentNameResolvable
57
72
  action :create
58
73
  success_message _("Activation key created")
59
74
  failure_message _("Could not create the activation key")
60
75
 
76
+ def request_params
77
+ params = super
78
+ if params.key?('max_content_hosts') && !params['max_content_hosts'].match(Common::INTEGER_FORMAT)
79
+ fail ::HammerCLI::Validator::ValidationError, 'Content host limit must be an integer'
80
+ end
81
+ params
82
+ end
83
+
61
84
  build_options
62
85
  end
63
86
 
64
87
  class UpdateCommand < HammerCLIKatello::UpdateCommand
88
+ include LifecycleEnvironmentNameResolvable
65
89
  action :update
66
90
  success_message _("Activation key updated")
67
91
  failure_message _("Could not update the activation key")
@@ -69,6 +93,15 @@ module HammerCLIKatello
69
93
  build_options
70
94
  end
71
95
 
96
+ class DeleteCommand < HammerCLIKatello::DeleteCommand
97
+ include LifecycleEnvironmentNameResolvable
98
+ action :destroy
99
+ success_message _("Activation key deleted")
100
+ failure_message _("Could not delete the activation key")
101
+
102
+ build_options
103
+ end
104
+
72
105
  class SubscriptionsCommand < HammerCLIKatello::ListCommand
73
106
  resource :subscriptions, :index
74
107
  desc _("List associated subscriptions")
@@ -171,6 +204,3 @@ module HammerCLIKatello
171
204
  end
172
205
 
173
206
  end
174
-
175
- HammerCLI::MainCommand.subcommand("activation-key", _("Manipulate activation keys."),
176
- HammerCLIKatello::ActivationKeyCommand)
@@ -5,6 +5,7 @@ module HammerCLIKatello
5
5
  extend HammerCLIForeman::AssociatingCommands::CommandExtension
6
6
 
7
7
  class AddRepositoryCommand < HammerCLIKatello::AddAssociatedCommand
8
+ include RepositoryScopedToProduct
8
9
  command_name 'add-repository'
9
10
  associated_resource :repositories
10
11
 
@@ -13,6 +14,7 @@ module HammerCLIKatello
13
14
  end
14
15
 
15
16
  class RemoveRepositoryCommand < HammerCLIKatello::RemoveAssociatedCommand
17
+ include RepositoryScopedToProduct
16
18
  command_name 'remove-repository'
17
19
  associated_resource :repositories
18
20
 
@@ -34,7 +36,7 @@ module HammerCLIKatello
34
36
  end
35
37
 
36
38
  class RemoveHostCollectionCommand < HammerCLIKatello::RemoveAssociatedCommand
37
- command_name 'remove-repository'
39
+ command_name 'remove-host-collection'
38
40
  associated_resource :host_collections
39
41
 
40
42
  success_message _("The host collection has been removed")
@@ -43,6 +43,10 @@ module HammerCLIKatello
43
43
  output do
44
44
  field :id, _("ID")
45
45
  field :name, _("Name")
46
+ from :organization do
47
+ field :name, _("Organization")
48
+ end
49
+
46
50
  end
47
51
 
48
52
  build_options
@@ -55,6 +59,10 @@ module HammerCLIKatello
55
59
  output do
56
60
  field :id, _("ID")
57
61
  field :name, _("Name")
62
+ from :organization do
63
+ field :name, _("Organization")
64
+ end
65
+
58
66
  end
59
67
 
60
68
  build_options
@@ -96,5 +104,4 @@ module HammerCLIKatello
96
104
  autoload_subcommands
97
105
  end
98
106
 
99
- HammerCLI::MainCommand.subcommand "capsule", _("Manipulate capsule"), Capsule
100
107
  end
@@ -1,5 +1,9 @@
1
1
  module HammerCLIKatello
2
2
 
3
+ RESOURCE_NAME_MAPPING = {
4
+ :system => :content_host
5
+ }
6
+
3
7
  module ResolverCommons
4
8
 
5
9
  def self.included(base)
@@ -18,6 +22,10 @@ module HammerCLIKatello
18
22
  @searchables
19
23
  end
20
24
 
25
+ def resource_name_mapping
26
+ HammerCLIKatello::RESOURCE_NAME_MAPPING
27
+ end
28
+
21
29
  end
22
30
  end
23
31
 
@@ -25,6 +33,10 @@ module HammerCLIKatello
25
33
  include HammerCLIKatello::ResolverCommons
26
34
  end
27
35
 
36
+ class SingleResourceCommand < HammerCLIForeman::SingleResourceCommand
37
+ include HammerCLIKatello::ResolverCommons
38
+ end
39
+
28
40
  class ListCommand < HammerCLIForeman::ListCommand
29
41
  include HammerCLIKatello::ResolverCommons
30
42
  end
@@ -1,8 +1,19 @@
1
+ require 'hammer_cli_katello/content_host_package'
2
+ require 'hammer_cli_katello/content_host_package_group'
3
+ require 'hammer_cli_katello/content_host_errata'
4
+
1
5
  module HammerCLIKatello
2
6
 
3
7
  class ContentHostCommand < HammerCLI::AbstractCommand
8
+ module IdDescriptionOverridable
9
+ def self.included(base)
10
+ base.option "--id", "ID",
11
+ _("ID of the content host")
12
+ end
13
+ end
4
14
 
5
15
  class ListCommand < HammerCLIKatello::ListCommand
16
+ include LifecycleEnvironmentNameResolvable
6
17
  resource :systems, :index
7
18
 
8
19
  output do
@@ -14,11 +25,14 @@ module HammerCLIKatello
14
25
  end
15
26
 
16
27
  class InfoCommand < HammerCLIKatello::InfoCommand
28
+ include LifecycleEnvironmentNameResolvable
29
+ include IdDescriptionOverridable
17
30
  resource :systems, :show
18
31
 
19
32
  output do
20
33
  field :name, _("Name")
21
34
  field :uuid, _("ID")
35
+ field :katello_agent_installed, _("Katello Agent Installed"), Fields::Boolean
22
36
  field :description, _("Description")
23
37
  field :location, _("Location")
24
38
  from :environment do
@@ -36,6 +50,7 @@ module HammerCLIKatello
36
50
  end
37
51
 
38
52
  class CreateCommand < HammerCLIKatello::CreateCommand
53
+ include LifecycleEnvironmentNameResolvable
39
54
  resource :systems, :create
40
55
 
41
56
  output InfoCommand.output_definition
@@ -50,10 +65,18 @@ module HammerCLIKatello
50
65
  end
51
66
  end
52
67
 
68
+ validate_options do
69
+ if any(:option_environment_id, :option_environment_name).exist?
70
+ any(:option_content_view_name, :option_content_view_id).required
71
+ end
72
+ end
73
+
53
74
  build_options :without => [:facts, :type, :installed_products]
54
75
  end
55
76
 
56
77
  class UpdateCommand < HammerCLIKatello::UpdateCommand
78
+ include IdDescriptionOverridable
79
+ include LifecycleEnvironmentNameResolvable
57
80
  resource :systems, :update
58
81
 
59
82
  success_message _("Content host updated")
@@ -63,6 +86,8 @@ module HammerCLIKatello
63
86
  end
64
87
 
65
88
  class DeleteCommand < HammerCLIKatello::DeleteCommand
89
+ include IdDescriptionOverridable
90
+ include LifecycleEnvironmentNameResolvable
66
91
  resource :systems, :destroy
67
92
 
68
93
  success_message _("Content host deleted")
@@ -72,6 +97,7 @@ module HammerCLIKatello
72
97
  end
73
98
 
74
99
  class TasksCommand < HammerCLIKatello::ListCommand
100
+ include IdDescriptionOverridable
75
101
  resource :systems, :tasks
76
102
 
77
103
  command_name "tasks"
@@ -80,11 +106,18 @@ module HammerCLIKatello
80
106
  end
81
107
 
82
108
  autoload_subcommands
83
- end
84
109
 
85
- cmd_name = "content-host"
86
- cmd_desc = _("manipulate content hosts on the server")
87
- cmd_cls = HammerCLIKatello::ContentHostCommand
88
- HammerCLI::MainCommand.subcommand(cmd_name, cmd_desc, cmd_cls)
110
+ subcommand "package",
111
+ HammerCLIKatello::ContentHostPackage.desc,
112
+ HammerCLIKatello::ContentHostPackage
113
+
114
+ subcommand "package-group",
115
+ HammerCLIKatello::ContentHostPackageGroup.desc,
116
+ HammerCLIKatello::ContentHostPackageGroup
117
+
118
+ subcommand "errata",
119
+ HammerCLIKatello::ContentHostErrata.desc,
120
+ HammerCLIKatello::ContentHostErrata
121
+ end
89
122
 
90
123
  end
@@ -0,0 +1,39 @@
1
+ module HammerCLIKatello
2
+ class ContentHostErrata < HammerCLIKatello::Command
3
+
4
+ desc "Manage errata on your content hosts"
5
+
6
+ class ApplyCommand < HammerCLIKatello::SingleResourceCommand
7
+ resource :system_errata, :apply
8
+ command_name "apply"
9
+ success_message _("Errata applied successfully")
10
+ failure_message _("Could not apply errata")
11
+
12
+ build_options
13
+ end
14
+
15
+ class InfoCommand < HammerCLIKatello::InfoCommand
16
+ resource :system_errata, :show
17
+ command_name "info"
18
+
19
+ output do
20
+ field :title, _("Title")
21
+ field :version, _("Version")
22
+ field :description, _("Description")
23
+ field :status, _("Status")
24
+ field :id, _("ID")
25
+ field :errata_id, _("Errata ID")
26
+ field :reboot_suggested, _("Reboot Suggested")
27
+ field :updated, _("Updated")
28
+ field :issued, _("Issued")
29
+ field :release, _("Release")
30
+ field :solution, _("Solution")
31
+ field :packages, _("Packages"), Fields::List
32
+ end
33
+
34
+ build_options
35
+ end
36
+
37
+ autoload_subcommands
38
+ end
39
+ end
@@ -0,0 +1,58 @@
1
+ module HammerCLIKatello
2
+
3
+ class ContentHostPackage < HammerCLIKatello::Command
4
+
5
+ desc "Manage packages on your content hosts"
6
+
7
+ class InstallCommand < HammerCLIKatello::SingleResourceCommand
8
+ include HammerCLIForemanTasks::Async
9
+ resource :system_packages, :install
10
+ command_name "install"
11
+ success_message "Packages install successfully"
12
+ failure_message "Could not install packages"
13
+
14
+ validate_options do
15
+ option(:option_packages).required
16
+ end
17
+
18
+ build_options :without => [:groups]
19
+ end
20
+
21
+ class UpgradeCommand < HammerCLIKatello::SingleResourceCommand
22
+ include HammerCLIForemanTasks::Async
23
+ resource :system_packages, :upgrade
24
+ command_name "upgrade"
25
+ success_message "Packages upgraded successfully"
26
+ failure_message "Could not upgrade packages"
27
+
28
+ build_options
29
+ end
30
+
31
+ class UpgradeAllCommand < HammerCLIKatello::SingleResourceCommand
32
+ include HammerCLIForemanTasks::Async
33
+ resource :system_packages, :upgrade_all
34
+ command_name "upgrade-all"
35
+ success_message "All packages upgraded successfully"
36
+ failure_message "Could not upgrade all packages"
37
+
38
+ build_options
39
+ end
40
+
41
+ class RemoveCommand < HammerCLIKatello::SingleResourceCommand
42
+ include HammerCLIForemanTasks::Async
43
+ resource :system_packages, :remove
44
+ command_name "remove"
45
+ success_message "Packages removed successfully"
46
+ failure_message "Could not remove packages"
47
+
48
+ validate_options do
49
+ option(:option_packages).required
50
+ end
51
+
52
+ build_options :without => [:groups]
53
+ end
54
+
55
+ autoload_subcommands
56
+ end
57
+
58
+ end