Skip to content

Conversation

pulecp
Copy link

@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 <[email protected]>
@pulecp
Copy link
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
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
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
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

@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