Jira (FACT-3000) Dot notation implemented in Facter 4 is incomplete

48 views
Skip to first unread message

Reid Vandewiele (Jira)

unread,
Mar 26, 2021, 3:58:02 PM3/26/21
to puppe...@googlegroups.com
Reid Vandewiele created an issue
 
Facter / Bug FACT-3000
Dot notation implemented in Facter 4 is incomplete
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2021/03/26 12:57 PM
Priority: Normal Normal
Reporter: Reid Vandewiele

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.

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 returns the following for these facts.

{
  "foo": {
    "bar": {
      "one": "1",
      "two": "2"
    },
    "\"i": {
      "have": {
        "dots\"": "3"
      }
    }
  },
  "\"foo": {
    "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"
}

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Reid Vandewiele (Jira)

unread,
Mar 26, 2021, 4:02:02 PM3/26/21
to puppe...@googlegroups.com
Reid Vandewiele updated an issue
Change By: Reid Vandewiele
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|https://github.com/puppetlabs/puppet/blob/85bd9ed07e3e6c956f1972624a50be914292e1ab/lib/puppet/pops/lookup/sub_lookup.rb#L6-L44].

*Today's behavior*


Consider the following plain-text custom fact file:
{code}foo.bar.one=1
foo.bar.two=2
foo."
I i . Have have . Dots dots "=3
"me.too"=4
{code}

Today, Facter returns the following for these facts.
{code:json}{

  "foo": {
    "bar": {
      "one": "1",
      "two": "2"
    },
    "\"i": {
      "have": {
        "dots\"": "3"
      }
    }
  },
  "\"foo": {
    "too\"": "4"
  }
}
{code}
This is incorrect.

*Correct behavior*


Full and correct support for dot-notation SHOULD give:
{code:json}{

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

Reid Vandewiele (Jira)

unread,
Mar 26, 2021, 4:03:02 PM3/26/21
to puppe...@googlegroups.com
Reid Vandewiele updated an issue
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|https://github.com/puppetlabs/puppet/blob/85bd9ed07e3e6c956f1972624a50be914292e1ab/lib/puppet/pops/lookup/sub_lookup.rb#L6-L44].

*Today's behavior*

Consider the following plain-text custom fact file:
{code}foo.bar.one=1
foo.bar.two=2
foo."i.have.dots"=3

"me.too"=4
{code}
Today, Facter returns the following for these facts.
{code:json}{
  "foo": {
    "bar": {
      "one": "1",
      "two": "2"
    },
    "\"i": {
      "have": {
        "dots\"": "3"
      }
    }
  },
  "\" foo me ": {

    "too\"": "4"
  }
}
{code}
This is incorrect.

*Correct behavior*

Full and correct support for dot-notation SHOULD give:
{code:json}{
  "foo": {
    "bar": {
      "one": "1",
      "two": "2"
    },
    "i.have.dots": "3"
  },
  "me.too": "4"
}
{code}

Reid Vandewiele (Jira)

unread,
Mar 26, 2021, 4:19:02 PM3/26/21
to puppe...@googlegroups.com
Reid Vandewiele updated an issue
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|https://github.com/puppetlabs/puppet/blob/85bd9ed07e3e6c956f1972624a50be914292e1ab/lib/puppet/pops/lookup/sub_lookup.rb#L6-L44].

Full dot-notation should be supported everywhere Facter 4 currently evaluates dot-notation 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:
{code}foo.bar.one=1
foo.bar.two=2
foo."i.have.dots"=3
"me.too"=4
{code}
Today, Facter returns the following for these facts.
{code:json}{
  "foo": {
    "bar": {
      "one": "1",
      "two": "2"
    },
    "\"i": {
      "have": {
        "dots\"": "3"
      }
    }
  },
  "\"me": {

    "too\"": "4"
  }
}
{code}
This is incorrect.

*Correct behavior*

Full and correct support for dot-notation SHOULD give:
{code:json}{
  "foo": {
    "bar": {
      "one": "1",
      "two": "2"
    },
    "i.have.dots": "3"
  },
  "me.too": "4"
}
{code}

Reid Vandewiele (Jira)

unread,
Mar 26, 2021, 4:25:03 PM3/26/21
to puppe...@googlegroups.com
Reid Vandewiele updated an issue
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|https://github.com/puppetlabs/puppet/blob/85bd9ed07e3e6c956f1972624a50be914292e1ab/lib/puppet/pops/lookup/sub_lookup.rb#L6-L44].

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()}}.

Josh Cooper (Jira)

unread,
Mar 29, 2021, 7:25:03 PM3/29/21
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
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|https://github.com/puppetlabs/puppet/blob/85bd9ed07e3e6c956f1972624a50be914292e1ab/lib/puppet/pops/lookup/sub_lookup.rb#L6-L44].

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:
{code}foo.bar.one=1
foo.bar.two=2
foo."i.have.dots"=3
"me.too"=4
{code}
Today, Facter 4 returns the following for these facts.

Josh Cooper (Jira)

unread,
Mar 29, 2021, 7:27:03 PM3/29/21
to puppe...@googlegroups.com
Josh Cooper commented on Bug FACT-3000
 
Re: Dot notation implemented in Facter 4 is incomplete

For comparison, facter3 returns the following with the same external fact (since none of the facts are auto-promoted to structured facts):

# facter | grep foo
"foo.too" => 4
foo."i.have.dots" => 3
foo.bar.one => 1
foo.bar.two => 2

Josh Cooper (Jira)

unread,
Mar 30, 2021, 12:45:03 AM3/30/21
to puppe...@googlegroups.com
Josh Cooper commented on Bug FACT-3000

I'm  on completing dot notation handling in Facter 4. Also we have many cases in the puppet ecosystem where dots are special and must be escaped if you want a literal dot. For example, https://puppet.com/docs/puppet/7.5/hiera_automatic.html#hiera_dotted_notation. So the behavior described here would provide more consistency.

Mihai Buzgau (Jira)

unread,
Mar 30, 2021, 9:48:03 AM3/30/21
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Mar 30, 2021, 9:48:03 AM3/30/21
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: NW - 2021-04-14

Nick Walker (Jira)

unread,
Mar 30, 2021, 11:02:04 AM3/30/21
to puppe...@googlegroups.com
Nick Walker updated an issue
Change By: Nick Walker
Primary problem:
- There is no way to override, block, or cache facts that contain a dot in the name or sub-key

Josh Cooper (Jira)

unread,
Mar 30, 2021, 12:03:02 PM3/30/21
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Fix Version/s: FACT 4.0.53

Mihai Buzgau (Jira)

unread,
Mar 31, 2021, 4:14:03 AM3/31/21
to puppe...@googlegroups.com

Gheorghe Popescu (Jira)

unread,
Mar 31, 2021, 5:39:04 AM3/31/21
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Apr 6, 2021, 1:48:03 PM4/6/21
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Flagged: Impediment
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo

Mihai Buzgau (Jira)

unread,
Apr 7, 2021, 9:31:03 AM4/7/21
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Fix Version/s: FACT 4.1.0

Mihai Buzgau (Jira)

unread,
Apr 14, 2021, 6:22:04 AM4/14/21
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: NW - 2021-04-14 , NW-2021-04-28

Mihai Buzgau (Jira)

unread,
Apr 14, 2021, 6:23:03 AM4/14/21
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: NW - 2021-04-14 Triaged tickets , NW-2021-04- 28 14

Beth Glenfield (Jira)

unread,
Jun 22, 2021, 6:23:01 AM6/22/21
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Sep 7, 2021, 3:51:02 AM9/7/21
to puppe...@googlegroups.com
Ciprian Badescu updated an issue
Change By: Ciprian Badescu
Sprint: Triaged tickets, NW - 2021-04-14

productboard (Jira)

unread,
Dec 15, 2021, 8:44:01 AM12/15/21
to puppe...@googlegroups.com
productboard updated an issue
This message was sent by Atlassian Jira (v8.20.2#820002-sha1:829506d)
Atlassian logo

Josh Cooper (Jira)

unread,
Mar 3, 2023, 12:43:02 PM3/3/23
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Epic Link: FACT PUP - 3051 11659
This message was sent by Atlassian Jira (v8.20.11#820011-sha1:0629dd8)
Atlassian logo

Josh Cooper (Jira)

unread,
Mar 3, 2023, 12:43:03 PM3/3/23
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Team: Night's Watch Phoenix

Josh Cooper (Jira)

unread,
Apr 5, 2023, 2:47:01 PM4/5/23
to puppe...@googlegroups.com
Josh Cooper assigned an issue to Unassigned
Change By: Josh Cooper
Assignee: Gheorghe Popescu

Josh Cooper (Jira)

unread,
Apr 5, 2023, 3:19:01 PM4/5/23
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Apr 5, 2023, 3:20:03 PM4/5/23
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Apr 6, 2023, 11:52:03 AM4/6/23
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages