hammer_cli_foreman 0.0.18 → 0.1.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.
Potentially problematic release.
This version of hammer_cli_foreman might be problematic. Click here for more details.
- checksums.yaml +4 -4
 - data/lib/hammer_cli_foreman.rb +39 -27
 - data/lib/hammer_cli_foreman/architecture.rb +14 -14
 - data/lib/hammer_cli_foreman/associating_commands.rb +46 -40
 - data/lib/hammer_cli_foreman/auth.rb +49 -0
 - data/lib/hammer_cli_foreman/commands.rb +82 -29
 - data/lib/hammer_cli_foreman/common_parameter.rb +13 -17
 - data/lib/hammer_cli_foreman/compute_resource.rb +23 -23
 - data/lib/hammer_cli_foreman/credentials.rb +36 -0
 - data/lib/hammer_cli_foreman/domain.rb +32 -35
 - data/lib/hammer_cli_foreman/environment.rb +14 -19
 - data/lib/hammer_cli_foreman/exception_handler.rb +30 -8
 - data/lib/hammer_cli_foreman/fact.rb +5 -5
 - data/lib/hammer_cli_foreman/host.rb +178 -105
 - data/lib/hammer_cli_foreman/hostgroup.rb +59 -37
 - data/lib/hammer_cli_foreman/i18n.rb +24 -0
 - data/lib/hammer_cli_foreman/image.rb +24 -24
 - data/lib/hammer_cli_foreman/location.rb +13 -13
 - data/lib/hammer_cli_foreman/media.rb +21 -16
 - data/lib/hammer_cli_foreman/model.rb +16 -16
 - data/lib/hammer_cli_foreman/operating_system.rb +39 -39
 - data/lib/hammer_cli_foreman/organization.rb +13 -13
 - data/lib/hammer_cli_foreman/output/fields.rb +2 -2
 - data/lib/hammer_cli_foreman/output/formatters.rb +15 -4
 - data/lib/hammer_cli_foreman/parameter.rb +13 -11
 - data/lib/hammer_cli_foreman/partition_table.rb +17 -18
 - data/lib/hammer_cli_foreman/puppet_class.rb +9 -9
 - data/lib/hammer_cli_foreman/report.rb +38 -38
 - data/lib/hammer_cli_foreman/resource_supported_test.rb +1 -1
 - data/lib/hammer_cli_foreman/smart_class_parameter.rb +36 -36
 - data/lib/hammer_cli_foreman/smart_proxy.rb +22 -21
 - data/lib/hammer_cli_foreman/subnet.rb +29 -31
 - data/lib/hammer_cli_foreman/template.rb +45 -43
 - data/lib/hammer_cli_foreman/user.rb +20 -23
 - data/lib/hammer_cli_foreman/version.rb +1 -1
 - data/locale/Makefile +64 -0
 - data/locale/hammer-cli-foreman.pot +1573 -0
 - data/locale/zanata.xml +29 -0
 - data/test/unit/apipie_resource_mock.rb +44 -72
 - data/test/unit/architecture_test.rb +1 -2
 - data/test/unit/commands_test.rb +23 -21
 - data/test/unit/common_parameter_test.rb +15 -10
 - data/test/unit/compute_resource_test.rb +1 -2
 - data/test/unit/credentials_test.rb +46 -0
 - data/test/unit/data/1.4/foreman_api.json +10387 -0
 - data/test/unit/domain_test.rb +2 -5
 - data/test/unit/environment_test.rb +2 -3
 - data/test/unit/exception_handler_test.rb +29 -4
 - data/test/unit/fact_test.rb +0 -1
 - data/test/unit/helpers/command.rb +20 -4
 - data/test/unit/helpers/resource_disabled.rb +2 -2
 - data/test/unit/host_test.rb +24 -12
 - data/test/unit/hostgroup_test.rb +7 -8
 - data/test/unit/image_test.rb +6 -7
 - data/test/unit/location_test.rb +9 -5
 - data/test/unit/media_test.rb +1 -9
 - data/test/unit/model_test.rb +1 -3
 - data/test/unit/operating_system_test.rb +7 -9
 - data/test/unit/organization_test.rb +12 -6
 - data/test/unit/output/formatters_test.rb +5 -0
 - data/test/unit/partition_table_test.rb +1 -2
 - data/test/unit/puppet_class_test.rb +2 -3
 - data/test/unit/report_test.rb +1 -2
 - data/test/unit/smart_class_parameter_test.rb +9 -4
 - data/test/unit/smart_proxy_test.rb +1 -2
 - data/test/unit/subnet_test.rb +2 -3
 - data/test/unit/template_test.rb +23 -8
 - data/test/unit/test_helper.rb +13 -0
 - data/test/unit/test_output_adapter.rb +1 -1
 - data/test/unit/user_test.rb +1 -2
 - metadata +17 -7
 
| 
         @@ -1,18 +1,18 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'hammer_cli'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'foreman_api'
         
     | 
| 
       3 
2 
     | 
    
         
             
            require 'hammer_cli_foreman/smart_class_parameter'
         
     | 
| 
       4 
3 
     | 
    
         | 
| 
       5 
4 
     | 
    
         | 
| 
       6 
5 
     | 
    
         
             
            module HammerCLIForeman
         
     | 
| 
       7 
6 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
              class Environment <  
     | 
| 
      
 7 
     | 
    
         
            +
              class Environment < HammerCLIForeman::Command
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                resource :environments
         
     | 
| 
       9 
10 
     | 
    
         | 
| 
       10 
11 
     | 
    
         
             
                class ListCommand < HammerCLIForeman::ListCommand
         
     | 
| 
       11 
     | 
    
         
            -
                  resource ForemanApi::Resources::Environment, "index"
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
                  output do
         
     | 
| 
       14 
     | 
    
         
            -
                    field :id, "Id"
         
     | 
| 
       15 
     | 
    
         
            -
                    field :name, "Name"
         
     | 
| 
      
 14 
     | 
    
         
            +
                    field :id, _("Id")
         
     | 
| 
      
 15 
     | 
    
         
            +
                    field :name, _("Name")
         
     | 
| 
       16 
16 
     | 
    
         
             
                  end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
                  apipie_options
         
     | 
| 
         @@ -20,11 +20,10 @@ module HammerCLIForeman 
     | 
|
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
                class InfoCommand < HammerCLIForeman::InfoCommand
         
     | 
| 
       23 
     | 
    
         
            -
                  resource ForemanApi::Resources::Environment, "show"
         
     | 
| 
       24 
23 
     | 
    
         | 
| 
       25 
24 
     | 
    
         
             
                  output ListCommand.output_definition do
         
     | 
| 
       26 
     | 
    
         
            -
                    field :created_at, "Created at", Fields::Date
         
     | 
| 
       27 
     | 
    
         
            -
                    field :updated_at, "Updated at", Fields::Date
         
     | 
| 
      
 25 
     | 
    
         
            +
                    field :created_at, _("Created at"), Fields::Date
         
     | 
| 
      
 26 
     | 
    
         
            +
                    field :updated_at, _("Updated at"), Fields::Date
         
     | 
| 
       28 
27 
     | 
    
         
             
                  end
         
     | 
| 
       29 
28 
     | 
    
         | 
| 
       30 
29 
     | 
    
         
             
                  apipie_options
         
     | 
| 
         @@ -33,9 +32,8 @@ module HammerCLIForeman 
     | 
|
| 
       33 
32 
     | 
    
         | 
| 
       34 
33 
     | 
    
         
             
                class CreateCommand < HammerCLIForeman::CreateCommand
         
     | 
| 
       35 
34 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
                  success_message "Environment created"
         
     | 
| 
       37 
     | 
    
         
            -
                  failure_message "Could not create the environment"
         
     | 
| 
       38 
     | 
    
         
            -
                  resource ForemanApi::Resources::Environment, "create"
         
     | 
| 
      
 35 
     | 
    
         
            +
                  success_message _("Environment created")
         
     | 
