Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-4476

Add a 'puppet lookup' command line application as UI to lookup function

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 4.3.0
    • Component/s: None
    • Labels:
      None
    • Template:
    • Epic Link:
    • Story Points:
      5
    • Sprint:
      Language 2015-07-22, Language 2015-08-19, Language 2015-09-02, Language 2015-09-16, Language 2015-09-30, Language 2015-10-14, Language 2015-10-28, Language 2015-11-11
    • Release Notes:
      New Feature
    • Release Notes Summary:
      Hide
      As part of the new 'data in modules' feature, there is now a command line command "puppet lookup" that can lookup the value for a given key for a given node. This is an intended replacement of the earlier "hiera" command line tool since it is unaware of 'data in modules'.
      Show
      As part of the new 'data in modules' feature, there is now a command line command "puppet lookup" that can lookup the value for a given key for a given node. This is an intended replacement of the earlier "hiera" command line tool since it is unaware of 'data in modules'.

      Description

      In order to support "data in modules and environment" and be able to test and debug a data configuration it is important to have a command line utility that can help answer questions about "which value will be produced for a given key, and how did the system arrive at that value".

      This new command line utility supplants the existing hiera command line tool since it is not aware of data-in-modules, and cannot perform cross lookups/merges like the lookup functionality can.

      Thus, the puppet lookup command is basically a UI for the lookup function, with the added feature that it can request and display an explanation (see PUP-4475).

      The application takes options for lookup:

      • --type <TYPESTRING> - to assert that value has that type
      • --merge= unique | hash | deep
      • --knock_out_prefix=<prefix_string>
      • --sort_merged_arrays
      • --unpack_arrays
      • --merge_hash_arrays
      • --explain - prints an explanation for how result was obtained
      • --default = <VALUE> - a value produced if no value was found (useful if command is used to set a shell variable or similar)

      The application takes options for facts/scope:

      • --node nodename - looks up the facts from the facts terminus
      • --facts factfile - a .json, or .yaml file holding key=> value mappings that will populate a scope with data that is used when looking up

      Followed by one or more keys to lookup, the first found is returned. If multiple values are given, explanations are produced for each key up to (and including) the first found value.

      Exits with 0 if value was found (or default value was used if value was not found), and 1 otherwise.

      To complete the implementation of the --explain feature, PUP-4475 must be implemented.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                henrik.lindberg Henrik Lindberg
              • Votes:
                1 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support