hammer_cli_foreman_discovery 1.2.0 → 1.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 437c3b56e34868fe63885b2fa1f88297a3c3beccf89018156236c52c206e5d17
4
- data.tar.gz: 704cda11e2d98717abcb0ff3d08764c37a669e051da4f20fac9e7a76edc3271d
3
+ metadata.gz: 802f7f3eeb1690a136f1fee27ef62216fe8beab061640a9139d3050eb3f1d722
4
+ data.tar.gz: b26d74acfcdcf2d119b3dfc07cf2c57861b14b37d0766971078edcbf3659b78a
5
5
  SHA512:
6
- metadata.gz: 32f35416b72207ea81b23bd3e1d7a81ec912b74624d66f588f9b863c81cb5cc7d0570d7f60d6b0fe6ebd9f5d43004cbbce8b2cf5251f10d97f036c416cdcaeea
7
- data.tar.gz: e68961ff1a6cd06c7c98039924ca0f924ffc599e664c684572e5991f9459b7b026adfc97f707ad13a3cd73b1756acb17a11ee19c08be0bf35b105a1c28315a8f
6
+ metadata.gz: 9a345994e82071f26f6eae485267e51504b97e9235053029675aa2d8f5b19211218c9ebce97636649e6bb1e96588e2a54c68a3d989f53aaae3b1e2a74fe770ed
7
+ data.tar.gz: 491c79e6275f61b06bd712483458b234380ffea78122bc4ebcaf4162a50f196f304dc1db66b15cc79edd59ddbcf4f97fe95bc69a3fc7be15181abc37eb708cc5
@@ -18,7 +18,7 @@ module HammerCLIForemanDiscovery
18
18
  description: _('Puppet environment. Required if host is managed and value is not inherited from host group'),
19
19
  deprecation: _("Use %s instead") % '--puppet-environment[-id]',
20
20
  deprecated: { '--environment' => _("Use %s instead") % '--puppet-environment[-id]',
21
- '--environment-id' => _("Use %s instead") % '--puppet-environment[-id]'}
21
+ '--environment-id' => _("Use %s instead") % '--puppet-environment[-id]' }
22
22
  ) do
23
23
  parent '--environment-id', 'ENVIRONMENT_ID', _(''),
24
24
  format: HammerCLI::Options::Normalizers::Number.new,
@@ -33,7 +33,6 @@ module HammerCLIForemanDiscovery
33
33
  parent '--puppet-proxy-id', 'PUPPET_PROXY_ID', _(''),
34
34
  format: HammerCLI::Options::Normalizers::Number.new,
35
35
  attribute_name: :option_puppet_proxy_id
36
-
37
36
  end
38
37
  option_family(
39
38
  aliased_resource: 'puppet_ca_proxy'
@@ -41,7 +40,6 @@ module HammerCLIForemanDiscovery
41
40
  parent '--puppet-ca-proxy-id', 'PUPPET_CA_PROXY_ID', _(''),
42
41
  format: HammerCLI::Options::Normalizers::Number.new,
43
42
  attribute_name: :option_puppet_ca_proxy_id
44
-
45
43
  end
46
44
 
47
45
  request_params do |params, command_object|
@@ -4,11 +4,10 @@ require 'hammer_cli_foreman/fact'
4
4
 
5
5
  module HammerCLIForemanDiscovery
6
6
  def self.exception_handler_class
7
- HammerCLIForeman::ExceptionHandler
7
+ HammerCLIForeman::ExceptionHandler
8
8
  end
9
9
 
10
10
  class DiscoveredHost < HammerCLIForeman::Command
11
-
12
11
  resource :discovered_hosts
13
12
 
14
13
  class ListCommand < HammerCLIForeman::ListCommand
@@ -38,7 +37,6 @@ module HammerCLIForemanDiscovery
38
37
  build_options
39
38
  end
40
39
 
41
-
42
40
  class FactsCommand < HammerCLIForeman::AssociatedResourceListCommand
43
41
  command_name "facts"
44
42
  resource :fact_values, :index
@@ -77,8 +75,8 @@ module HammerCLIForemanDiscovery
77
75
 
78
76
  option "--root-password", "ROOT_PW", " "
79
77
  option "--ask-root-password", "ASK_ROOT_PW", " ",
80
- :format => HammerCLI::Options::Normalizers::Bool.new
81
- bool_format = {}
78
+ :format => HammerCLI::Options::Normalizers::Bool.new
79
+ bool_format = {}
82
80
  bool_format[:format] = HammerCLI::Options::Normalizers::Bool.new
83
81
  option "--managed", "MANAGED", " ", bool_format
84
82
  bool_format[:format] = HammerCLI::Options::Normalizers::Bool.new
@@ -89,14 +87,14 @@ module HammerCLIForemanDiscovery
89
87
  option "--overwrite", "OVERWRITE", " ", bool_format
90
88
 
91
89
  option "--parameters", "PARAMS", _("Host parameters"),
92
- :format => HammerCLI::Options::Normalizers::KeyValueList.new
90
+ :format => HammerCLI::Options::Normalizers::KeyValueList.new
93
91
  option "--interface", "INTERFACE", _("Interface parameters"), :multivalued => true,
94
- :format => HammerCLI::Options::Normalizers::KeyValueList.new
92
+ :format => HammerCLI::Options::Normalizers::KeyValueList.new
95
93
  option "--provision-method", "METHOD", " ",
96
- :format => HammerCLI::Options::Normalizers::Enum.new(['build', 'image'])
94
+ :format => HammerCLI::Options::Normalizers::Enum.new(%w[build image])
97
95
 
98
96
  def ask_password
99
- prompt = _("Enter the root password for the host:") + '_'
97
+ prompt = "#{_('Enter the root password for the host:')}_"
100
98
  ask(prompt) { |q| q.echo = false }
101
99
  end
102
100
 
@@ -119,16 +117,15 @@ module HammerCLIForemanDiscovery
119
117
  return {} unless option_parameters
120
118
  option_parameters.collect do |key, value|
121
119
  if value.is_a? String
122
- {"name"=>key, "value"=>value}
120
+ { "name" => key, "value" => value }
123
121
  else
124
- {"name"=>key, "value"=>value.inspect}
122
+ { "name" => key, "value" => value.inspect }
125
123
  end
126
124
  end
127
125
  end
128
126
 
129
- build_options without: %i[
130
- root_pass ptable_id host_parameters_attributes
131
- puppet_class_ids environment_id puppet_proxy_id puppet_ca_proxy_id
127
+ build_options without: [
128
+ :root_pass, :ptable_id, :host_parameters_attributes, :puppet_class_ids, :environment_id, :puppet_proxy_id, :puppet_ca_proxy_id
132
129
  ] do |o|
133
130
  # TODO: Until the API is cleaned up
134
131
  o.expand.except(:environments)
@@ -180,10 +177,10 @@ module HammerCLIForemanDiscovery
180
177
  resource.call(:reboot_all, {})
181
178
  print_message _("Rebooting hosts")
182
179
  HammerCLI::EX_OK
183
- rescue RestClient::UnprocessableEntity => error
184
- response = JSON.parse(error.response)
185
- response = HammerCLIForeman.record_to_common_format(response) unless response.has_key?('message')
186
- output.print_error(response['host_details'].map {|i| i['name'] + ": " + i['error'] }.join("\n"))
180
+ rescue RestClient::UnprocessableEntity => e
181
+ response = JSON.parse(e.response)
182
+ response = HammerCLIForeman.record_to_common_format(response) unless response.key?('message')
183
+ output.print_error(response['host_details'].map { |i| "#{i['name']}: #{i['error']}" }.join("\n"))
187
184
  HammerCLI::EX_DATAERR
188
185
  end
189
186
  else
@@ -208,5 +205,4 @@ module HammerCLIForemanDiscovery
208
205
  end
209
206
  autoload_subcommands
210
207
  end
211
-
212
208
  end
@@ -1,5 +1,4 @@
1
1
  module HammerCLIForemanDiscovery
2
-
3
2
  module DiscoveryReferences
4
3
  def self.hosts(dsl)
5
4
  dsl.build do
@@ -9,4 +8,4 @@ module HammerCLIForemanDiscovery
9
8
  end
10
9
  end
11
10
  end
12
- end
11
+ end
@@ -8,21 +8,17 @@ module HammerCLIForemanDiscovery
8
8
  end
9
9
 
10
10
  module CommonDiscoveryRuleUpdateOptions
11
-
12
11
  def self.included(base)
13
12
  base.option "--hosts-limit", "HOSTS_LIMIT", _("Enables to limit maximum amount of provisioned hosts per rule"),
14
13
  :attribute_name => :option_max_count
15
14
  base.build_options :without => :max_count
16
15
  end
17
-
18
16
  end
19
17
 
20
18
  class DiscoveryRule < HammerCLIForeman::Command
21
-
22
19
  resource :discovery_rules
23
20
 
24
21
  class ListCommand < HammerCLIForeman::ListCommand
25
-
26
22
  output do
27
23
  field :id, _("ID")
28
24
  field :name, _("Name")
@@ -37,7 +33,6 @@ module HammerCLIForemanDiscovery
37
33
  end
38
34
 
39
35
  class InfoCommand < HammerCLIForeman::InfoCommand
40
-
41
36
  output ListCommand.output_definition do
42
37
  field :hostname, _('Hostname template')
43
38
  HammerCLIForemanDiscovery::DiscoveryReferences.hosts(self)
@@ -70,5 +65,4 @@ module HammerCLIForemanDiscovery
70
65
 
71
66
  autoload_subcommands
72
67
  end
73
-
74
68
  end
@@ -2,9 +2,7 @@ require 'hammer_cli/i18n'
2
2
 
3
3
  module HammerCLIForemanDiscovery
4
4
  module I18n
5
-
6
5
  class LocaleDomain < HammerCLI::I18n::LocaleDomain
7
-
8
6
  def translated_files
9
7
  Dir.glob(File.join(File.dirname(__FILE__), '../**/*.rb'))
10
8
  end
@@ -17,8 +15,7 @@ module HammerCLIForemanDiscovery
17
15
  'hammer_cli_foreman_discovery'
18
16
  end
19
17
  end
20
-
21
18
  end
22
19
  end
23
20
 
24
- HammerCLI::I18n.add_domain(HammerCLIForemanDiscovery::I18n::LocaleDomain.new)
21
+ HammerCLI::I18n.add_domain(HammerCLIForemanDiscovery::I18n::LocaleDomain.new)
@@ -1,5 +1,5 @@
1
1
  module HammerCLIForemanDiscovery
2
2
  def self.version
3
- @version ||= Gem::Version.new('1.2.0')
3
+ @version ||= Gem::Version.new('1.3.0')
4
4
  end
5
5
  end
@@ -5,16 +5,13 @@ module HammerCLIForemanDiscovery
5
5
  require 'hammer_cli_foreman_discovery/discovery_references'
6
6
 
7
7
  HammerCLI::MainCommand.lazy_subcommand('discovery', _("Manipulate discovered hosts."),
8
- 'HammerCLIForemanDiscovery::DiscoveredHost', 'hammer_cli_foreman_discovery/discovery'
9
- )
8
+ 'HammerCLIForemanDiscovery::DiscoveredHost', 'hammer_cli_foreman_discovery/discovery')
10
9
 
11
10
  HammerCLI::MainCommand.lazy_subcommand('discovery-rule', _("Manipulate discovered rules."),
12
- 'HammerCLIForemanDiscovery::DiscoveryRule', 'hammer_cli_foreman_discovery/discovery_rule'
13
- )
14
-
15
- rescue => e
11
+ 'HammerCLIForemanDiscovery::DiscoveryRule', 'hammer_cli_foreman_discovery/discovery_rule')
12
+ rescue StandardError => e
16
13
  handler = HammerCLIForeman::ExceptionHandler.new(:context => {}, :adapter => :base)
17
14
  handler.handle_exception(e)
18
- raise HammerCLI::ModuleLoadingError.new(e)
15
+ raise HammerCLI::ModuleLoadingError, e
19
16
  end
20
17
  end
metadata CHANGED
@@ -1,48 +1,34 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hammer_cli_foreman_discovery
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ohad Levy
8
8
  - Ori Rabin
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-01-07 00:00:00.000000000 Z
12
+ date: 2024-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hammer_cli_foreman
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 0.1.2
20
+ version: '3.10'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ">="
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 0.1.2
28
- - !ruby/object:Gem::Dependency
29
- name: rake
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: '0'
27
+ version: '3.10'
42
28
  description: 'Contains the code for managing host discovery in foreman(results and
43
29
  progress) in the Hammer CLI.
44
30
 
45
- '
31
+ '
46
32
  email:
47
33
  - ohadlevy@gmail.com
48
34
  executables: []
@@ -98,7 +84,7 @@ homepage: https://github.com/theforeman/hammer-cli-foreman-discovery
98
84
  licenses:
99
85
  - GPL-3.0-or-later
100
86
  metadata: {}
101
- post_install_message:
87
+ post_install_message:
102
88
  rdoc_options: []
103
89
  require_paths:
104
90
  - lib
@@ -106,15 +92,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
106
92
  requirements:
107
93
  - - ">="
108
94
  - !ruby/object:Gem::Version
109
- version: '0'
95
+ version: '2.7'
96
+ - - "<"
97
+ - !ruby/object:Gem::Version
98
+ version: '4'
110
99
  required_rubygems_version: !ruby/object:Gem::Requirement
111
100
  requirements:
112
101
  - - ">="
113
102
  - !ruby/object:Gem::Version
114
103
  version: '0'
115
104
  requirements: []
116
- rubygems_version: 3.2.33
117
- signing_key:
105
+ rubygems_version: 3.1.6
106
+ signing_key:
118
107
  specification_version: 4
119
108
  summary: Foreman CLI plugin for managing discovery hosts in foreman
120
109
  test_files: []