| 
      
 36 
     | 
    
         
            +
                  failure_message _("Could not create the environment")
         
     | 
| 
       39 
37 
     | 
    
         | 
| 
       40 
38 
     | 
    
         
             
                  apipie_options
         
     | 
| 
       41 
39 
     | 
    
         
             
                end
         
     | 
| 
         @@ -43,9 +41,8 @@ module HammerCLIForeman 
     | 
|
| 
       43 
41 
     | 
    
         | 
| 
       44 
42 
     | 
    
         
             
                class UpdateCommand < HammerCLIForeman::UpdateCommand
         
     | 
| 
       45 
43 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
                  success_message "Environment updated"
         
     | 
| 
       47 
     | 
    
         
            -
                  failure_message "Could not update the environment"
         
     | 
| 
       48 
     | 
    
         
            -
                  resource ForemanApi::Resources::Environment, "update"
         
     | 
| 
      
 44 
     | 
    
         
            +
                  success_message _("Environment updated")
         
     | 
| 
      
 45 
     | 
    
         
            +
                  failure_message _("Could not update the environment")
         
     | 
| 
       49 
46 
     | 
    
         | 
| 
       50 
47 
     | 
    
         
             
                  apipie_options
         
     | 
| 
       51 
48 
     | 
    
         
             
                end
         
     | 
| 
         @@ -53,9 +50,8 @@ module HammerCLIForeman 
     | 
|
| 
       53 
50 
     | 
    
         | 
| 
       54 
51 
     | 
    
         
             
                class DeleteCommand < HammerCLIForeman::DeleteCommand
         
     | 
| 
       55 
52 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
                  success_message "Environment deleted"
         
     | 
| 
       57 
     | 
    
         
            -
                  failure_message "Could not delete the environment"
         
     | 
| 
       58 
     | 
    
         
            -
                  resource ForemanApi::Resources::Environment, "destroy"
         
     | 
| 
      
 53 
     | 
    
         
            +
                  success_message _("Environment deleted")
         
     | 
| 
      
 54 
     | 
    
         
            +
                  failure_message _("Could not delete the environment")
         
     | 
| 
       59 
55 
     | 
    
         | 
| 
       60 
56 
     | 
    
         
             
                  apipie_options
         
     | 
| 
       61 
57 
     | 
    
         
             
                end
         
     | 
| 
         @@ -63,7 +59,7 @@ module HammerCLIForeman 
     | 
|
| 
       63 
59 
     | 
    
         
             
                class SCParamsCommand < HammerCLIForeman::SmartClassParametersList
         
     | 
| 
       64 
60 
     | 
    
         | 
| 
       65 
61 
     | 
    
         
             
                  apipie_options :without => [:host_id, :hostgroup_id, :puppetclass_id, :environment_id]
         
     | 
| 
       66 
     | 
    
         
            -
                  option ['--id', '--name'], 'ENVIRONMENT_ID', 'environment id/name',
         
     | 
| 
      
 62 
     | 
    
         
            +
                  option ['--id', '--name'], 'ENVIRONMENT_ID', _('environment id/name'),
         
     | 
| 
       67 
63 
     | 
    
         
             
                        :required => true, :attribute_name => :environment_id
         
     | 
| 
       68 
64 
     | 
    
         
             
                end
         
     | 
| 
       69 
65 
     | 
    
         | 
| 
         @@ -74,4 +70,3 @@ module HammerCLIForeman 
     | 
|
| 
       74 
70 
     | 
    
         
             
            end
         
     | 
| 
       75 
71 
     | 
    
         | 
| 
       76 
72 
     | 
    
         
             
            HammerCLI::MainCommand.subcommand 'environment', "Manipulate environments.", HammerCLIForeman::Environment
         
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
         @@ -7,6 +7,7 @@ module HammerCLIForeman 
     | 
|
| 
       7 
7 
     | 
    
         
             
                def mappings
         
     | 
| 
       8 
8 
     | 
    
         
             
                  super + [
         
     | 
| 
       9 
9 
     | 
    
         
             
                    [HammerCLIForeman::OperationNotSupportedError, :handle_unsupported_operation],
         
     | 
| 
      
 10 
     | 
    
         
            +
                    [RestClient::InternalServerError, :handle_internal_error],
         
     | 
| 
       10 
11 
     | 
    
         
             
                    [RestClient::Forbidden, :handle_forbidden],
         
     | 
| 
       11 
12 
     | 
    
         
             
                    [RestClient::UnprocessableEntity, :handle_unprocessable_entity],
         
     | 
| 
       12 
13 
     | 
    
         
             
                    [ArgumentError, :handle_argument_error],
         
     | 
| 
         @@ -23,6 +24,12 @@ module HammerCLIForeman 
     | 
|
| 
       23 
24 
     | 
    
         
             
                end
         
     | 
| 
       24 
25 
     | 
    
         | 
| 
       25 
26 
     | 
    
         | 
| 
      
 27 
     | 
    
         
            +
                def handle_internal_error(e)
         
     | 
| 
      
 28 
     | 
    
         
            +
                  handle_foreman_error(e)
         
     | 
| 
      
 29 
     | 
    
         
            +
                  HammerCLI::EX_SOFTWARE
         
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
       26 
33 
     | 
    
         
             
                def handle_argument_error(e)
         
     | 
| 
       27 
34 
     | 
    
         
             
                  print_error e.message
         
     | 
| 
       28 
35 
     | 
    
         
             
                  log_full_error e
         
     | 
| 
         @@ -31,7 +38,7 @@ module HammerCLIForeman 
     | 
|
| 
       31 
38 
     | 
    
         | 
| 
       32 
39 
     | 
    
         | 
| 
       33 
40 
     | 
    
         
             
                def handle_forbidden(e)
         
     | 
| 
       34 
     | 
    
         
            -
                  print_error "Forbidden - server refused to process the request"
         
     | 
| 
      
 41 
     | 
    
         
            +
                  print_error _("Forbidden - server refused to process the request")
         
     | 
| 
       35 
42 
     | 
    
         
             
                  log_full_error e
         
     | 
| 
       36 
43 
     | 
    
         
             
                  HammerCLI::EX_NOPERM
         
     | 
| 
       37 
44 
     | 
    
         
             
                end
         
     | 
| 
         @@ -45,17 +52,32 @@ module HammerCLIForeman 
     | 
|
| 
       45 
52 
     | 
    
         | 
| 
       46 
53 
     | 
    
         | 
| 
       47 
54 
     | 
    
         
             
                def handle_not_found(e)
         
     | 
| 
       48 
     | 
    
         
            -
                   
     | 
| 
       49 
     | 
    
         
            -
                   
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
      
 55 
     | 
    
         
            +
                  handle_foreman_error(e)
         
     | 
| 
      
 56 
     | 
    
         
            +
                  HammerCLI::EX_NOT_FOUND
         
     | 
| 
      
 57 
     | 
    
         
            +
                end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                def handle_foreman_error(e)
         
     | 
| 
      
 61 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 62 
     | 
    
         
            +
                    response = JSON.parse(e.response)
         
     | 
| 
      
 63 
     | 
    
         
            +
                    response = HammerCLIForeman.record_to_common_format(response)
         
     | 
| 
      
 64 
     | 
    
         
            +
                    message = response['message'] || e.message
         
     | 
| 
      
 65 
     | 
    
         
            +
                  rescue JSON::ParserError => parse_e
         
     | 
| 
      
 66 
     | 
    
         
            +
                    message = e.message
         
     | 
| 
      
 67 
     | 
    
         
            +
                  end
         
     | 
| 
       51 
68 
     | 
    
         | 
| 
       52 
69 
     | 
    
         
             
                  print_error message
         
     | 
| 
       53 
70 
     | 
    
         
             
                  log_full_error e
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
      
 71 
     | 
    
         
            +
                end
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
                def handle_apipie_docloading_error(e)
         
     | 
| 
      
 74 
     | 
    
         
            +
                  rake_command = 'foreman-rake apipie:cache'
         
     | 
| 
      
 75 
     | 
    
         
            +
                  print_error _("Could not load API description from the server\n"\
         
     | 
| 
      
 76 
     | 
    
         
            +
                      "  - is your server down?\n"\
         
     | 
| 
      
 77 
     | 
    
         
            +
                      "  - was \"#{rake_command}\" run on the server when using apipie cache? (typical production settings))\n")
         
     | 
| 
      
 78 
     | 
    
         
            +
                  log_full_error e
         
     | 
| 
      
 79 
     | 
    
         
            +
                  HammerCLI::EX_CONFIG
         
     | 
| 
       55 
80 
     | 
    
         
             
                end
         
     | 
| 
       56 
81 
     | 
    
         | 
| 
       57 
82 
     | 
    
         
             
              end
         
     | 
| 
       58 
83 
     | 
    
         
             
            end
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
         @@ -4,14 +4,14 @@ module HammerCLIForeman 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
                class ListCommand < HammerCLIForeman::ListCommand
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                  resource  
     | 
| 
      
 7 
     | 
    
         
            +
                  resource :fact_values, :index
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                  apipie_options
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
                  output do
         
     | 
| 
       12 
     | 
    
         
            -
                    field :host, "Host"
         
     | 
| 
       13 
     | 
    
         
            -
                    field :fact, "Fact"
         
     | 
| 
       14 
     | 
    
         
            -
                    field :value, "Value"
         
     | 
| 
      
 12 
     | 
    
         
            +
                    field :host, _("Host")
         
     | 
| 
      
 13 
     | 
    
         
            +
                    field :fact, _("Fact")
         
     | 
| 
      
 14 
     | 
    
         
            +
                    field :value, _("Value")
         
     | 
| 
       15 
15 
     | 
    
         
             
                  end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                  def retrieve_data
         
     | 
| 
         @@ -33,4 +33,4 @@ module HammerCLIForeman 
     | 
|
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
            end
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
            HammerCLI::MainCommand.subcommand 'fact', "Search facts.", HammerCLIForeman::Fact
         
     | 
| 
      
 36 
     | 
    
         
            +
            HammerCLI::MainCommand.subcommand 'fact', _("Search facts."), HammerCLIForeman::Fact
         
     | 
| 
         @@ -2,6 +2,8 @@ require 'hammer_cli_foreman/report' 
     | 
|
| 
       2 
2 
     | 
    
         
             
            require 'hammer_cli_foreman/puppet_class'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'hammer_cli_foreman/smart_class_parameter'
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
      
 5 
     | 
    
         
            +
            require 'highline/import'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
       5 
7 
     | 
    
         
             
            module HammerCLIForeman
         
     | 
| 
       6 
8 
     | 
    
         | 
| 
       7 
9 
     | 
    
         
             
              module CommonHostUpdateOptions
         
     | 
| 
         @@ -16,6 +18,8 @@ module HammerCLIForeman 
     | 
|
| 
       16 
18 
     | 
    
         
             
                        # - temporarily disabled params that will be removed from the api ------------------
         
     | 
| 
       17 
19 
     | 
    
         
             
                        :provision_method, :capabilities, :flavour_ref, :image_ref, :start,
         
     | 
| 
       18 
20 
     | 
    
         
             
                        :network, :cpus, :memory, :provider, :type, :tenant_id, :image_id,
         
     | 
| 
      
 21 
     | 
    
         
            +
                        # - avoids future conflicts as :root_pass is currently missing in the api docs
         
     | 
| 
      
 22 
     | 
    
         
            +
                        :root_pass,
         
     | 
| 
       19 
23 
     | 
    
         
             
                        # ----------------------------------------------------------------------------------
         
     | 
| 
       20 
24 
     | 
    
         
             
                        :compute_resource_id, :ptable_id] + base.declared_identifiers.keys
         
     | 
| 
       21 
25 
     | 
    
         | 
| 
         @@ -29,6 +33,10 @@ module HammerCLIForeman 
     | 
|
| 
       29 
33 
     | 
    
         
             
                  base.option "--partition-table-id", "PARTITION_TABLE", " "
         
     | 
| 
       30 
34 
     | 
    
         
             
                  base.option "--puppetclass-ids", "PUPPETCLASS_IDS", " ",
         
     | 
| 
       31 
35 
     | 
    
         
             
                    :format => HammerCLI::Options::Normalizers::List.new
         
     | 
| 
      
 36 
     | 
    
         
            +
                  base.option "--root-password", "ROOT_PW", " "
         
     | 
| 
      
 37 
     | 
    
         
            +
                  base.option "--ask-root-password", "ASK_ROOT_PW", " ",
         
     | 
| 
      
 38 
     | 
    
         
            +
                    :format => HammerCLI::Options::Normalizers::Bool.new
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
       32 
40 
     | 
    
         | 
| 
       33 
41 
     | 
    
         
             
                  bme_options = {}
         
     | 
| 
       34 
42 
     | 
    
         
             
                  bme_options[:default] = 'true' if base.action.to_sym == :create
         
     | 
| 
         @@ -40,14 +48,21 @@ module HammerCLIForeman 
     | 
|
| 
       40 
48 
     | 
    
         
             
                  bme_options[:format] = HammerCLI::Options::Normalizers::Bool.new
         
     | 
| 
       41 
49 
     | 
    
         
             
                  base.option "--enabled", "ENABLED", " ",  bme_options
         
     | 
| 
       42 
50 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
                  base.option "--parameters", "PARAMS", "Host parameters.",
         
     | 
| 
      
 51 
     | 
    
         
            +
                  base.option "--parameters", "PARAMS", _("Host parameters."),
         
     | 
| 
       44 
52 
     | 
    
         
             
                    :format => HammerCLI::Options::Normalizers::KeyValueList.new
         
     | 
| 
       45 
     | 
    
         
            -
                  base.option "--compute-attributes", "COMPUTE_ATTRS", "Compute resource attributes.",
         
     | 
| 
      
 53 
     | 
    
         
            +
                  base.option "--compute-attributes", "COMPUTE_ATTRS", _("Compute resource attributes."),
         
     | 
| 
       46 
54 
     | 
    
         
             
                    :format => HammerCLI::Options::Normalizers::KeyValueList.new
         
     | 
| 
       47 
     | 
    
         
            -
                  base.option "--volume", "VOLUME", "Volume parameters", :multivalued => true,
         
     | 
| 
      
 55 
     | 
    
         
            +
                  base.option "--volume", "VOLUME", _("Volume parameters"), :multivalued => true,
         
     | 
| 
       48 
56 
     | 
    
         
             
                    :format => HammerCLI::Options::Normalizers::KeyValueList.new
         
     | 
| 
       49 
     | 
    
         
            -
                  base.option "--interface", "INTERFACE", "Interface parameters.", :multivalued => true,
         
     | 
| 
      
 57 
     | 
    
         
            +
                  base.option "--interface", "INTERFACE", _("Interface parameters."), :multivalued => true,
         
     | 
| 
       50 
58 
     | 
    
         
             
                    :format => HammerCLI::Options::Normalizers::KeyValueList.new
         
     | 
| 
      
 59 
     | 
    
         
            +
                  base.option "--provision-method", "METHOD", " ",
         
     | 
| 
      
 60 
     | 
    
         
            +
                    :format => HammerCLI::Options::Normalizers::Enum.new(['build', 'image'])
         
     | 
| 
      
 61 
     | 
    
         
            +
                end
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
                def self.ask_password
         
     | 
| 
      
 64 
     | 
    
         
            +
                  prompt = "Enter the root password for the host: "
         
     | 
| 
      
 65 
     | 
    
         
            +
                  ask(prompt) {|q| q.echo = false}
         
     | 
| 
       51 
66 
     | 
    
         
             
                end
         
     | 
| 
       52 
67 
     | 
    
         | 
| 
       53 
68 
     | 
    
         
             
                def request_params
         
     | 
| 
         @@ -71,6 +86,12 @@ module HammerCLIForeman 
     | 
