Project

General

Profile

Actions

Bug #22453

open

hammer api post smart_class_parameter default override value inserted as array while it should be string

Added by Joost Polley over 6 years ago. Updated over 6 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Based on the discussion with akofink on IRC, here the bug report.

It looks like Hammer is told to send an array of data where it actually should send a string value.

Hammer request:

hammer -vdr sc-param add-override-value --match 'hostgroup=test-hostgroup' --puppet-class test_class --smart-class-parameter test-scp --value test

Result in Foreman 1.14:

[ INFO 2018-01-30T13:22:23 API] POST /api/smart_class_parameters/30/override_values
[DEBUG 2018-01-30T13:22:23 API] Params: {
    "override_value" => {
        "match" => "hostgroup=test-hostgroup",
        "value" => "test" 
    }
}
[DEBUG 2018-01-30T13:22:23 API] Headers: {}
[DEBUG 2018-01-30T13:22:23 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth
[DEBUG 2018-01-30T13:22:23 API] Response: {
            "created_at" => "2018-01-30T13:22:12.296Z",
            "updated_at" => "2018-01-30T13:22:12.296Z",
                    "id" => 507,
                 "match" => "hostgroup=test-hostgroup",
                 "value" => "test",
                  "omit" => false,
    "use_puppet_default" => false
}

Result in Foreman 1.16.0:

[ INFO 2018-01-30T13:19:21 API] POST /api/smart_class_parameters/63/override_values
[DEBUG 2018-01-30T13:19:21 API] Params: {
    "override_value" => {
        "match" => "hostgroup=test-hostgroup",
        "value" => [
            [0] "test" 
        ]
    }
}
[DEBUG 2018-01-30T13:19:21 API] Headers: {}
[DEBUG 2018-01-30T13:19:21 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth
[DEBUG 2018-01-30T13:19:21 API] Response: {
            "created_at" => "2018-01-30T13:19:10.365Z",
            "updated_at" => "2018-01-30T13:19:10.365Z",
                    "id" => 25,
                 "match" => "hostgroup=test-hostgroup",
                 "value" => "[\"test\"]",
                  "omit" => false,
    "use_puppet_default" => false
}

Cannot be reproduced by sending this request directly to the API in 1.16.0.

Tested with:
  • foreman 1.16.0
  • hammer_cli 0.11.0
  • hammer_cli_foreman 0.11.0
Actions #1

Updated by Joost Polley over 6 years ago

Same behaviour with hammer sc-param update --puppet-class.

Example:

hammer sc-param update --puppet-class my_class --name my_param --parameter-type string --override true --default-value 'test'

The value inserted becomes ["test"].

Actions #2

Updated by bharath sinu over 6 years ago

deleted

Actions

Also available in: Atom PDF