Skip to content

fix lib/puppet/parser/functions/fqdn_rand_string.rb:21: syntax error#1029

Merged
tphoney merged 1 commit intopuppetlabs:masterfrom
pulecp:fqdn_rand_string_syntax_error
Jul 24, 2019
Merged

fix lib/puppet/parser/functions/fqdn_rand_string.rb:21: syntax error#1029
tphoney merged 1 commit intopuppetlabs:masterfrom
pulecp:fqdn_rand_string_syntax_error

Conversation

@pulecp
Copy link
Copy Markdown

@pulecp pulecp commented Jun 14, 2019

stdlib/lib/puppet/parser/functions/fqdn_rand_string.rb:21: syntax error, unexpected null
    fqdn_rand_string(10, 'ABCDEF!@#$%^')
                                   ^

stdlib/lib/puppet/parser/functions/fqdn_rand_string.rb:21: syntax error, unexpected null
    fqdn_rand_string(10, 'ABCDEF!@#$%^')
                                    ^

Signed-off-by: Pavel Pulec <kayn@inuits.eu>
@pulecp
Copy link
Copy Markdown
Author

pulecp commented Jun 14, 2019

centos 7
puppetserver version: 5.3.8
puppet version: 5.5.14

@pulecp pulecp changed the title fix syntax error fix lib/puppet/parser/functions/fqdn_rand_string.rb:21: syntax error Jun 14, 2019
@tphoney tphoney added the bugfix label Jul 23, 2019
@tphoney
Copy link
Copy Markdown
Contributor

tphoney commented Jul 23, 2019

Hi @pulecp how were you triggering this error ? it was unclear if it was a linting check or it was hit using puppet code. Should we add a test for it.

Almost forgot to say, many thanks for the PR !!! Great work 👍

@pulecp
Copy link
Copy Markdown
Author

pulecp commented Jul 23, 2019

Hey @tphoney. I'm using letsencrypt module from voxpupuli which is using fqdn_rand_string in letsencrypt::certonly https://github.com/voxpupuli/puppet-letsencrypt/blob/master/manifests/certonly.pp#L73.

The issue occurs during common puppet run:

[root@server ~]# puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, Could not autoload puppet/parser/functions/fqdn_rand_string: /etc/puppetlabs/code/environments/production/modules/upstream/stdlib/lib/puppet/parser/functions/fqdn_rand_string.rb:21: syntax error, unexpected null
    fqdn_rand_string(10, 'ABCDEF!@#$%^')
                                    ^ (file: /etc/puppetlabs/code/environments/production/modules/upstream/letsencrypt/manifests/certonly.pp, line: 57, column: 83) (file: /etc/puppetlabs/code/environments/production/modules/internal/profile_apache/manifests/vhosts.pp, line: 38) on node server.example.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

@tphoney
Copy link
Copy Markdown
Contributor

tphoney commented Jul 24, 2019

Wow thanks for the info ! merging to master.

Great work !

@tphoney tphoney merged commit 98c88ec into puppetlabs:master Jul 24, 2019
Copy link
Copy Markdown

@cederlys cederlys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm late to the show, but wouldn't a better fix have been to use -'DOC' instead of -DOC, so that interpolation and escaping is disabled in the heredoc? See https://ruby-doc.org/core-2.5.0/doc/syntax/literals_rdoc.html#label-Here+Documents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants