Uploaded image for project: 'Facter'
  1. Facter
  2. FACT-3000

Dot notation implemented in Facter 4 is incomplete

    XMLWordPrintable

Details

    • Bug
    • Status: Accepted
    • Normal
    • Resolution: Unresolved
    • None
    • None
    • None
    • None
    • Needs Assessment

    Description

      Primary problem:

      • There is no way to override, block, or cache facts that contain a dot in the name or sub-key

      Facter 4 introduced compositive fact structuring via dot-notation as a feature. However, the dot-notation implementation used is incomplete, and behaves differently from dot-notation elsewhere in the ecosystem.

      Specifically, Facter 4 dot-notation splits key segments incorrectly, because it does not recognize the use of double or single quotes to indicate keys which contain literal dot characters.

      The reference implementation for dot-notation is found in Puppet, here.

      Full dot-notation should be supported everywhere Facter 4 currently evaluates dot-notation strings to segment structured fact names. This includes external fact output (text, json, yaml), as well as Facter.add().

      Today's behavior

      Consider the following plain-text custom fact file:

      foo.bar.one=1
      foo.bar.two=2
      foo."i.have.dots"=3
      "me.too"=4
      

      Today, Facter 4 returns the following for these facts.

      {
        "foo": {
          "bar": {
            "one": "1",
            "two": "2"
          },
          "\"i": {
            "have": {
              "dots\"": "3"
            }
          }
        },
        "\"me": {
          "too\"": "4"
        }
      }
      

      This is incorrect.

      Correct behavior

      Full and correct support for dot-notation SHOULD give:

      {
        "foo": {
          "bar": {
            "one": "1",
            "two": "2"
          },
          "i.have.dots": "3"
        },
        "me.too": "4"
      }
      

      Attachments

        Issue Links

          Activity

            People

              gheorghe.popescu Gheorghe Popescu
              reid Reid Vandewiele
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:

                Zendesk Support