Jira (PUP-10824) puppet strings generate: Syntax error at 'apply'

5 views
Skip to first unread message

Florent (Jira)

unread,
Dec 16, 2020, 8:12:03 AM12/16/20
to puppe...@googlegroups.com
Florent created an issue
 
Puppet / Bug PUP-10824
puppet strings generate: Syntax error at 'apply'
Issue Type: Bug Bug
Affects Versions: PUP 6.19.1
Assignee: Unassigned
Created: 2020/12/16 5:11 AM
Priority: Normal Normal
Reporter: Florent

Puppet Version: 6.19.1
Puppet Server Version: 6.19.1
OS Name/Version: Debian 10

Since Puppet 6 (no problem with Puppet 5), when generating documentation with "puppet strings generate" with code like this :

 

icinga2::object::service { 'ssh':
 target => '/etc/icinga2/conf.d/file.conf',
 apply => true,
 display_name => 'SSH',
 check_command => 'ssh',
 }

 

I have this error: Failed to parse file.pp: Syntax error at 'apply'

If I change apply to anything else, it works.

Desired Behavior:

Documentation should be genereated with code like this that contain "apply".

Actual Behavior:

[error]: Failed to parse modules/my_module/manifests/file.pp: Syntax error at 'apply'

 

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

Ben Ford (Jira)

unread,
Dec 17, 2020, 1:12:04 PM12/17/20
to puppe...@googlegroups.com
Ben Ford commented on Bug PUP-10824
 
Re: puppet strings generate: Syntax error at 'apply'

This is being corrected in https://github.com/puppetlabs/puppet-strings/pull/266

Josh Cooper interestingly, tests reveal that the apply behaves differently from other keywords in Puppet itself. My assumption was that with tasks=true that the parser was failing because a keyword was being used as a parameter name. That implies that any keyword should fail similarly, but I tested with if, class, function, case and others. None of them caused a syntax error.

Josh Cooper (Jira)

unread,
Dec 17, 2020, 1:57:03 PM12/17/20
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-10824

The logic that controls it is in https://github.com/puppetlabs/puppet/blob/ef4f356d005c8cd278124db7afe5986720c52b60/lib/puppet/pops/parser/lexer2.rb#L672. When Puppet[:tasks] = true, the lexer will recognize apply as a token, but then apply => true does not conform to puppet's grammar for the apply keyword (https://github.com/puppetlabs/puppet/blob/ef4f356d005c8cd278124db7afe5986720c52b60/lib/puppet/pops/parser/egrammar.ra#L529-L537), so you get a syntax error.

Josh Cooper (Jira)

unread,
Dec 17, 2020, 1:58:04 PM12/17/20
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-10824

I'm going to close this as a dup, as the fix for this is in the strings module.

Reply all
Reply to author
Forward
0 new messages