Ask Your Question
0

Puppet variable contains dot (.)

asked 2016-02-12 17:22:52 -0500

aranibasu gravatar image

updated 2016-02-13 20:09:17 -0500

Hi,

I am unable to get a clean puppet parser validate or puppet-lint for the below line in my manifest:

$oozie_db_url        = 'jdbc:derby:${oozie.data.dir}/${oozie.db.schema.name}-db;create=true'

When I do a puppet-lint it comes back with below error:

ERROR: single quoted string containing a variable found

If I change the single-quotes to double quotes, I get the below error from puppet parser validation:

Error: Could not parse for environment production: Syntax error at '.'; expected '}' at /home........

This error is explained in this link: https://docs.puppetlabs.com/guides/tr...

Just to give a bit of context, this manifest was written long time back when puppet did not have such strict linting. However, when I tried modifying a small bit of it, puppet-linting is giving me the above problem. Any help is welcome.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-02-13 19:34:37 -0500

updated 2016-02-13 19:36:42 -0500

Well from the documentation:

Variable names begin with a $ (dollar sign) and are case-sensitive.

Most variable names must start with a lowercase letter or an underscore. The exception is regex capture variables, which are named with only numbers.

Variable names can include:

  • Uppercase and lowercase letters
  • Numbers
  • Underscores (_)

If the first character is an underscore, that variable should only be accessed from its own local scope; using qualified variable names where any namespace segment begins with _ is deprecated.

If you try to use dots in a variable name, you will also get that syntax error.

Also, you are correct to use double quotes there.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-02-12 17:22:52 -0500

Seen: 179 times

Last updated: Feb 13 '16