Jira (PUP-4800) Puppet::Util::IniConfig::PhysicalFile cannot parse file correctly

4 views
Skip to first unread message

Corey Osman (JIRA)

unread,
Jun 30, 2015, 1:12:12 PM6/30/15
to puppe...@googlegroups.com
Corey Osman created an issue
 
Puppet / Bug PUP-4800
Puppet::Util::IniConfig::PhysicalFile cannot parse file correctly
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2015/06/30 10:12 AM
Labels: windows
Priority: Normal Normal
Reporter: Corey Osman

I was creating a windows provider that consumed a ini file. I decided that I would use the Puppet::Util::IniConfig::PhysicalFile to parse my ini file however it seems one of the regex values is not able to parse my content.

  1. regex that has trouble with my ini content
    https://github.com/puppetlabs/puppet/blob/master/lib/puppet/util/inifile.rb#L151

The content that breaks this is found here and I have highlighted the line where it breaks: https://gist.github.com/logicminds/1d4bea2d5ac0285e3417#file-gistfile1-txt-L34

At a glance I think just using the split function to capture the right and left side of the equal sign would work, but I am sure its more complicated than that as I don't have any other inclination of what goes into an ini file.

My provider code does something like this for reference and was hoping to utilize the work of the utility rather than reinventing the wheel.

inffile = 'c:\\windows\\temp
secedit.inf'
secedit(['/export', '/cfg', inffile, '/quiet'])
inf = Puppet::Util::IniConfig::PhysicalFile.new(inffile).read

So the regex can't handle the awesomeness of windows files and I assume this affects all versions of puppet.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.3.15#6346-sha1:dbc023d)
Atlassian logo

Ethan Brown (JIRA)

unread,
Nov 16, 2016, 10:40:03 AM11/16/16
to puppe...@googlegroups.com
Ethan Brown updated an issue
Change By: Ethan Brown
Team: Agent & Platform
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

Ethan Brown (JIRA)

unread,
Nov 16, 2016, 10:40:03 AM11/16/16
to puppe...@googlegroups.com

Geoff Nichols (JIRA)

unread,
Nov 17, 2016, 1:38:03 PM11/17/16
to puppe...@googlegroups.com

Geoff Nichols (JIRA)

unread,
Nov 17, 2016, 1:38:03 PM11/17/16
to puppe...@googlegroups.com

Corey Osman (JIRA)

unread,
Nov 17, 2016, 3:57:08 PM11/17/16
to puppe...@googlegroups.com
Corey Osman updated an issue
Change By: Corey Osman
I was creating a windows provider that consumed a ini file.  I decided that I would use the Puppet::Util::IniConfig::PhysicalFile to parse my ini file however it seems one of the regex values is not able to parse my content.

# regex that has trouble with my ini content

https://github.com/puppetlabs/puppet/blob/master/lib/puppet/util/inifile.rb#L151

The content that breaks this is found here and I have highlighted the line where it breaks: https://gist.github.com/logicminds/1d4bea2d5ac0285e3417#file-gistfile1-txt-L34

At a glance I think just using the split function to capture the right and left side of the equal sign would work, but I am sure its more complicated than that as I don't have any other inclination of what goes into an ini file.

My provider code does something like this for reference and was hoping to utilize the work of the utility rather than reinventing the wheel. 

inffile = 'c:\\windows\\temp\\secedit.inf'

secedit(['/export', '/cfg', inffile, '/quiet'])
inf = Puppet::Util::IniConfig::PhysicalFile.new(inffile).read

So the regex can't handle the awesomeness of windows files and I assume this affects all versions of puppet.

Corey Osman (JIRA)

unread,
Nov 17, 2016, 3:58:02 PM11/17/16
to puppe...@googlegroups.com
Corey Osman updated an issue
I was creating a windows provider that consumed a ini file.  I decided that I would use the Puppet::Util::IniConfig::PhysicalFile to parse my ini file however it seems one of the regex values is not able to parse my content.

# regex that has trouble with my ini content
https://github.com/puppetlabs/puppet/blob/master/lib/puppet/util/inifile.rb#L151

The content that breaks this is found here and I have highlighted the line where it breaks: https://gist.github.com/logicminds/1d4bea2d5ac0285e3417#file-gistfile1-txt-L34

At a glance I think just using the split function to capture the right and left side of the equal sign would work, but I am sure its more complicated than that as I don't have any other inclination of what goes into an ini file.

My provider code does something like this for reference and was hoping to utilize the work of the utility rather than reinventing the wheel. 

{code:ruby}
inffile = 'c:\\windows\\temp\\secedit.inf'

secedit(['/export', '/cfg', inffile, '/quiet'])
inf = Puppet::Util::IniConfig::PhysicalFile.new(inffile).read
{code}

So the regex can't handle the awesomeness of windows files and I assume this affects all versions of puppet.

Corey Osman (JIRA)

unread,
Nov 17, 2016, 3:59:02 PM11/17/16
to puppe...@googlegroups.com

Ethan Brown (JIRA)

unread,
Jan 4, 2017, 2:09:04 PM1/4/17
to puppe...@googlegroups.com
Ethan Brown commented on Bug PUP-4800

I think the regex should probably be changed to something like

^\s*(.*?)\s*\=(.*)$

See it in action at http://rubular.com/r/EkteQnnRiW

Geoff Nichols (JIRA)

unread,
Jan 23, 2017, 10:26:05 PM1/23/17
to puppe...@googlegroups.com
Geoff Nichols updated an issue
 
Change By: Geoff Nichols
Sprint: AP Grooming 2017-02-01

Geoff Nichols (JIRA)

unread,
Mar 1, 2017, 12:00:52 PM3/1/17
to puppe...@googlegroups.com

Geoff Nichols (JIRA)

unread,
Mar 1, 2017, 12:00:56 PM3/1/17
to puppe...@googlegroups.com

Geoff Nichols (JIRA)

unread,
Mar 1, 2017, 12:01:00 PM3/1/17
to puppe...@googlegroups.com

Geoff Nichols (JIRA)

unread,
Mar 8, 2017, 4:27:04 AM3/8/17
to puppe...@googlegroups.com
Geoff Nichols updated an issue
Change By: Geoff Nichols
Sprint: Agent Grooming  On-Deck

Geoff Nichols (JIRA)

unread,
Mar 15, 2017, 12:37:08 PM3/15/17
to puppe...@googlegroups.com

Geoff Nichols (JIRA)

unread,
Mar 22, 2017, 8:38:04 AM3/22/17
to puppe...@googlegroups.com

Geoff Nichols (JIRA)

unread,
Apr 5, 2017, 11:28:04 PM4/5/17
to puppe...@googlegroups.com
Geoff Nichols updated an issue
Change By: Geoff Nichols
Sprint: Agent Puppet 5  Grooming

Geoff Nichols (JIRA)

unread,
Apr 11, 2017, 4:42:02 PM4/11/17
to puppe...@googlegroups.com

Geoff Nichols (JIRA)

unread,
Apr 11, 2017, 4:42:04 PM4/11/17
to puppe...@googlegroups.com

Adrien Thebo (JIRA)

unread,
May 15, 2017, 3:09:03 PM5/15/17
to puppe...@googlegroups.com
Adrien Thebo updated an issue
Change By: Adrien Thebo
Labels: needs_repro  triaged  windows

Josh Cooper (Jira)

unread,
Mar 5, 2020, 3:27:03 AM3/5/20
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-4800
 
Re: Puppet::Util::IniConfig::PhysicalFile cannot parse file correctly

The IniConfig class is no longer used in puppet6 core, so I'm going to close this. If you want to parse inifiles in ruby, suggest using https://rubygems.org/gems/inifile.

This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages