hammer_cli_foreman 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of hammer_cli_foreman might be problematic. Click here for more details.

Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hammer_cli_foreman/architecture.rb +4 -6
  3. data/lib/hammer_cli_foreman/associating_commands.rb +26 -4
  4. data/lib/hammer_cli_foreman/commands.rb +17 -27
  5. data/lib/hammer_cli_foreman/common_parameter.rb +4 -3
  6. data/lib/hammer_cli_foreman/compute_resource.rb +3 -5
  7. data/lib/hammer_cli_foreman/domain.rb +8 -12
  8. data/lib/hammer_cli_foreman/environment.rb +2 -1
  9. data/lib/hammer_cli_foreman/exception_handler.rb +11 -2
  10. data/lib/hammer_cli_foreman/exceptions.rb +0 -2
  11. data/lib/hammer_cli_foreman/fact.rb +1 -5
  12. data/lib/hammer_cli_foreman/host.rb +47 -38
  13. data/lib/hammer_cli_foreman/hostgroup.rb +5 -8
  14. data/lib/hammer_cli_foreman/image.rb +11 -13
  15. data/lib/hammer_cli_foreman/location.rb +2 -5
  16. data/lib/hammer_cli_foreman/media.rb +2 -6
  17. data/lib/hammer_cli_foreman/model.rb +4 -5
  18. data/lib/hammer_cli_foreman/operating_system.rb +14 -18
  19. data/lib/hammer_cli_foreman/organization.rb +2 -5
  20. data/lib/hammer_cli_foreman/output.rb +2 -2
  21. data/lib/hammer_cli_foreman/parameter.rb +6 -8
  22. data/lib/hammer_cli_foreman/partition_table.rb +8 -11
  23. data/lib/hammer_cli_foreman/puppet_class.rb +2 -4
  24. data/lib/hammer_cli_foreman/report.rb +3 -4
  25. data/lib/hammer_cli_foreman/smart_class_parameter.rb +2 -6
  26. data/lib/hammer_cli_foreman/smart_proxy.rb +4 -7
  27. data/lib/hammer_cli_foreman/subnet.rb +2 -5
  28. data/lib/hammer_cli_foreman/template.rb +5 -6
  29. data/lib/hammer_cli_foreman/user.rb +2 -5
  30. data/lib/hammer_cli_foreman/version.rb +1 -1
  31. data/lib/hammer_cli_foreman.rb +7 -3
  32. data/test/unit/apipie_resource_mock.rb +9 -3
  33. data/test/unit/commands_test.rb +20 -0
  34. data/test/unit/exception_handler_test.rb +35 -1
  35. data/test/unit/helpers/command.rb +10 -2
  36. data/test/unit/host_test.rb +22 -0
  37. data/test/unit/partition_table_test.rb +4 -4
  38. metadata +6 -6
@@ -1,7 +1,3 @@
1
- require 'hammer_cli'
2
- require 'foreman_api'
3
- require 'hammer_cli_foreman/commands'
4
- require 'hammer_cli_foreman/parameter'
5
1
  require 'hammer_cli_foreman/report'
6
2
  require 'hammer_cli_foreman/puppet_class'
7
3
  require 'hammer_cli_foreman/smart_class_parameter'
@@ -34,12 +30,15 @@ module HammerCLIForeman
34
30
  base.option "--puppetclass-ids", "PUPPETCLASS_IDS", " ",
35
31
  :format => HammerCLI::Options::Normalizers::List.new
36
32
 
37
- base.option "--build", "BUILD", " ", :default => 'true',
38
- :format => HammerCLI::Options::Normalizers::Bool.new
39
- base.option "--managed", "MANAGED", " ", :default => 'true',
40
- :format => HammerCLI::Options::Normalizers::Bool.new
41
- base.option "--enabled", "ENABLED", " ", :default => 'true',
42
- :format => HammerCLI::Options::Normalizers::Bool.new
33
+ bme_options = {}
34
+ bme_options[:default] = 'true' if base.action.to_sym == :create
35
+
36
+ bme_options[:format] = HammerCLI::Options::Normalizers::Bool.new
37
+ base.option "--managed", "MANAGED", " ", bme_options
38
+ bme_options[:format] = HammerCLI::Options::Normalizers::Bool.new
39
+ base.option "--build", "BUILD", " ", bme_options
40
+ bme_options[:format] = HammerCLI::Options::Normalizers::Bool.new
41
+ base.option "--enabled", "ENABLED", " ", bme_options
43
42
 
44
43
  base.option "--parameters", "PARAMS", "Host parameters.",
45
44
  :format => HammerCLI::Options::Normalizers::KeyValueList.new
@@ -49,28 +48,27 @@ module HammerCLIForeman
49
48
  :format => HammerCLI::Options::Normalizers::KeyValueList.new
50
49
  base.option "--interface", "INTERFACE", "Interface parameters.", :multivalued => true,
51
50
  :format => HammerCLI::Options::Normalizers::KeyValueList.new
52
-
53
51
  end
54
52
 
55
53
  def request_params
56
54
  params = super
57
55
 
58
- params['host']['build'] = build
59
- params['host']['managed'] = managed
60
- params['host']['enabled'] = enabled
56
+ params['host']['build'] = option_build unless option_build.nil?
57
+ params['host']['managed'] = option_managed unless option_managed.nil?
58
+ params['host']['enabled'] = option_enabled unless option_enabled.nil?
61
59
 
62
- params['host']['puppetclass_ids'] = puppetclass_ids
60
+ params['host']['puppetclass_ids'] = option_puppetclass_ids unless option_puppetclass_ids.nil?
63
61
 
64
- params['host']['ptable_id'] = partition_table_id
65
- params['host']['compute_resource_id'] = compute_resource_id
62
+ params['host']['ptable_id'] = option_partition_table_id unless option_partition_table_id.nil?
63
+ params['host']['compute_resource_id'] = option_compute_resource_id unless option_compute_resource_id.nil?
66
64
  params['host']['host_parameters_attributes'] = parameter_attributes
67
- params['host']['compute_attributes'] = compute_attributes || {}
68
- params['host']['compute_attributes']['volumes_attributes'] = nested_attributes(volume_list)
69
- if compute_resource_id
70
- params['host']['compute_attributes']['interfaces_attributes'] = nested_attributes(interface_list)
71
- params['host']['compute_attributes']['nics_attributes'] = nested_attributes(interface_list)
65
+ params['host']['compute_attributes'] = option_compute_attributes || {}
66
+ params['host']['compute_attributes']['volumes_attributes'] = nested_attributes(option_volume_list)
67
+ if option_compute_resource_id
68
+ params['host']['compute_attributes']['interfaces_attributes'] = nested_attributes(option_interface_list)
69
+ params['host']['compute_attributes']['nics_attributes'] = nested_attributes(option_interface_list)
72
70
  else
73
- params['host']['interfaces_attributes'] = nested_attributes(interface_list)
71
+ params['host']['interfaces_attributes'] = nested_attributes(option_interface_list)
74
72
  end
75
73
 
76
74
  params
@@ -79,8 +77,8 @@ module HammerCLIForeman
79
77
  private
80
78
 
81
79
  def parameter_attributes
82
- return {} unless parameters
83
- parameters.collect do |key, value|
80
+ return {} unless option_parameters
81
+ option_parameters.collect do |key, value|
84
82
  {"name"=>key, "value"=>value, "nested"=>""}
85
83
  end
86
84
  end
@@ -170,6 +168,8 @@ module HammerCLIForeman
170
168
  field nil, nil, Fields::KeyValue
171
169
  end
172
170
  end
171
+
172
+ apipie_options
173
173
  end
174
174
 
175
175
 
@@ -207,6 +207,8 @@ module HammerCLIForeman
207
207
  status = resource.call(:power, params)[0]
208
208
  status["power"]
209
209
  end
210
+
211
+ apipie_options
210
212
  end
211
213
 
212
214
 
@@ -218,6 +220,8 @@ module HammerCLIForeman
218
220
  def print_data(records)
219
221
  print_message 'Puppet run triggered'
220
222
  end
223
+
224
+ apipie_options
221
225
  end
222
226
 
223
227
 
@@ -284,7 +288,6 @@ module HammerCLIForeman
284
288
  def search
285
289
  'host.id = %s' % get_identifier[0].to_s
286
290
  end
287
-
288
291
  end
289
292
 
290
293
  class CreateCommand < HammerCLIForeman::CreateCommand
@@ -296,10 +299,10 @@ module HammerCLIForeman
296
299
  include HammerCLIForeman::CommonHostUpdateOptions
297
300
 
298
301
  validate_options do
299
- unless option(:hostgroup_id).exist?
300
- all(:environment_id, :architecture_id, :domain_id,
301
- :puppet_proxy_id, :operatingsystem_id,
302
- :partition_table_id).required
302
+ unless option(:option_hostgroup_id).exist?
303
+ all(:option_environment_id, :option_architecture_id, :option_domain_id,
304
+ :option_puppet_proxy_id, :option_operatingsystem_id,
305
+ :option_partition_table_id).required
303
306
  end
304
307
  end
305
308
  end
@@ -338,12 +341,12 @@ module HammerCLIForeman
338
341
 
339
342
  def validate_options
340
343
  super
341
- validator.any(:host_name, :host_id).required
344
+ validator.any(:option_host_name, :option_host_id).required
342
345
  end
343
346
 
344
347
  def base_action_params
345
348
  {
346
- "host_id" => host_id || host_name
349
+ "host_id" => option_host_id || option_host_name
347
350
  }
348
351
  end
349
352
  end
@@ -362,12 +365,12 @@ module HammerCLIForeman
362
365
 
363
366
  def validate_options
364
367
  super
365
- validator.any(:host_name, :host_id).required
368
+ validator.any(:option_host_name, :option_host_id).required
366
369
  end
367
370
 
368
371
  def base_action_params
369
372
  {
370
- "host_id" => host_id || host_name
373
+ "host_id" => option_host_id || option_host_name
371
374
  }
372
375
  end
373
376
  end
@@ -385,6 +388,8 @@ module HammerCLIForeman
385
388
  def power_action
386
389
  :start
387
390
  end
391
+
392
+ apipie_options :without => :power_action
388
393
  end
389
394
 
390
395
 
@@ -399,7 +404,7 @@ module HammerCLIForeman
399
404
  desc "Power a host off"
400
405
 
401
406
  def power_action
402
- if force?
407
+ if option_force?
403
408
  :cycle
404
409
  else
405
410
  :stop
@@ -407,12 +412,14 @@ module HammerCLIForeman
407
412
  end
408
413
 
409
414
  def success_message
410
- if force?
415
+ if option_force?
411
416
  "Power off forced."
412
417
  else
413
418
  "Powering the host off."
414
419
  end
415
420
  end
421
+
422
+ apipie_options :without => :power_action
416
423
  end
417
424
 
418
425
  class RebootCommand < HammerCLI::Apipie::WriteCommand
@@ -427,13 +434,15 @@ module HammerCLIForeman
427
434
  def power_action
428
435
  :soft
429
436
  end
437
+
438
+ apipie_options :without => :power_action
430
439
  end
431
440
 
432
441
  class SCParamsCommand < HammerCLIForeman::SmartClassParametersList
433
442
 
434
443
  apipie_options :without => [:host_id, :hostgroup_id, :puppetclass_id, :environment_id]
435
444
  option ['--id', '--name'], 'HOST_ID', 'host id/name',
436
- :attribute_name => :host_id, :required => true
445
+ :attribute_name => :option_host_id, :required => true
437
446
  end
438
447
 
439
448
  autoload_subcommands
@@ -441,4 +450,4 @@ module HammerCLIForeman
441
450
 
442
451
  end
443
452
 
444
- HammerCLI::MainCommand.subcommand 'host', "Manipulate Foreman's hosts.", HammerCLIForeman::Host
453
+ HammerCLI::MainCommand.subcommand 'host', "Manipulate hosts.", HammerCLIForeman::Host
@@ -1,7 +1,3 @@
1
- require 'hammer_cli'
2
- require 'foreman_api'
3
- require 'hammer_cli_foreman/commands'
4
- require 'hammer_cli_foreman/parameter'
5
1
  require 'hammer_cli_foreman/smart_class_parameter'
6
2
 
7
3
  module HammerCLIForeman
@@ -42,6 +38,7 @@ module HammerCLIForeman
42
38
  hostgroup
43
39
  end
44
40
 
41
+ apipie_options
45
42
  end
46
43
 
47
44
 
@@ -116,7 +113,7 @@ module HammerCLIForeman
116
113
 
117
114
  def base_action_params
118
115
  {
119
- "hostgroup_id" => hostgroup_id
116
+ "hostgroup_id" => option_hostgroup_id
120
117
  }
121
118
  end
122
119
  end
@@ -134,7 +131,7 @@ module HammerCLIForeman
134
131
 
135
132
  def base_action_params
136
133
  {
137
- "hostgroup_id" => hostgroup_id
134
+ "hostgroup_id" => option_hostgroup_id
138
135
  }
139
136
  end
140
137
  end
@@ -144,7 +141,7 @@ module HammerCLIForeman
144
141
 
145
142
  apipie_options :without => [:host_id, :hostgroup_id, :puppetclass_id, :environment_id]
146
143
  option ['--id', '--name'], 'HOSTGROUP_ID', 'hostgroup id/name',
147
- :attribute_name => :hostgroup_id, :required => true
144
+ :attribute_name => :option_hostgroup_id, :required => true
148
145
  end
149
146
 
150
147
 
@@ -153,5 +150,5 @@ module HammerCLIForeman
153
150
 
154
151
  end
155
152
 
156
- HammerCLI::MainCommand.subcommand 'hostgroup', "Manipulate Foreman's hostgroups.", HammerCLIForeman::Hostgroup
153
+ HammerCLI::MainCommand.subcommand 'hostgroup', "Manipulate hostgroups.", HammerCLIForeman::Hostgroup
157
154
 
@@ -1,6 +1,3 @@
1
- require 'hammer_cli'
2
- require 'foreman_api'
3
- require 'hammer_cli_foreman/commands'
4
1
  require 'hammer_cli_foreman/compute_resource'
5
2
 
6
3
  module HammerCLIForeman
@@ -20,7 +17,7 @@ module HammerCLIForeman
20
17
  base.apipie_options :without => [:compute_resource_id, :id]
21
18
 
22
19
  base.validate_options do
23
- any(:compute_resource_id, :compute_resource).required
20
+ any(:option_compute_resource_id, :option_compute_resource).required
24
21
  end
25
22
  end
26
23
 
@@ -41,7 +38,7 @@ module HammerCLIForeman
41
38
 
42
39
  def request_params
43
40
  params = super
44
- params['compute_resource_id'] = compute_resource_id || compute_resource
41
+ params['compute_resource_id'] = option_compute_resource_id || option_compute_resource
45
42
  params
46
43
  end
47
44
 
@@ -50,9 +47,9 @@ module HammerCLIForeman
50
47
 
51
48
  class InfoCommand < HammerCLIForeman::InfoCommand
52
49
 
50
+ identifiers :id
53
51
  include HammerCLIForeman::Image::ComputeResourceOptions
54
52
 
55
- identifiers :id
56
53
 
57
54
  output ListCommand.output_definition do
58
55
  field :architecture_id, "Architecture Id", Fields::Id
@@ -63,7 +60,7 @@ module HammerCLIForeman
63
60
 
64
61
  def request_params
65
62
  params = super
66
- params['compute_resource_id'] = compute_resource_id || compute_resource
63
+ params['compute_resource_id'] = option_compute_resource_id || option_compute_resource
67
64
  params
68
65
  end
69
66
 
@@ -85,7 +82,7 @@ module HammerCLIForeman
85
82
 
86
83
  def request_params
87
84
  params = super
88
- params['id'] = compute_resource_id || compute_resource
85
+ params['id'] = option_compute_resource_id || option_compute_resource
89
86
  params
90
87
  end
91
88
 
@@ -101,7 +98,7 @@ module HammerCLIForeman
101
98
 
102
99
  def request_params
103
100
  params = super
104
- params['compute_resource_id'] = compute_resource_id || compute_resource
101
+ params['compute_resource_id'] = option_compute_resource_id || option_compute_resource
105
102
  params
106
103
  end
107
104
  end
@@ -109,31 +106,32 @@ module HammerCLIForeman
109
106
 
110
107
  class UpdateCommand < HammerCLIForeman::UpdateCommand
111
108
 
109
+ identifiers :id
112
110
  include HammerCLIForeman::Image::ComputeResourceOptions
113
111
 
114
112
  success_message "Image updated"
115
113
  failure_message "Could not update the image"
116
- identifiers :id
117
114
 
118
115
  def request_params
119
116
  params = super
120
- params['compute_resource_id'] = compute_resource_id || compute_resource
117
+ params['compute_resource_id'] = option_compute_resource_id || option_compute_resource
121
118
  params
122
119
  end
120
+
123
121
  end
124
122
 
125
123
 
126
124
  class DeleteCommand < HammerCLIForeman::DeleteCommand
127
125
 
126
+ identifiers :id
128
127
  include HammerCLIForeman::Image::ComputeResourceOptions
129
128
 
130
129
  success_message "Image deleted"
131
130
  failure_message "Could not delete the image"
132
- identifiers :id
133
131
 
134
132
  def request_params
135
133
  params = super
136
- params['compute_resource_id'] = compute_resource_id || compute_resource
134
+ params['compute_resource_id'] = option_compute_resource_id || option_compute_resource
137
135
  params
138
136
  end
139
137
 
@@ -1,7 +1,3 @@
1
- require 'hammer_cli'
2
- require 'foreman_api'
3
- require 'hammer_cli_foreman/commands'
4
- require 'hammer_cli_foreman/associating_commands'
5
1
  require 'hammer_cli_foreman/resource_supported_test'
6
2
 
7
3
  module HammerCLIForeman
@@ -30,6 +26,7 @@ module HammerCLIForeman
30
26
  field :updated_at, "Updated at", Fields::Date
31
27
  end
32
28
 
29
+ apipie_options
33
30
  end
34
31
 
35
32
 
@@ -78,5 +75,5 @@ module HammerCLIForeman
78
75
 
79
76
  end
80
77
 
81
- HammerCLI::MainCommand.subcommand 'location', "Manipulate Foreman's locations.", HammerCLIForeman::Location
78
+ HammerCLI::MainCommand.subcommand 'location', "Manipulate locations.", HammerCLIForeman::Location
82
79
 
@@ -1,8 +1,3 @@
1
- require 'hammer_cli'
2
- require 'foreman_api'
3
- require 'hammer_cli_foreman/commands'
4
- require 'hammer_cli_foreman/associating_commands'
5
-
6
1
  module HammerCLIForeman
7
2
 
8
3
  class Medium < HammerCLI::Apipie::Command
@@ -28,6 +23,7 @@ module HammerCLIForeman
28
23
  field :updated_at, "Updated at", Fields::Date
29
24
  end
30
25
 
26
+ apipie_options
31
27
  end
32
28
 
33
29
 
@@ -67,5 +63,5 @@ module HammerCLIForeman
67
63
 
68
64
  end
69
65
 
