hammer_cli_foreman 2.3.0 → 2.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/doc/release_notes.md +27 -0
  3. data/lib/hammer_cli_foreman.rb +3 -0
  4. data/lib/hammer_cli_foreman/architecture.rb +5 -5
  5. data/lib/hammer_cli_foreman/bookmark.rb +6 -6
  6. data/lib/hammer_cli_foreman/command_extensions.rb +1 -0
  7. data/lib/hammer_cli_foreman/command_extensions/ping.rb +21 -2
  8. data/lib/hammer_cli_foreman/command_extensions/status.rb +1 -1
  9. data/lib/hammer_cli_foreman/command_extensions/update_common.rb +14 -0
  10. data/lib/hammer_cli_foreman/commands.rb +14 -0
  11. data/lib/hammer_cli_foreman/compute_profile.rb +5 -5
  12. data/lib/hammer_cli_foreman/compute_resource.rb +22 -0
  13. data/lib/hammer_cli_foreman/compute_resource/ovirt.rb +2 -1
  14. data/lib/hammer_cli_foreman/config_group.rb +5 -5
  15. data/lib/hammer_cli_foreman/config_report.rb +2 -0
  16. data/lib/hammer_cli_foreman/filter.rb +2 -2
  17. data/lib/hammer_cli_foreman/host.rb +1 -11
  18. data/lib/hammer_cli_foreman/hosts/common_update_options.rb +6 -5
  19. data/lib/hammer_cli_foreman/mail_notification.rb +2 -2
  20. data/lib/hammer_cli_foreman/model.rb +5 -5
  21. data/lib/hammer_cli_foreman/operating_system.rb +10 -9
  22. data/lib/hammer_cli_foreman/option_builders.rb +27 -7
  23. data/lib/hammer_cli_foreman/ping.rb +6 -1
  24. data/lib/hammer_cli_foreman/registration.rb +18 -0
  25. data/lib/hammer_cli_foreman/settings.rb +3 -3
  26. data/lib/hammer_cli_foreman/usergroup.rb +5 -5
  27. data/lib/hammer_cli_foreman/version.rb +1 -1
  28. data/locale/ca/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  29. data/locale/de/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  30. data/locale/en/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  31. data/locale/en_GB/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  32. data/locale/es/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  33. data/locale/fr/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  34. data/locale/it/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  35. data/locale/ja/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  36. data/locale/ko/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  37. data/locale/pt_BR/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  38. data/locale/ru/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  39. data/locale/zh_CN/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  40. data/locale/zh_TW/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  41. data/test/data/2.4/foreman_api.json +1 -0
  42. data/test/data/2.5/foreman_api.json +1 -0
  43. data/test/functional/architecture_test.rb +79 -0
  44. data/test/functional/bookmark_test.rb +22 -1
  45. data/test/functional/compute_profile_test.rb +54 -0
  46. data/test/functional/compute_resource_test.rb +37 -0
  47. data/test/functional/config_group_test.rb +50 -0
  48. data/test/functional/filter_test.rb +115 -47
  49. data/test/functional/host_test.rb +99 -3
  50. data/test/functional/http_proxy_test.rb +12 -0
  51. data/test/functional/location_test.rb +13 -0
  52. data/test/functional/mail_notification_test.rb +20 -0
  53. data/test/functional/media_test.rb +11 -0
  54. data/test/functional/model_test.rb +50 -0
  55. data/test/functional/operating_system_test.rb +51 -0
  56. data/test/functional/ping_test.rb +33 -0
  57. data/test/functional/realm_test.rb +11 -0
  58. data/test/functional/registration_test.rb +8 -0
  59. data/test/functional/report_template_test.rb +11 -0
  60. data/test/functional/settings_test.rb +21 -0
  61. data/test/functional/status_test.rb +79 -13
  62. data/test/functional/template_test.rb +12 -0
  63. data/test/functional/user_test.rb +11 -0
  64. data/test/functional/usergroup_test.rb +51 -0
  65. data/test/test_helper.rb +1 -1
  66. data/test/unit/apipie_resource_mock.rb +21 -0
  67. data/test/unit/architecture_test.rb +10 -1
  68. data/test/unit/bookmark_test.rb +99 -0
  69. data/test/unit/compute_profile_test.rb +87 -0
  70. data/test/unit/config_group_test.rb +10 -0
  71. data/test/unit/config_report_test.rb +1 -0
  72. data/test/unit/host_test.rb +0 -23
  73. data/test/unit/mail_notification_test.rb +53 -0
  74. data/test/unit/model_test.rb +10 -0
  75. data/test/unit/operating_system_test.rb +14 -1
  76. data/test/unit/settings_test.rb +4 -0
  77. data/test/unit/usergroup_test.rb +10 -0
  78. metadata +129 -107
  79. data/test/reports/TEST-Minitest-Result.xml +0 -4344
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1cb3de28c168226867cc9b1f4f63ea96bf2ff8746b831e2cdf01e6fe6670a53b
4
- data.tar.gz: 55b321941992865b2339fd1e0d11b3845c1396c0699f90c52ab4ba774974b70f
3
+ metadata.gz: 9a7510aa3b7250c6c467a18d128bc575f5a79f40c3a07283bb65def698e9c4cc
4
+ data.tar.gz: e5b1cbbd810d718b84f6a0102883bd4825880efe10250bbd8af1688966f209f1
5
5
  SHA512:
6
- metadata.gz: 7e50e0beb69a60b01613b3d7c282b927e54872de4533364e079f768e22f4a1e63aea967d7113e72a32ee35a20d4475a1cefef03055af956027e7fb3ce0fde00e
7
- data.tar.gz: 8ec8cc1402c57faa1b5bbb960bb9b4963e2c4c0e21b9e0a62e88c7e02ca2a01f976c83795c21b7c801aa635842df6fc5fb0794283bd8f666364bd91f404c661d
6
+ metadata.gz: e4112d9f91de37bfac6af33daf9d6e31d58d880889d421a873147dd75ac151c981849b641a90eb3322ca27add6b9dc8596f5a7fd8f6f95e830e1ffb3b8d3c5a5
7
+ data.tar.gz: 137ee8f5c12f70577b438132a4b5c2a68bb12c0f54f06fbdf6ad4d6db4b514bdea654c6daf3f1150132061a4e519f43c3d75828df4b2ac1fd96e767be9f45894
data/doc/release_notes.md CHANGED
@@ -1,5 +1,32 @@
1
1
  Release notes
2
2
  =============
3
+ ### 2.5.1 (2021-06-08)
4
+ * Show new msg for empty update commands, [#32454](http://projects.theforeman.org/issues/32454)
5
+
6
+ ### 2.5.0 (2021-05-04)
7
+ * Update test data to latest foreman
8
+ * change to resource_type_label, [#11454](http://projects.theforeman.org/issues/11454)
9
+ * Display the report origin, [#32428](http://projects.theforeman.org/issues/32428)
10
+ * Apply option family on searchablesoptionbuilder, [#30996](http://projects.theforeman.org/issues/30996)
11
+ * Add associate vms command for compute resource ([PR #563](https://github.com/theforeman/hammer-cli-foreman/pull/563)), [#32271](http://projects.theforeman.org/issues/32271)
12
+ * Support unrecognized services in ping, [#32265](http://projects.theforeman.org/issues/32265)
13
+ * Change --owner_type's default to user ([PR #562](https://github.com/theforeman/hammer-cli-foreman/pull/562)), [#30814](http://projects.theforeman.org/issues/30814)
14
+ * Drop puppetrun command from hammer ([PR #561](https://github.com/theforeman/hammer-cli-foreman/pull/561)), [#31806](http://projects.theforeman.org/issues/31806)
15
+ * Global registration module ([PR #558](https://github.com/theforeman/hammer-cli-foreman/pull/558)), [#31630](http://projects.theforeman.org/issues/31630)
16
+ * Add support for vnic profile ([PR #552](https://github.com/theforeman/hammer-cli-foreman/pull/552)), [#31493](http://projects.theforeman.org/issues/31493)
17
+ * Bump to 2.5.0-develop
18
+ * Bump to 2.4.0
19
+ * Correct descriptions for resources, [#31668](http://projects.theforeman.org/issues/31668)
20
+
21
+
22
+ ### 2.4.0 (2021-02-01)
23
+ * Fix hammer list failure when defaults are set ([PR #551](https://github.com/theforeman/hammer-cli-foreman/pull/551)), [#31384](http://projects.theforeman.org/issues/31384)
24
+ * Deprecating puppetrun command ([PR #554](https://github.com/theforeman/hammer-cli-foreman/pull/554)), [#31536](http://projects.theforeman.org/issues/31536)
25
+ * Set new owner with host update ([PR #556](https://github.com/theforeman/hammer-cli-foreman/pull/556)), [#31609](http://projects.theforeman.org/issues/31609)
26
+ * Consume structured statuses api data ([PR #553](https://github.com/theforeman/hammer-cli-foreman/pull/553)), [#31570](http://projects.theforeman.org/issues/31570)
27
+ * Added missing tests to filter ([PR #549](https://github.com/theforeman/hammer-cli-foreman/pull/549)), [#31074](http://projects.theforeman.org/issues/31074')
28
+ * Bump to 2.4.0-develop
29
+
3
30
  ### 2.3.0 (2020-11-03)
4
31
  * Hammer ping skip authentication ([PR #550](https://github.com/theforeman/hammer-cli-foreman/pull/550)), [#31140](http://projects.theforeman.org/issues/31140)
5
32
  * Return non-zero exit code if services failed, [#30496](http://projects.theforeman.org/issues/30496)
@@ -184,6 +184,9 @@ module HammerCLIForeman
184
184
 
185
185
  HammerCLI::MainCommand.lazy_subcommand('bookmark', _("Manage bookmarks"),
186
186
  'HammerCLIForeman::Bookmark', 'hammer_cli_foreman/bookmark')
187
+
188
+ HammerCLI::MainCommand.lazy_subcommand('host-registration', _("Host Registration"),
189
+ 'HammerCLIForeman::Registration', 'hammer_cli_foreman/registration')
187
190
  rescue => e
188
191
  handler = HammerCLIForeman::ExceptionHandler.new(:context => {}, :adapter => :base)
189
192
  handler.handle_exception(e)
@@ -11,7 +11,7 @@ module HammerCLIForeman
11
11
  field :name, _("Name")
12
12
  end
13
13
 
14
- build_options
14
+ build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
15
15
  end
16
16
 
17
17
 
@@ -23,7 +23,7 @@ module HammerCLIForeman
23
23
  HammerCLIForeman::References.timestamps(self)
24
24
  end
25
25
 
26
- build_options
26
+ build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
27
27
  end
28
28
 
29
29
 
@@ -31,7 +31,7 @@ module HammerCLIForeman
31
31
  success_message _("Architecture created.")
32
32
  failure_message _("Could not create the architecture")
33
33
 
34
- build_options
34
+ build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
35
35
  end
36
36
 
37
37
 
@@ -39,7 +39,7 @@ module HammerCLIForeman
39
39
  success_message _("Architecture deleted.")
40
40
  failure_message _("Could not delete the architecture")
41
41
 
42
- build_options
42
+ build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
43
43
  end
44
44
 
45
45
 
@@ -47,7 +47,7 @@ module HammerCLIForeman
47
47
  success_message _("Architecture updated.")
48
48
  failure_message _("Could not update the architecture")
49
49
 
50
- build_options
50
+ build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
51
51
  end
52
52
 
53
53
  HammerCLIForeman::AssociatingCommands::OperatingSystem.extend_command(self)
@@ -15,34 +15,34 @@ module HammerCLIForeman
15
15
  field :owner_type, _('Owner Type')
16
16
  end
17
17
 
18
- build_options
18
+ build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
19
19
  end
20
20
 
21
21
  class InfoCommand < HammerCLIForeman::InfoCommand
22
22
  output ListCommand.output_definition
23
-
24
- build_options
23
+
24
+ build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
25
25
  end
26
26
 
27
27
  class CreateCommand < HammerCLIForeman::CreateCommand
28
28
  success_message _('Bookmark %<name>s created.')
29
29
  failure_message _('Failed to create %<name>s bookmark')
30
30
 
31
- build_options
31
+ build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
32
32
  end
33
33
 
34
34
  class UpdateCommand < HammerCLIForeman::UpdateCommand
35
35
  success_message _('Bookmark %<name>s updated successfully.')
36
36
  failure_message _('Failed to update %<name>s bookmark')
37
37
 
38
- build_options
38
+ build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
39
39
  end
40
40
 
41
41
  class DeleteCommand < HammerCLIForeman::DeleteCommand
42
42
  success_message _('Bookmark deleted successfully.')
43
43
  failure_message _('Failed to delete bookmark')
44
44
 
45
- build_options
45
+ build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
46
46
  end
47
47
 
48
48
  autoload_subcommands
@@ -1,3 +1,4 @@
1
+ require 'hammer_cli_foreman/command_extensions/update_common'
1
2
  require 'hammer_cli_foreman/command_extensions/fields'
2
3
  require 'hammer_cli_foreman/command_extensions/puppet_environment'
3
4
  require 'hammer_cli_foreman/command_extensions/puppet_environments'
@@ -10,9 +10,28 @@ module HammerCLIForeman
10
10
  end
11
11
  end
12
12
 
13
+ def self.check_for_unrecognized(plugins, output_definition)
14
+ failed = plugins.select { |_, data| data['services'] }
15
+ .each_with_object([]) { |(_, d), s| s << d['services'] }
16
+ .reduce({}, :merge)
17
+ .select do |name, data|
18
+ begin
19
+ output_definition.find_field(name)
20
+ false
21
+ rescue ArgumentError
22
+ data['status'] == _('FAIL')
23
+ end
24
+ end
25
+ return if failed.empty?
26
+
27
+ warn [_('%{count} more service(s) failed, but not shown:') % { count: failed.size },
28
+ failed.keys.join(', '),
29
+ ''].join("\n")
30
+ end
31
+
13
32
  def self.failed?(services)
14
- services.each_value.any? { |s| s['status'] == _('FAIL') } ||
15
- services['foreman']['database']['active'] == 'FAIL'
33
+ services['foreman']['database']['active'] == 'FAIL' ||
34
+ services.each_value.any? { |s| s['status'] == _('FAIL') }
16
35
  end
17
36
 
18
37
  request_options do |options|
@@ -4,7 +4,7 @@ module HammerCLIForeman
4
4
  before_print do |data|
5
5
  return if data['results'].nil?
6
6
 
7
- normalize_plugins(data['results']['foreman']['plugins'])
7
+ normalize_plugins(data['results']['foreman']['plugins']) if data['results']['foreman']['plugins'].any?(String)
8
8
  data['results']['foreman']['smart_proxies'].each do |proxy|
9
9
  proxy['features'] = normalize_features(proxy['features'])
10
10
  proxy['failed_features'] = normalize_failed_features(proxy['failed_features'])
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HammerCLIForeman
4
+ module CommandExtensions
5
+ class UpdateCommon < HammerCLI::CommandExtensions
6
+ inheritable true
7
+
8
+ request_params do |params, command_object|
9
+ update_params = params[command_object.resource.singular_name]
10
+ command_object.context[:action_message] = :nothing_to_do if update_params && update_params.empty?
11
+ end
12
+ end
13
+ end
14
+ end
@@ -548,6 +548,19 @@ module HammerCLIForeman
548
548
  builder
549
549
  end
550
550
 
551
+ def self.inherited(child)
552
+ child.success_message_for(:nothing_to_do, _('Nothing to update.'))
553
+ end
554
+
555
+ def clean_up_context
556
+ super
557
+ context.delete(:action_message)
558
+ end
559
+
560
+ def success_message
561
+ success_message_for(context[:action_message] || :default)
562
+ end
563
+
551
564
  def method_options_for_params(params, options)
552
565
  opts = super
553
566
  # overwrite searchables with correct values
@@ -560,6 +573,7 @@ module HammerCLIForeman
560
573
  opts
561
574
  end
562
575
 
576
+ extend_with(HammerCLIForeman::CommandExtensions::UpdateCommon.new)
563
577
  end
564
578
 
565
579
 
@@ -9,7 +9,7 @@ module HammerCLIForeman
9
9
  field :id, _('Id')
10
10
  field :name, _('Name')
11
11
  end
12
- build_options
12
+ build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
13
13
  end
14
14
 
15
15
  class InfoCommand < HammerCLIForeman::InfoCommand
@@ -25,13 +25,13 @@ module HammerCLIForeman
25
25
  field :vm_attrs, _('VM attributes')
26
26
  end
27
27
  end
28
- build_options
28
+ build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
29
29
  end
30
30
 
31
31
  class CreateCommand < HammerCLIForeman::CreateCommand
32
32
  success_message _('Compute profile created.')
33
33
  failure_message _('Could not create a compute profile')
34
- build_options
34
+ build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
35
35
  end
36
36
 
37
37
  class UpdateCommand < HammerCLIForeman::UpdateCommand
@@ -40,7 +40,7 @@ module HammerCLIForeman
40
40
  validate_options do
41
41
  any(:option_name,:option_id).required
42
42
  end
43
- build_options
43
+ build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
44
44
  end
45
45
 
46
46
  class DeleteCommand < HammerCLIForeman::DeleteCommand
@@ -49,7 +49,7 @@ module HammerCLIForeman
49
49
  validate_options do
50
50
  any(:option_name,:option_id).required
51
51
  end
52
- build_options
52
+ build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
53
53
  end
54
54
 
55
55
  lazy_subcommand('values', _("Create update and delete Compute profile values"),
@@ -104,6 +104,15 @@ module HammerCLIForeman
104
104
  build_options
105
105
  end
106
106
 
107
+ class AssociateVmsCommand < HammerCLIForeman::Command
108
+ action :associate
109
+ command_name 'associate-vms'
110
+ success_message _("Virtual machines have been associated.")
111
+ failure_message _("Could not associate the virtual machines")
112
+
113
+ build_options
114
+ end
115
+
107
116
  class AvailableClustersCommand < HammerCLIForeman::ListCommand
108
117
  action :available_clusters
109
118
  command_name 'clusters'
@@ -128,6 +137,19 @@ module HammerCLIForeman
128
137
  build_options
129
138
  end
130
139
 
140
+ class AvailableVnicProfilesCommand < HammerCLIForeman::ListCommand
141
+ action :available_vnic_profiles
142
+ command_name 'vnic-profiles'
143
+
144
+ output do
145
+ field :id, _('VNIC profile ID'), Fields::Field, :max_width => 200, :hide_blank => true
146
+ field :name, _('Name')
147
+ field :network, _('Network ID')
148
+ end
149
+
150
+ build_options
151
+ end
152
+
131
153
  class AvailableImagesCommand < HammerCLIForeman::ListCommand
132
154
  action :available_images
133
155
  command_name 'images'
@@ -28,7 +28,8 @@ module HammerCLIForeman
28
28
  [
29
29
  ['compute_name', _('Compute name, e.g. eth0')],
30
30
  ['compute_network', _('Select one of available networks for a cluster, must be an ID or a name')],
31
- ['compute_interface', _('Interface type')]
31
+ ['compute_interface', _('Interface type')],
32
+ ['compute_vnic_profile', _('Vnic Profile')]
32
33
  ]
33
34
  end
34
35
 
@@ -8,7 +8,7 @@ module HammerCLIForeman
8
8
  field :name, _("Name")
9
9
  end
10
10
 
11
- build_options
11
+ build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
12
12
  end
13
13
 
14
14
  class InfoCommand < HammerCLIForeman::InfoCommand
@@ -16,28 +16,28 @@ module HammerCLIForeman
16
16
  HammerCLIForeman::References.puppetclasses(self)
17
17
  end
18
18
 
19
- build_options
19
+ build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
20
20
  end
21
21
 
22
22
  class CreateCommand < HammerCLIForeman::CreateCommand
23
23
  success_message _("Config group created.")
24
24
  failure_message _("Could not create the config group")
25
25
 
26
- build_options
26
+ build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
27
27
  end
28
28
 
29
29
  class UpdateCommand < HammerCLIForeman::UpdateCommand
30
30
  success_message _("Config group updated.")
31
31
  failure_message _("Could not update the config group")
32
32
 
33
- build_options
33
+ build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
34
34
  end
35
35
 
36
36
  class DeleteCommand < HammerCLIForeman::DeleteCommand
37
37
  success_message _("Config group has been deleted.")
38
38
  failure_message _("Could not delete the config group")
39
39
 
40
- build_options
40
+ build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
41
41
  end
42
42
 
43
43
  autoload_subcommands
@@ -10,6 +10,7 @@ module HammerCLIForeman
10
10
  field :id, _("Id")
11
11
  field :host_name, _("Host")
12
12
  field :reported_at, _("Last report"), Fields::Date
13
+ field :origin, _("Origin")
13
14
  from "status" do
14
15
  field :applied, _("Applied")
15
16
  field :restarted, _("Restarted")
@@ -30,6 +31,7 @@ module HammerCLIForeman
30
31
  field :id, _("Id")
31
32
  field :host_name, _("Host")
32
33
  field :reported_at, _("Reported at"), Fields::Date
34
+ field :origin, _("Origin")
33
35
  label _("Report status") do
34
36
  from "status" do
35
37
  field :applied, _("Applied")
@@ -78,7 +78,7 @@ module HammerCLIForeman
78
78
  class CreateCommand < HammerCLIForeman::CreateCommand
79
79
  include TaxonomyCheck
80
80
 
81
- success_message _("Permission filter for [%<resource_type>s] created.")
81
+ success_message _("Permission filter for [%<resource_type_label>s] created.")
82
82
  failure_message _("Could not create the permission filter")
83
83
 
84
84
  def validate_options
@@ -92,7 +92,7 @@ module HammerCLIForeman
92
92
  class UpdateCommand < HammerCLIForeman::UpdateCommand
93
93
  include TaxonomyCheck
94
94
 
95
- success_message _("Permission filter for [%<resource_type>s] updated.")
95
+ success_message _("Permission filter for [%<resource_type_label>s] updated.")
96
96
  failure_message _("Could not update the permission filter")
97
97
 
98
98
  def request_params
@@ -171,17 +171,7 @@ module HammerCLIForeman
171
171
  end
172
172
 
173
173
 
174
- class PuppetRunCommand < HammerCLIForeman::SingleResourceCommand
175
- command_name "puppetrun"
176
- resource :puppet_hosts
177
- action :puppetrun
178
-
179
- def print_data(records)
180
- print_message _('Puppet run triggered')
181
- end
182
-
183
- build_options
184
- end
174
+
185
175
 
186
176
 
187
177
  class FactsCommand < HammerCLIForeman::AssociatedResourceListCommand
@@ -6,7 +6,7 @@ module HammerCLIForeman
6
6
  base.option "--owner", "OWNER_LOGIN", _("Login of the owner"),
7
7
  :attribute_name => :option_user_login
8
8
  base.option "--owner-id", "OWNER_ID", _("ID of the owner"),
9
- :attribute_name => :option_user_id
9
+ :attribute_name => :option_owner_id
10
10
 
11
11
  base.option "--root-password", "ROOT_PW",
12
12
  _("Required if host is managed and value is not inherited from host group or default password in settings")
@@ -134,13 +134,14 @@ module HammerCLIForeman
134
134
 
135
135
  private
136
136
 
137
- def owner_id(name, type = 'User')
137
+
138
+ def owner_id(name, type)
138
139
  return unless name
139
- return resolver.user_id('option_login' => name) if type == 'User'
140
+ return resolver.usergroup_id('option_name' => name) if type == 'Usergroup'
140
141
 
141
- resolver.usergroup_id('option_name' => name)
142
+ resolver.user_id('option_login' => name)
142
143
  end
143
-
144
+
144
145
  def proxy_id(name)
145
146
  resolver.smart_proxy_id('option_name' => name) if name
146
147
  end