|
| 
       71 
86 
     | 
    
         
             
                    params['host']['interfaces_attributes'] = nested_attributes(option_interface_list)
         
     | 
| 
       72 
87 
     | 
    
         
             
                  end
         
     | 
| 
       73 
88 
     | 
    
         | 
| 
      
 89 
     | 
    
         
            +
                  params['host']['root_pass'] = option_root_password unless option_root_password.nil?
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
                  if option_ask_root_password
         
     | 
| 
      
 92 
     | 
    
         
            +
                    params['host']['root_pass'] = HammerCLIForeman::CommonHostUpdateOptions::ask_password
         
     | 
| 
      
 93 
     | 
    
         
            +
                  end
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
       74 
95 
     | 
    
         
             
                  params
         
     | 
| 
       75 
96 
     | 
    
         
             
                end
         
     | 
| 
       76 
97 
     | 
    
         | 
| 
         @@ -96,19 +117,19 @@ module HammerCLIForeman 
     | 
|
| 
       96 
117 
     | 
    
         
             
              end
         
     | 
| 
       97 
118 
     | 
    
         | 
| 
       98 
119 
     | 
    
         | 
| 
       99 
     | 
    
         
            -
              class Host <  
     | 
| 
      
 120 
     | 
    
         
            +
              class Host < HammerCLIForeman::Command
         
     | 
| 
       100 
121 
     | 
    
         | 
| 
       101 
     | 
    
         
            -
                resource  
     | 
| 
      
 122 
     | 
    
         
            +
                resource :hosts
         
     | 
| 
       102 
123 
     | 
    
         | 
| 
       103 
124 
     | 
    
         
             
                class ListCommand < HammerCLIForeman::ListCommand
         
     | 
| 
       104 
125 
     | 
    
         
             
                  # FIXME: list compute resource (model)
         
     | 
| 
       105 
126 
     | 
    
         
             
                  output do
         
     | 
| 
       106 
     | 
    
         
            -
                    field :id, "Id"
         
     | 
| 
       107 
     | 
    
         
            -
                    field :name, "Name"
         
     | 
| 
       108 
     | 
    
         
            -
                    field :operatingsystem_id, "Operating System Id"
         
     | 
| 
       109 
     | 
    
         
            -
                    field :hostgroup_id, "Host Group Id"
         
     | 
| 
       110 
     | 
    
         
            -
                    field :ip, "IP"
         
     | 
| 
       111 
     | 
    
         
            -
                    field :mac, "MAC"
         
     | 
| 
      
 127 
     | 
    
         
            +
                    field :id, _("Id")
         
     | 
| 
      
 128 
     | 
    
         
            +
                    field :name, _("Name")
         
     | 
| 
      
 129 
     | 
    
         
            +
                    field :operatingsystem_id, _("Operating System Id")
         
     | 
| 
      
 130 
     | 
    
         
            +
                    field :hostgroup_id, _("Host Group Id")
         
     | 
| 
      
 131 
     | 
    
         
            +
                    field :ip, _("IP")
         
     | 
| 
      
 132 
     | 
    
         
            +
                    field :mac, _("MAC")
         
     | 
| 
       112 
133 
     | 
    
         
             
                  end
         
     | 
| 
       113 
134 
     | 
    
         | 
| 
       114 
135 
     | 
    
         
             
                  apipie_options
         
     | 
| 
         @@ -120,53 +141,82 @@ module HammerCLIForeman 
     | 
|
| 
       120 
141 
     | 
    
         
             
                  def extend_data(host)
         
     | 
| 
       121 
142 
     | 
    
         
             
                    host["environment_name"] = host["environment"]["environment"]["name"] rescue nil
         
     | 
| 
       122 
143 
     | 
    
         
             
                    host["parameters"] = HammerCLIForeman::Parameter.get_parameters(resource_config, :host, host)
         
     | 
| 
      
 144 
     | 
    
         
            +
                    host["_bmc_interfaces"] =
         
     | 
| 
      
 145 
     | 
    
         
            +
                      host["interfaces"].select{|intfs| intfs["type"] == "Nic::BMC" } rescue []
         
     | 
| 
      
 146 
     | 
    
         
            +
                    host["_managed_interfaces"] =
         
     | 
| 
      
 147 
     | 
    
         
            +
                      host["interfaces"].select{|intfs| intfs["type"] == "Nic::Managed" } rescue []
         
     | 
| 
       123 
148 
     | 
    
         
             
                    host
         
     | 
| 
       124 
149 
     | 
    
         
             
                  end
         
     | 
| 
       125 
150 
     | 
    
         | 
| 
       126 
151 
     | 
    
         
             
                  output ListCommand.output_definition do
         
     | 
| 
       127 
     | 
    
         
            -
                    field :uuid, "UUID"
         
     | 
| 
       128 
     | 
    
         
            -
                    field :certname, "Cert name"
         
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
       130 
     | 
    
         
            -
                    field :environment_name, "Environment"
         
     | 
| 
       131 
     | 
    
         
            -
                    field :environment_id, "Environment Id"
         
     | 
| 
       132 
     | 
    
         
            -
             
     | 
| 
       133 
     | 
    
         
            -
                    field :managed, "Managed"
         
     | 
| 
       134 
     | 
    
         
            -
                    field :enabled, "Enabled"
         
     | 
| 
       135 
     | 
    
         
            -
                    field :build, "Build"
         
     | 
| 
       136 
     | 
    
         
            -
             
     | 
| 
       137 
     | 
    
         
            -
                    field :use_image, "Use image"
         
     | 
| 
       138 
     | 
    
         
            -
                    field :disk, "Disk"
         
     | 
| 
       139 
     | 
    
         
            -
                    field :image_file, "Image file"
         
     | 
| 
       140 
     | 
    
         
            -
             
     | 
| 
       141 
     | 
    
         
            -
                    field :sp_name, "SP Name"
         
     | 
| 
       142 
     | 
    
         
            -
                    field :sp_ip, "SP IP"
         
     | 
| 
       143 
     | 
    
         
            -
                    field :sp_mac, "SP MAC"
         
     | 
| 
       144 
     | 
    
         
            -
                    field :sp_subnet, "SP Subnet"
         
     | 
| 
       145 
     | 
    
         
            -
                    field :sp_subnet_id, "SP Subnet Id"
         
     | 
| 
       146 
     | 
    
         
            -
             
     | 
| 
       147 
     | 
    
         
            -
                    field :created_at, "Created at", Fields::Date
         
     | 
| 
       148 
     | 
    
         
            -
                    field :updated_at, "Updated at", Fields::Date
         
     | 
| 
       149 
     | 
    
         
            -
                    field :installed_at, "Installed at", Fields::Date
         
     | 
| 
       150 
     | 
    
         
            -
                    field :last_report, "Last report", Fields::Date
         
     | 
| 
       151 
     | 
    
         
            -
             
     | 
| 
       152 
     | 
    
         
            -
                    field :puppet_ca_proxy_id, "Puppet CA Proxy Id"
         
     | 
| 
       153 
     | 
    
         
            -
                    field :medium_id, "Medium Id"
         
     | 
| 
       154 
     | 
    
         
            -
                    field :model_id, "Model Id"
         
     | 
| 
       155 
     | 
    
         
            -
                    field :owner_id, "Owner Id"
         
     | 
| 
       156 
     | 
    
         
            -
                    field :subnet_id, "Subnet Id"
         
     | 
| 
       157 
     | 
    
         
            -
                    field :domain_id, "Domain Id"
         
     | 
| 
       158 
     | 
    
         
            -
                    field :puppet_proxy_id, "Puppet Proxy Id"
         
     | 
| 
       159 
     | 
    
         
            -
                    field :owner_type, "Owner Type"
         
     | 
| 
       160 
     | 
    
         
            -
                    field :ptable_id, "Partition Table Id"
         
     | 
| 
       161 
     | 
    
         
            -
                    field :architecture_id, "Architecture Id"
         
     | 
| 
       162 
     | 
    
         
            -
                    field :image_id, "Image Id"
         
     | 
| 
       163 
     | 
    
         
            -
                    field :compute_resource_id, "Compute Resource Id"
         
     | 
| 
       164 
     | 
    
         
            -
             
     | 
| 
       165 
     | 
    
         
            -
                    field :comment, "Comment"
         
     | 
| 
       166 
     | 
    
         
            -
             
     | 
| 
       167 
     | 
    
         
            -
                    collection :parameters, "Parameters" do
         
     | 
| 
      
 152 
     | 
    
         
            +
                    field :uuid, _("UUID")
         
     | 
| 
      
 153 
     | 
    
         
            +
                    field :certname, _("Cert name")
         
     | 
| 
      
 154 
     | 
    
         
            +
             
     | 
| 
      
 155 
     | 
    
         
            +
                    field :environment_name, _("Environment")
         
     | 
| 
      
 156 
     | 
    
         
            +
                    field :environment_id, _("Environment Id")
         
     | 
| 
      
 157 
     | 
    
         
            +
             
     | 
| 
      
 158 
     | 
    
         
            +
                    field :managed, _("Managed")
         
     | 
| 
      
 159 
     | 
    
         
            +
                    field :enabled, _("Enabled")
         
     | 
| 
      
 160 
     | 
    
         
            +
                    field :build, _("Build")
         
     | 
| 
      
 161 
     | 
    
         
            +
             
     | 
| 
      
 162 
     | 
    
         
            +
                    field :use_image, _("Use image")
         
     | 
| 
      
 163 
     | 
    
         
            +
                    field :disk, _("Disk")
         
     | 
| 
      
 164 
     | 
    
         
            +
                    field :image_file, _("Image file")
         
     | 
| 
      
 165 
     | 
    
         
            +
             
     | 
| 
      
 166 
     | 
    
         
            +
                    field :sp_name, _("SP Name")
         
     | 
| 
      
 167 
     | 
    
         
            +
                    field :sp_ip, _("SP IP")
         
     | 
| 
      
 168 
     | 
    
         
            +
                    field :sp_mac, _("SP MAC")
         
     | 
| 
      
 169 
     | 
    
         
            +
                    field :sp_subnet, _("SP Subnet")
         
     | 
| 
      
 170 
     | 
    
         
            +
                    field :sp_subnet_id, _("SP Subnet Id")
         
     | 
| 
      
 171 
     | 
    
         
            +
             
     | 
| 
      
 172 
     | 
    
         
            +
                    field :created_at, _("Created at"), Fields::Date
         
     | 
| 
      
 173 
     | 
    
         
            +
                    field :updated_at, _("Updated at"), Fields::Date
         
     | 
| 
      
 174 
     | 
    
         
            +
                    field :installed_at, _("Installed at"), Fields::Date
         
     | 
| 
      
 175 
     | 
    
         
            +
                    field :last_report, _("Last report"), Fields::Date
         
     | 
| 
      
 176 
     | 
    
         
            +
             
     | 
| 
      
 177 
     | 
    
         
            +
                    field :puppet_ca_proxy_id, _("Puppet CA Proxy Id")
         
     | 
| 
      
 178 
     | 
    
         
            +
                    field :medium_id, _("Medium Id")
         
     | 
| 
      
 179 
     | 
    
         
            +
                    field :model_id, _("Model Id")
         
     | 
| 
      
 180 
     | 
    
         
            +
                    field :owner_id, _("Owner Id")
         
     | 
| 
      
 181 
     | 
    
         
            +
                    field :subnet_id, _("Subnet Id")
         
     | 
| 
      
 182 
     | 
    
         
            +
                    field :domain_id, _("Domain Id")
         
     | 
| 
      
 183 
     | 
    
         
            +
                    field :puppet_proxy_id, _("Puppet Proxy Id")
         
     | 
| 
      
 184 
     | 
    
         
            +
                    field :owner_type, _("Owner Type")
         
     | 
| 
      
 185 
     | 
    
         
            +
                    field :ptable_id, _("Partition Table Id")
         
     | 
| 
      
 186 
     | 
    
         
            +
                    field :architecture_id, _("Architecture Id")
         
     | 
| 
      
 187 
     | 
    
         
            +
                    field :image_id, _("Image Id")
         
     | 
| 
      
 188 
     | 
    
         
            +
                    field :compute_resource_id, _("Compute Resource Id")
         
     | 
| 
      
 189 
     | 
    
         
            +
             
     | 
| 
      
 190 
     | 
    
         
            +
                    field :comment, _("Comment")
         
     | 
| 
      
 191 
     | 
    
         
            +
             
     | 
| 
      
 192 
     | 
    
         
            +
                    collection :parameters, _("Parameters") do
         
     | 
| 
       168 
193 
     | 
    
         
             
                      field nil, nil, Fields::KeyValue
         
     | 
| 
       169 
194 
     | 
    
         
             
                    end
         
     | 
| 
      
 195 
     | 
    
         
            +
             
     | 
| 
      
 196 
     | 
    
         
            +
                    collection :_bmc_interfaces, _("BMC Network Interfaces"), :hide_blank => true do
         
     | 
| 
      
 197 
     | 
    
         
            +
                      field :id, _("Id")
         
     | 
| 
      
 198 
     | 
    
         
            +
                      field :name, _("Name")
         
     | 
| 
      
 199 
     | 
    
         
            +
                      field :ip, _("IP")
         
     | 
| 
      
 200 
     | 
    
         
            +
                      field :mac, _("MAC")
         
     | 
| 
      
 201 
     | 
    
         
            +
                      field :domain_id, _("Domain Id")
         
     | 
| 
      
 202 
     | 
    
         
            +
                      field :domain_name, _("Domain Name")
         
     | 
| 
      
 203 
     | 
    
         
            +
                      field :subnet_id, _("Subnet Id")
         
     | 
| 
      
 204 
     | 
    
         
            +
                      field :subnet_name, _("Subnet Name")
         
     | 
| 
      
 205 
     | 
    
         
            +
                      field :username, _("BMC Username")
         
     | 
| 
      
 206 
     | 
    
         
            +
                      field :password, _("BMC Password")
         
     | 
| 
      
 207 
     | 
    
         
            +
                    end
         
     | 
| 
      
 208 
     | 
    
         
            +
             
     | 
| 
      
 209 
     | 
    
         
            +
                    collection :_managed_interfaces, _("Managed Network Interfaces"), :hide_blank => true do
         
     | 
| 
      
 210 
     | 
    
         
            +
                      field :id, _("Id")
         
     | 
| 
      
 211 
     | 
    
         
            +
                      field :name, _("Name")
         
     | 
| 
      
 212 
     | 
    
         
            +
                      field :ip, _("IP")
         
     | 
| 
      
 213 
     | 
    
         
            +
                      field :mac, _("MAC")
         
     | 
| 
      
 214 
     | 
    
         
            +
                      field :domain_id, _("Domain Id")
         
     | 
| 
      
 215 
     | 
    
         
            +
                      field :domain_name, _("Domain Name")
         
     | 
| 
      
 216 
     | 
    
         
            +
                      field :subnet_id, _("Subnet Id")
         
     | 
| 
      
 217 
     | 
    
         
            +
                      field :subnet_name, _("Subnet Name")
         
     | 
| 
      
 218 
     | 
    
         
            +
                    end
         
     | 
| 
      
 219 
     | 
    
         
            +
             
     | 
| 
       170 
220 
     | 
    
         
             
                  end
         
     | 
| 
       171 
221 
     | 
    
         | 
| 
       172 
222 
     | 
    
         
             
                  apipie_options
         
     | 
| 
         @@ -180,8 +230,8 @@ module HammerCLIForeman 
     | 
|
| 
       180 
230 
     | 
    
         
             
                  command_name "status"
         
     | 
| 
       181 
231 
     | 
    
         | 
| 
       182 
232 
     | 
    
         
             
                  output do
         
     | 
| 
       183 
     | 
    
         
            -
                    field :status, "Status"
         
     | 
| 
       184 
     | 
    
         
            -
                    field :power, "Power"
         
     | 
| 
      
 233 
     | 
    
         
            +
                    field :status, _("Status")
         
     | 
| 
      
 234 
     | 
    
         
            +
                    field :power, _("Power")
         
     | 
| 
       185 
235 
     | 
    
         
             
                  end
         
     | 
| 
       186 
236 
     | 
    
         | 
| 
       187 
237 
     | 
    
         
             
                  def retrieve_data
         
     | 
| 
         @@ -195,7 +245,7 @@ module HammerCLIForeman 
     | 
|
| 
       195 
245 
     | 
    
         
             
                    params = {
         
     | 
| 
       196 
246 
     | 
    
         
             
                      'id' => get_identifier[0],
         
     | 
| 
       197 
247 
     | 
    
         
             
                    }
         
     | 
| 
       198 
     | 
    
         
            -
                    status = resource.call(:status, params) 
     | 
| 
      
 248 
     | 
    
         
            +
                    status = resource.call(:status, params)
         
     | 
| 
       199 
249 
     | 
    
         
             
                    status["status"]
         
     | 
| 
       200 
250 
     | 
    
         
             
                  end
         
     | 
| 
       201 
251 
     | 
    
         | 
| 
         @@ -204,7 +254,7 @@ module HammerCLIForeman 
     | 
|
| 
       204 
254 
     | 
    
         
             
                      'id' => get_identifier[0],
         
     | 
| 
       205 
255 
     | 
    
         
             
                      'power_action' => :state
         
     | 
| 
       206 
256 
     | 
    
         
             
                    }
         
     | 
| 
       207 
     | 
    
         
            -
                    status = resource.call(:power, params) 
     | 
| 
      
 257 
     | 
    
         
            +
                    status = resource.call(:power, params)
         
     | 
| 
       208 
258 
     | 
    
         
             
                    status["power"]
         
     | 
| 
       209 
259 
     | 
    
         
             
                  end
         
     | 
| 
       210 
260 
     | 
    
         | 
| 
         @@ -215,10 +265,10 @@ module HammerCLIForeman 
     | 
|
| 
       215 
265 
     | 
    
         
             
                class PuppetRunCommand < HammerCLIForeman::InfoCommand
         
     | 
| 
       216 
266 
     | 
    
         | 
| 
       217 
267 
     | 
    
         
             
                  command_name "puppetrun"
         
     | 
| 
       218 
     | 
    
         
            -
                  action  
     | 
| 
      
 268 
     | 
    
         
            +
                  action :puppetrun
         
     | 
| 
       219 
269 
     | 
    
         | 
| 
       220 
270 
     | 
    
         
             
                  def print_data(records)
         
     | 
| 
       221 
     | 
    
         
            -
                    print_message 'Puppet run triggered'
         
     | 
| 
      
 271 
     | 
    
         
            +
                    print_message _('Puppet run triggered')
         
     | 
| 
       222 
272 
     | 
    
         
             
                  end
         
     | 
| 
       223 
273 
     | 
    
         | 
| 
       224 
274 
     | 
    
         
             
                  apipie_options
         
     | 
| 
         @@ -228,14 +278,14 @@ module HammerCLIForeman 
     | 
|
| 
       228 
278 
     | 
    
         
             
                class FactsCommand < HammerCLIForeman::ListCommand
         
     | 
| 
       229 
279 
     | 
    
         | 
| 
       230 
280 
     | 
    
         
             
                  command_name "facts"
         
     | 
| 
       231 
     | 
    
         
            -
                  resource  
     | 
| 
      
 281 
     | 
    
         
            +
                  resource :fact_values, :index
         
     | 
| 
       232 
282 
     | 
    
         
             
                  identifiers :id, :name
         
     | 
| 
       233 
283 
     | 
    
         | 
| 
       234 
284 
     | 
    
         
             
                  apipie_options :without => declared_identifiers.keys
         
     | 
| 
       235 
285 
     | 
    
         | 
| 
       236 
286 
     | 
    
         
             
                  output do
         
     | 
| 
       237 
     | 
    
         
            -
                    field :fact, "Fact"
         
     | 
| 
       238 
     | 
    
         
            -
                    field :value, "Value"
         
     | 
| 
      
 287 
     | 
    
         
            +
                    field :fact, _("Fact")
         
     | 
| 
      
 288 
     | 
    
         
            +
                    field :value, _("Value")
         
     | 
| 
       239 
289 
     | 
    
         
             
                  end
         
     | 
| 
       240 
290 
     | 
    
         | 
| 
       241 
291 
     | 
    
         
             
                  def request_params
         
     | 
| 
         @@ -254,8 +304,8 @@ module HammerCLIForeman 
     | 
|
| 
       254 
304 
     | 
    
         | 
| 
       255 
305 
     | 
    
         
             
                class PuppetClassesCommand < HammerCLIForeman::ListCommand
         
     | 
| 
       256 
306 
     | 
    
         | 
| 
       257 
     | 
    
         
            -
                  command_name " 
     | 
| 
       258 
     | 
    
         
            -
                  resource  
     | 
| 
      
 307 
     | 
    
         
            +
                  command_name "puppet-classes"
         
     | 
| 
      
 308 
     | 
    
         
            +
                  resource :puppetclasses
         
     | 
| 
       259 
309 
     | 
    
         | 
| 
       260 
310 
     | 
    
         
             
                  identifiers :id, :name
         
     | 
| 
       261 
311 
     | 
    
         | 
| 
         @@ -280,7 +330,7 @@ module HammerCLIForeman 
     | 
|
| 
       280 
330 
     | 
    
         
             
                  identifiers :id, :name
         
     | 
| 
       281 
331 
     | 
    
         | 
| 
       282 
332 
     | 
    
         
             
                  command_name "reports"
         
     | 
| 
       283 
     | 
    
         
            -
                  resource  
     | 
| 
      
 333 
     | 
    
         
            +
                  resource :reports
         
     | 
| 
       284 
334 
     | 
    
         
             
                  output HammerCLIForeman::Report::ListCommand.output_definition
         
     | 
| 
       285 
335 
     | 
    
         | 
| 
       286 
336 
     | 
    
         
             
                  apipie_options :without => :search
         
     | 
| 
         @@ -292,17 +342,22 @@ module HammerCLIForeman 
     | 
|
| 
       292 
342 
     | 
    
         | 
| 
       293 
343 
     | 
    
         
             
                class CreateCommand < HammerCLIForeman::CreateCommand
         
     | 
| 
       294 
344 
     | 
    
         | 
| 
       295 
     | 
    
         
            -
                  success_message "Host created"
         
     | 
| 
       296 
     | 
    
         
            -
                  failure_message "Could not create the host"
         
     | 
| 
       297 
     | 
    
         
            -
                  action "create"
         
     | 
| 
      
 345 
     | 
    
         
            +
                  success_message _("Host created")
         
     | 
| 
      
 346 
     | 
    
         
            +
                  failure_message _("Could not create the host")
         
     | 
| 
       298 
347 
     | 
    
         | 
| 
       299 
348 
     | 
    
         
             
                  include HammerCLIForeman::CommonHostUpdateOptions
         
     | 
| 
       300 
349 
     | 
    
         | 
| 
       301 
     | 
    
         
            -
                  validate_options 
     | 
| 
       302 
     | 
    
         
            -
                     
     | 
| 
       303 
     | 
    
         
            -
             
     | 
| 
       304 
     | 
    
         
            -
             
     | 
| 
       305 
     | 
    
         
            -
                        : 
     | 
| 
      
 350 
     | 
    
         
            +
                  def validate_options
         
     | 
| 
      
 351 
     | 
    
         
            +
                    super
         
     | 
| 
      
 352 
     | 
    
         
            +
                    unless validator.option(:option_hostgroup_id).exist?
         
     | 
| 
      
 353 
     | 
    
         
            +
                      if option_managed
         
     | 
| 
      
 354 
     | 
    
         
            +
                        validator.all(:option_environment_id, :option_architecture_id, :option_domain_id,
         
     | 
| 
      
 355 
     | 
    
         
            +
                                      :option_puppet_proxy_id, :option_operatingsystem_id,
         
     | 
| 
      
 356 
     | 
    
         
            +
                                      :option_partition_table_id).required
         
     | 
| 
      
 357 
     | 
    
         
            +
                      else
         
     | 
| 
      
 358 
     | 
    
         
            +
                        # unmanaged host only requires environment
         
     | 
| 
      
 359 
     | 
    
         
            +
                        validator.option(:option_environment_id).required
         
     | 
| 
      
 360 
     | 
    
         
            +
                      end
         
     | 
| 
       306 
361 
     | 
    
         
             
                    end
         
     | 
| 
       307 
362 
     | 
    
         
             
                  end
         
     | 
| 
       308 
363 
     | 
    
         
             
                end
         
     | 
| 
         @@ -310,8 +365,8 @@ module HammerCLIForeman 
     | 
|
| 
       310 
365 
     | 
    
         | 
| 
       311 
366 
     | 
    
         
             
                class UpdateCommand < HammerCLIForeman::UpdateCommand
         
     | 
| 
       312 
367 
     | 
    
         | 
| 
       313 
     | 
    
         
            -
                  success_message "Host updated"
         
     | 
| 
       314 
     | 
    
         
            -
                  failure_message "Could not update the host"
         
     | 
| 
      
 368 
     | 
    
         
            +
                  success_message _("Host updated")
         
     | 
| 
      
 369 
     | 
    
         
            +
                  failure_message _("Could not update the host")
         
     | 
| 
       315 
370 
     | 
    
         | 
| 
       316 
371 
     | 
    
         
             
                  include HammerCLIForeman::CommonHostUpdateOptions
         
     | 
| 
       317 
372 
     | 
    
         
             
                end
         
     | 
| 
         @@ -319,8 +374,8 @@ module HammerCLIForeman 
     | 
|
| 
       319 
374 
     | 
    
         | 
| 
       320 
375 
     | 
    
         
             
                class DeleteCommand < HammerCLIForeman::DeleteCommand
         
     | 
| 
       321 
376 
     | 
    
         | 
| 
       322 
     | 
    
         
            -
                  success_message "Host deleted"
         
     | 
| 
       323 
     | 
    
         
            -
                  failure_message "Could not delete the host"
         
     | 
| 
      
 377 
     | 
    
         
            +
                  success_message _("Host deleted")
         
     | 
| 
      
 378 
     | 
    
         
            +
                  failure_message _("Could not delete the host")
         
     | 
| 
       324 
379 
     | 
    
         | 
| 
       325 
380 
     | 
    
         
             
                  apipie_options
         
     | 
| 
       326 
381 
     | 
    
         
             
                end
         
     | 
| 
         @@ -328,16 +383,16 @@ module HammerCLIForeman 
     | 
|
| 
       328 
383 
     | 
    
         | 
| 
       329 
384 
     | 
    
         
             
                class SetParameterCommand < HammerCLIForeman::Parameter::SetCommand
         
     | 
| 
       330 
385 
     | 
    
         | 
| 
       331 
     | 
    
         
            -
                  resource  
     | 
| 
      
 386 
     | 
    
         
            +
                  resource :parameters
         
     | 
| 
       332 
387 
     | 
    
         | 
| 
       333 
     | 
    
         
            -
                  desc "Create or update parameter for a host."
         
     | 
| 
      
 388 
     | 
    
         
            +
                  desc _("Create or update parameter for a host.")
         
     | 
| 
       334 
389 
     | 
    
         | 
| 
       335 
     | 
    
         
            -
                  option "--host-name", "HOST_NAME", "name of the host the parameter is being set for"
         
     | 
| 
       336 
     | 
    
         
            -
                  option "--host-id", "HOST_ID", "id of the host the parameter is being set for"
         
     | 
| 
      
 390 
     | 
    
         
            +
                  option "--host-name", "HOST_NAME", _("name of the host the parameter is being set for")
         
     | 
| 
      
 391 
     | 
    
         
            +
                  option "--host-id", "HOST_ID", _("id of the host the parameter is being set for")
         
     | 
| 
       337 
392 
     | 
    
         | 
| 
       338 
     | 
    
         
            -
                  success_message_for :update, "Host parameter updated"
         
     | 
| 
       339 
     | 
    
         
            -
                  success_message_for :create, "New host parameter created"
         
     | 
| 
       340 
     | 
    
         
            -
                  failure_message "Could not set host parameter"
         
     | 
| 
      
 393 
     | 
    
         
            +
                  success_message_for :update, _("Host parameter updated")
         
     | 
| 
      
 394 
     | 
    
         
            +
                  success_message_for :create, _("New host parameter created")
         
     | 
| 
      
 395 
     | 
    
         
            +
                  failure_message _("Could not set host parameter")
         
     | 
| 
       341 
396 
     | 
    
         | 
| 
       342 
397 
     | 
    
         
             
                  def validate_options
         
     | 
| 
       343 
398 
     | 
    
         
             
                    super
         
     | 
| 
         @@ -354,14 +409,14 @@ module HammerCLIForeman 
     | 
|
| 
       354 
409 
     | 
    
         | 
| 
       355 
410 
     | 
    
         
             
                class DeleteParameterCommand < HammerCLIForeman::Parameter::DeleteCommand
         
     | 
| 
       356 
411 
     | 
    
         | 
| 
       357 
     | 
    
         
            -
                  resource  
     | 
| 
      
 412 
     | 
    
         
            +
                  resource :parameters
         
     | 
| 
       358 
413 
     | 
    
         | 
| 
       359 
     | 
    
         
            -
                  desc "Delete parameter for a host."
         
     | 
| 
      
 414 
     | 
    
         
            +
                  desc _("Delete parameter for a host.")
         
     | 
| 
       360 
415 
     | 
    
         | 
| 
       361 
     | 
    
         
            -
                  option "--host-name", "HOST_NAME", "name of the host the parameter is being deleted for"
         
     | 
| 
       362 
     | 
    
         
            -
                  option "--host-id", "HOST_ID", "id of the host the parameter is being deleted for"
         
     | 
| 
      
 416 
     | 
    
         
            +
                  option "--host-name", "HOST_NAME", _("name of the host the parameter is being deleted for")
         
     | 
| 
      
 417 
     | 
    
         
            +
                  option "--host-id", "HOST_ID", _("id of the host the parameter is being deleted for")
         
     | 
| 
       363 
418 
     | 
    
         | 
| 
       364 
     | 
    
         
            -
                  success_message "Host parameter deleted"
         
     | 
| 
      
 419 
     | 
    
         
            +
                  success_message _("Host parameter deleted")
         
     | 
| 
       365 
420 
     | 
    
         | 
| 
       366 
421 
     | 
    
         
             
                  def validate_options
         
     | 
| 
       367 
422 
     | 
    
         
             
                    super
         
     | 
| 
         @@ -379,31 +434,37 @@ module HammerCLIForeman 
     | 
|
| 
       379 
434 
     | 
    
         
             
                class StartCommand < HammerCLI::Apipie::WriteCommand
         
     | 
| 
       380 
435 
     | 
    
         | 
| 
       381 
436 
     | 
    
         
             
                  identifiers :id, :name
         
     | 
| 
       382 
     | 
    
         
            -
                  action  
     | 
| 
      
 437 
     | 
    
         
            +
                  action :power
         
     | 
| 
       383 
438 
     | 
    
         | 
| 
       384 
439 
     | 
    
         
             
                  command_name "start"
         
     | 
| 
       385 
     | 
    
         
            -
                  desc "Power a host on"
         
     | 
| 
       386 
     | 
    
         
            -
                  success_message "The host is starting."
         
     | 
| 
      
 440 
     | 
    
         
            +
                  desc _("Power a host on")
         
     | 
| 
      
 441 
     | 
    
         
            +
                  success_message _("The host is starting.")
         
     | 
| 
       387 
442 
     | 
    
         | 
| 
       388 
     | 
    
         
            -
                  def  
     | 
| 
      
 443 
     | 
    
         
            +
                  def option_power_action
         
     | 
| 
       389 
444 
     | 
    
         
             
                    :start
         
     | 
| 
       390 
445 
     | 
    
         
             
                  end
         
     | 
| 
       391 
446 
     | 
    
         | 
| 
      
 447 
     | 
    
         
            +
                  def request_params
         
     | 
| 
      
 448 
     | 
    
         
            +
                    params = method_options
         
     | 
| 
      
 449 
     | 
    
         
            +
                    params['id'] = get_identifier[0]
         
     | 
| 
      
 450 
     | 
    
         
            +
                    params
         
     | 
| 
      
 451 
     | 
    
         
            +
                  end
         
     | 
| 
      
 452 
     | 
    
         
            +
             
     | 
| 
       392 
453 
     | 
    
         
             
                  apipie_options :without => :power_action
         
     | 
| 
       393 
454 
     | 
    
         
             
                end
         
     | 
| 
       394 
455 
     | 
    
         | 
| 
       395 
456 
     | 
    
         | 
| 
       396 
457 
     | 
    
         
             
                class StopCommand < HammerCLI::Apipie::WriteCommand
         
     | 
| 
       397 
458 
     | 
    
         | 
| 
       398 
     | 
    
         
            -
                  option '--force', :flag, "Force turning off a host"
         
     | 
| 
      
 459 
     | 
    
         
            +
                  option '--force', :flag, _("Force turning off a host")
         
     | 
| 
       399 
460 
     | 
    
         | 
| 
       400 
461 
     | 
    
         
             
                  identifiers :id, :name
         
     | 
| 
       401 
     | 
    
         
            -
                  action  
     | 
| 
      
 462 
     | 
    
         
            +
                  action :power
         
     | 
| 
       402 
463 
     | 
    
         | 
| 
       403 
464 
     | 
    
         
             
                  command_name "stop"
         
     | 
| 
       404 
     | 
    
         
            -
                  desc "Power a host off"
         
     | 
| 
      
 465 
     | 
    
         
            +
                  desc _("Power a host off")
         
     | 
| 
       405 
466 
     | 
    
         | 
| 
       406 
     | 
    
         
            -
                  def  
     | 
| 
      
 467 
     | 
    
         
            +
                  def option_power_action
         
     | 
| 
       407 
468 
     | 
    
         
             
                    if option_force?
         
     | 
| 
       408 
469 
     | 
    
         
             
                      :cycle
         
     | 
| 
       409 
470 
     | 
    
         
             
                    else
         
     | 
| 
         @@ -413,35 +474,47 @@ module HammerCLIForeman 
     | 
|
| 
       413 
474 
     | 
    
         | 
| 
       414 
475 
     | 
    
         
             
                  def success_message
         
     | 
| 
       415 
476 
     | 
    
         
             
                    if option_force?
         
     | 
| 
       416 
     | 
    
         
            -
                      "Power off forced."
         
     | 
| 
      
 477 
     | 
    
         
            +
                      _("Power off forced.")
         
     | 
| 
       417 
478 
     | 
    
         
             
                    else
         
     | 
| 
       418 
     | 
    
         
            -
                      "Powering the host off."
         
     | 
| 
      
 479 
     | 
    
         
            +
                      _("Powering the host off.")
         
     | 
| 
       419 
480 
     | 
    
         
             
                    end
         
     | 
| 
       420 
481 
     | 
    
         
             
                  end
         
     | 
| 
       421 
482 
     | 
    
         | 
| 
      
 483 
     | 
    
         
            +
                  def request_params
         
     | 
| 
      
 484 
     | 
    
         
            +
                    params = method_options
         
     | 
| 
      
 485 
     | 
    
         
            +
                    params['id'] = get_identifier[0]
         
     | 
| 
      
 486 
     | 
    
         
            +
                    params
         
     | 
| 
      
 487 
     | 
    
         
            +
                  end
         
     | 
| 
      
 488 
     | 
    
         
            +
             
     | 
| 
       422 
489 
     | 
    
         
             
                  apipie_options :without => :power_action
         
     | 
| 
       423 
490 
     | 
    
         
             
                end
         
     | 
| 
       424 
491 
     | 
    
         | 
| 
       425 
492 
     | 
    
         
             
                class RebootCommand < HammerCLI::Apipie::WriteCommand
         
     | 
| 
       426 
493 
     | 
    
         | 
| 
       427 
494 
     | 
    
         
             
                  identifiers :id, :name
         
     | 
| 
       428 
     | 
    
         
            -
                  action  
     | 
| 
      
 495 
     | 
    
         
            +
                  action :power
         
     | 
| 
       429 
496 
     | 
    
         | 
| 
       430 
497 
     | 
    
         
             
                  command_name "reboot"
         
     | 
| 
       431 
     | 
    
         
            -
                  desc "Reboot a host"
         
     | 
| 
       432 
     | 
    
         
            -
                  success_message "Host reboot started."
         
     | 
| 
      
 498 
     | 
    
         
            +
                  desc _("Reboot a host")
         
     | 
| 
      
 499 
     | 
    
         
            +
                  success_message _("Host reboot started.")
         
     | 
| 
       433 
500 
     | 
    
         | 
| 
       434 
     | 
    
         
            -
                  def  
     | 
| 
      
 501 
     | 
    
         
            +
                  def option_power_action
         
     | 
| 
       435 
502 
     | 
    
         
             
                    :soft
         
     | 
| 
       436 
503 
     | 
    
         
             
                  end
         
     | 
| 
       437 
504 
     | 
    
         | 
| 
      
 505 
     | 
    
         
            +
                  def request_params
         
     | 
| 
      
 506 
     | 
    
         
            +
                    params = method_options
         
     | 
| 
      
 507 
     | 
    
         
            +
                    params['id'] = get_identifier[0]
         
     | 
| 
      
 508 
     | 
    
         
            +
                    params
         
     | 
| 
      
 509 
     | 
    
         
            +
                  end
         
     | 
| 
      
 510 
     | 
    
         
            +
             
     | 
| 
       438 
511 
     | 
    
         
             
                  apipie_options :without => :power_action
         
     | 
| 
       439 
512 
     | 
    
         
             
                end
         
     | 
| 
       440 
513 
     | 
    
         | 
| 
       441 
514 
     | 
    
         
             
                class SCParamsCommand < HammerCLIForeman::SmartClassParametersList
         
     | 
| 
       442 
515 
     | 
    
         | 
| 
       443 
516 
     | 
    
         
             
                  apipie_options :without => [:host_id, :hostgroup_id, :puppetclass_id, :environment_id]
         
     | 
| 
       444 
     | 
    
         
            -
                  option ['--id', '--name'], 'HOST_ID', 'host id/name',
         
     | 
| 
      
 517 
     | 
    
         
            +
                  option ['--id', '--name'], 'HOST_ID', _('host id/name'),
         
     | 
| 
       445 
518 
     | 
    
         
             
                          :attribute_name => :option_host_id, :required => true
         
     | 
| 
       446 
519 
     | 
    
         
             
                end
         
     | 
| 
       447 
520 
     | 
    
         | 
| 
         @@ -450,4 +523,4 @@ module HammerCLIForeman 
     | 
|
| 
       450 
523 
     | 
    
         | 
| 
       451 
524 
     | 
    
         
             
            end
         
     | 
| 
       452 
525 
     | 
    
         | 
| 
       453 
     | 
    
         
            -
            HammerCLI::MainCommand.subcommand 'host', "Manipulate hosts.", HammerCLIForeman::Host
         
     | 
| 
      
 526 
     | 
    
         
            +
            HammerCLI::MainCommand.subcommand 'host', ("Manipulate hosts."), HammerCLIForeman::Host
         
     |