5.7. Overriding Smart Class Parameters

You can search for Smart Parameters using the API and supply a value to override a Smart Parameter in a Class. You can find the full list of attributes that you can modify in the built-in API reference at https://satellite.example.com/apidoc/v2/smart_class_parameters/update.html.

  1. Find the ID of the Smart Class parameter you want to change:

    • List all Smart Class Parameters.

      Example request:

      $ curl --request GET --insecure --user sat_username:sat_password \
      https://satellite.example.com/api/smart_class_parameters
    • If you know the Puppet class ID, for example 5, you can restrict the scope:

      Example request:

      $ curl --request GET --insecure --user sat_username:sat_password \
      https://satellite.example.com/api/puppetclasses/5/smart_class_parameters

      Both calls accept a search parameter. You can view the full list of searchable fields in the Satellite web UI. Navigate to Configure > Smart variables and click in the search query box to reveal the list of fields.

      Two particularly useful search parameters are puppetclass_name and key, which you can use to search for a specific parameter. For example, using the --data option to pass URL encoded data.

      Example request:

      $ curl --request GET --insecure --user sat_username:sat_password \
      --data 'search=puppetclass_name = access_insights_client and key = authmethod' \
      https://satellite.example.com/api/smart_class_parameters

      Satellite supports standard scoped-search syntax.

  2. When you find the ID of the parameter, list the full details including current override values.

    Example request:

    $ curl --request GET --insecure --user sat_username:sat_password \
    https://satellite.example.com/api/smart_class_parameters/63
  3. Enable overriding of parameter values.

    Example request:

    $ curl --header "Accept:application/json,version=2" \
    --header "Content-Type:application/json" \
    --request PUT --insecure --user sat_username:sat_password \
    --data '{"smart_class_parameter":{"override":true}}' \
    https://satellite.example.com/api/smart_class_parameters/63

    Note that you cannot create or delete the parameters manually. You can only modify their attributes. Satellite creates and deletes parameters only upon class import from a proxy.

  4. Add custom override matchers.

    Example request:

    $ curl --header "Accept:application/json,version=2" \
    --header "Content-Type:application/json" \
    --request PUT --insecure --user sat_username:sat_password \
    --data '{"smart_class_parameter":{"override_value":{"match":"hostgroup=Test","value":"2.4.6"}}}' \
    https://satellite.example.com/api/smart_class_parameters/63

    For more information about override values, see https://satellite.example.com/apidoc/v2/override_values.html.

  5. You can delete override values.

    Example request:

    $ curl --request DELETE --user sat_username:sat_password \
    https://satellite.example.com/api/smart_class_parameters/63/override_values/3