70
- HammerCLI::MainCommand.subcommand 'medium', "Manipulate Foreman's installation media.", HammerCLIForeman::Medium
66
+ HammerCLI::MainCommand.subcommand 'medium', "Manipulate installation media.", HammerCLIForeman::Medium
71
67
 
@@ -1,7 +1,3 @@
1
- require 'hammer_cli'
2
- require 'foreman_api'
3
- require 'hammer_cli_foreman/commands'
4
-
5
1
  module HammerCLIForeman
6
2
 
7
3
  class Model < HammerCLI::Apipie::Command
@@ -29,6 +25,7 @@ module HammerCLIForeman
29
25
  field :updated_at, "Updated at", Fields::Date
30
26
  end
31
27
 
28
+ apipie_options
32
29
  end
33
30
 
34
31
 
@@ -42,6 +39,8 @@ module HammerCLIForeman
42
39
  class DeleteCommand < HammerCLIForeman::DeleteCommand
43
40
  success_message "Hardware model deleted"
44
41
  failure_message "Could not delete the hardware model"
42
+
43
+ apipie_options
45
44
  end
46
45
 
47
46
 
@@ -58,5 +57,5 @@ module HammerCLIForeman
58
57
 
59
58
  end
60
59
 
61
- HammerCLI::MainCommand.subcommand 'model', "Manipulate Foreman's hardware models.", HammerCLIForeman::Model
60
+ HammerCLI::MainCommand.subcommand 'model', "Manipulate hardware models.", HammerCLIForeman::Model
62
61
 
@@ -1,8 +1,3 @@
1
- require 'hammer_cli'
2
- require 'foreman_api'
3
- require 'hammer_cli_foreman/commands'
4
- require 'hammer_cli_foreman/associating_commands'
5
-
6
1
  module HammerCLIForeman
7
2
 
8
3
  class OperatingSystem < HammerCLI::Apipie::Command
@@ -52,6 +47,7 @@ module HammerCLIForeman
52
47
  os
53
48
  end
54
49
 
50
+ apipie_options
55
51
  end
56
52
 
57
53
 
@@ -72,10 +68,10 @@ module HammerCLIForeman
72
68
 
73
69
  def request_params
74
70
  params = method_options
75
- params["operatingsystem"]["architecture_ids"] = architecture_ids if architecture_ids
76
- params["operatingsystem"]["config_template_ids"] = config_template_ids if config_template_ids
77
- params["operatingsystem"]["medium_ids"] = medium_ids if medium_ids
78
- params["operatingsystem"]["ptable_ids"] = ptable_ids if ptable_ids
71
+ params["operatingsystem"]["architecture_ids"] = option_architecture_ids if option_architecture_ids
72
+ params["operatingsystem"]["config_template_ids"] = option_config_template_ids if option_config_template_ids
73
+ params["operatingsystem"]["medium_ids"] = option_medium_ids if option_medium_ids
74
+ params["operatingsystem"]["ptable_ids"] = option_ptable_ids if option_ptable_ids
79
75
  params
80
76
  end
81
77
 
@@ -102,10 +98,10 @@ module HammerCLIForeman
102
98
 
103
99
  def request_params
104
100
  params = method_options
105
- params["operatingsystem"]["architecture_ids"] = architecture_ids if architecture_ids
106
- params["operatingsystem"]["config_template_ids"] = config_template_ids if config_template_ids
107
- params["operatingsystem"]["medium_ids"] = medium_ids if medium_ids
108
- params["operatingsystem"]["ptable_ids"] = ptable_ids if ptable_ids
101
+ params["operatingsystem"]["architecture_ids"] = option_architecture_ids if option_architecture_ids
102
+ params["operatingsystem"]["config_template_ids"] = option_config_template_ids if option_config_template_ids
103
+ params["operatingsystem"]["medium_ids"] = option_medium_ids if option_medium_ids
104
+ params["operatingsystem"]["ptable_ids"] = option_ptable_ids if option_ptable_ids
109
105
  params
110
106
  end
111
107
 
@@ -138,12 +134,12 @@ module HammerCLIForeman
138
134
 
139
135
  def validate_options
140
136
  super
141
- validator.any(:os_id).required
137
+ validator.any(:option_os_id).required
142
138
  end
143
139
 
144
140
  def base_action_params
145
141
  {
146
- "operatingsystem_id" => os_id
142
+ "operatingsystem_id" => option_os_id
147
143
  }
148
144
  end
149
145
  end
@@ -161,12 +157,12 @@ module HammerCLIForeman
161
157
 
162
158
  def validate_options
163
159
  super
164
- validator.any(:os_id).required
160
+ validator.any(:option_os_id).required
165
161
  end
166
162
 
167
163
  def base_action_params
168
164
  {
169
- "operatingsystem_id" => os_id
165
+ "operatingsystem_id" => option_os_id
170
166
  }
171
167
  end
172
168
  end
@@ -182,5 +178,5 @@ module HammerCLIForeman
182
178
 
183
179
  end
184
180
 
185
- HammerCLI::MainCommand.subcommand 'os', "Manipulate Foreman's operating system.", HammerCLIForeman::OperatingSystem
181
+ HammerCLI::MainCommand.subcommand 'os', "Manipulate operating system.", HammerCLIForeman::OperatingSystem
186
182
 
@@ -1,7 +1,3 @@
1
- require 'hammer_cli'
2
- require 'foreman_api'
3
- require 'hammer_cli_foreman/commands'
4
- require 'hammer_cli_foreman/associating_commands'
5
1
  require 'hammer_cli_foreman/resource_supported_test'
6
2
 
7
3
  module HammerCLIForeman
@@ -30,6 +26,7 @@ module HammerCLIForeman
30
26
  field :updated_at, "Updated at", Fields::Date
31
27
  end
32
28
 
29
+ apipie_options
33
30
  end
34
31
 
35
32
 
@@ -77,5 +74,5 @@ module HammerCLIForeman
77
74
 
78
75
  end
79
76
 
80
- HammerCLI::MainCommand.subcommand 'organization', "Manipulate Foreman's organizations.", HammerCLIForeman::Organization
77
+ HammerCLI::MainCommand.subcommand 'organization', "Manipulate organizations.", HammerCLIForeman::Organization
81
78
 
@@ -1,2 +1,2 @@
1
- require File.join(File.dirname(__FILE__), 'output/fields')
2
- require File.join(File.dirname(__FILE__), 'output/formatters')
1
+ require 'hammer_cli_foreman/output/fields'
2
+ require 'hammer_cli_foreman/output/formatters'
@@ -1,6 +1,4 @@
1
- require 'hammer_cli'
2
1
  require 'hammer_cli/messages'
3
- require 'foreman_api'
4
2
 
5
3
  module HammerCLIForeman
6
4
 
@@ -47,14 +45,14 @@ module HammerCLIForeman
47
45
 
48
46
  def parameter_exist?
49
47
  params = HammerCLIForeman.collection_to_common_format(resource.call(:index, base_action_params)[0])
50
- params.find { |p| p["name"] == name }
48
+ params.find { |p| p["name"] == option_name }
51
49
  end
52
50
 
53
51
  def update_parameter
54
52
  params = {
55
- "id" => name,
53
+ "id" => option_name,
56
54
  "parameter" => {
57
- "value" => value
55
+ "value" => option_value
58
56
  }
59
57
  }.merge base_action_params
60
58
 
@@ -64,8 +62,8 @@ module HammerCLIForeman
64
62
  def create_parameter
65
63
  params = {
66
64
  "parameter" => {
67
- "name" => name,
68
- "value" => value
65
+ "name" => option_name,
66
+ "value" => option_value
69
67
  }
70
68
  }.merge base_action_params
71
69
 
@@ -91,7 +89,7 @@ module HammerCLIForeman
91
89
 
92
90
  def execute
93
91
  params = {
94
- "id" => name
92
+ "id" => option_name
95
93
  }.merge base_action_params
96
94
 
97
95
  HammerCLIForeman.record_to_common_format(resource.call(:destroy, params))
@@ -1,8 +1,3 @@
1
- require 'hammer_cli'
2
- require 'foreman_api'
3
- require 'hammer_cli_foreman/commands'
4
- require 'hammer_cli_foreman/associating_commands'
5
-
6
1
  module HammerCLIForeman
7
2
 
8
3
  class PartitionTable < HammerCLI::Apipie::Command
@@ -28,6 +23,7 @@ module HammerCLIForeman
28
23
  field :updated_at, "Updated at", Fields::Date
29
24
  end
30
25
 
26
+ apipie_options
31
27
  end
32
28
 
33
29
 
@@ -36,18 +32,18 @@ module HammerCLIForeman
36
32
  command_name "dump"
37
33
  desc "View partition table content."
38
34
 
39
-
40
35
  def print_data(partition_table)
41
36
  puts partition_table["layout"]
42
37
  end
43
38
 
39
+ apipie_options
44
40
  end
45
41
 
46
42
 
47
43
  class CreateCommand < HammerCLIForeman::CreateCommand
48
44
 
49
- option "--file", "LAYOUT", "Path to a file that contains the partition layout", :attribute_name => :layout, :required => true,
50
- :format => HammerCLI::Options::Normalizers::File.new
45
+ option "--file", "LAYOUT", "Path to a file that contains the partition layout", :attribute_name => :option_layout,
46
+ :required => true, :format => HammerCLI::Options::Normalizers::File.new
51
47
 
52
48
  success_message "Partition table created"
53
49
  failure_message "Could not create the partition table"
@@ -58,7 +54,7 @@ module HammerCLIForeman
58
54
 
59
55
  class UpdateCommand < HammerCLIForeman::UpdateCommand
60
56
 
61
- option "--file", "LAYOUT", "Path to a file that contains the partition layout", :attribute_name => :layout,
57
+ option "--file", "LAYOUT", "Path to a file that contains the partition layout", :attribute_name => :option_layout,
62
58
  :format => HammerCLI::Options::Normalizers::File.new
63
59
 
64
60
  success_message "Partition table updated"
@@ -69,9 +65,10 @@ module HammerCLIForeman
69
65
 
70
66
 
71
67
  class DeleteCommand < HammerCLIForeman::DeleteCommand
72
-
73
68
  success_message "Partition table deleted"
74
69
  failure_message "Could not delete the partition table"
70
+
71
+ apipie_options
75
72
  end
76
73
 
77
74
 
@@ -83,5 +80,5 @@ module HammerCLIForeman
83
80
 
84
81
  end
85
82
 
86
- HammerCLI::MainCommand.subcommand 'partition_table', "Manipulate Foreman's partition tables.", HammerCLIForeman::PartitionTable
83
+ HammerCLI::MainCommand.subcommand 'partition_table', "Manipulate partition tables.", HammerCLIForeman::PartitionTable
87
84
 
@@ -1,6 +1,3 @@
1
- require 'hammer_cli'
2
- require 'foreman_api'
3
- require 'hammer_cli_foreman/commands'
4
1
  require 'hammer_cli_foreman/smart_class_parameter'
5
2
 
6
3
  module HammerCLIForeman
@@ -43,6 +40,7 @@ module HammerCLIForeman
43
40
  end
44
41
  end
45
42
 
43
+ apipie_options
46
44
  end
47
45
 
48
46
 
@@ -59,5 +57,5 @@ module HammerCLIForeman
59
57
 
60
58
  end
61
59
 
62
- HammerCLI::MainCommand.subcommand 'puppet_class', "Search Foreman's puppet modules.", HammerCLIForeman::PuppetClass
60
+ HammerCLI::MainCommand.subcommand 'puppet_class', "Search puppet modules.", HammerCLIForeman::PuppetClass
63
61