Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

puppet does not conform to the naming rule

This is the piece of the puppet script i am not able to understand why this error is happening. can any one please help with this.

  if $facts['hostname'] =~ /^acmetest[0-9][0-9][0-9]+/  {
       exec {
        'ExecuteAcme':
        alias       => 'ExecuteAcme',
        command     => '/usr/sbin/lspci|grep -i nvidia',
        refreshonly => true,
      }

    if $ExecuteAcme =~ /controller: NVIDIA Corporation/ {
      class { 'install_acme': }
    }
  }


Error :

Error: Could not parse for environment production: Illegal variable name, The given name 'ExecuteAcme' does not conform to the naming rule /^((::)?[a-z]\w*)*((::)?[a-z_]\w*)$/
pdk (ERROR): puppet-syntax: Could not parse for environment production:
        Illegal variable name, The given name 'ExecuteAcme' does not
        conform to the naming rule /^((::)?[a-z]\w*)*((::)?[a-z_]\w*)$/
        (manifests/example_acme.pp:72:8)

When i check online using regexp validator it works fine .. using string name = 13:00.0 3D controller: NVIDIA Corporation GA100 [A100 PCIe 80GB] (rev a1) and regexp = /controller: NVIDIA Corporation/

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The Puppet compiler error is throwing on the variable name of ExecuteAcme. It fails the regular expression described in the error message. This is specifically due to the capitalization of the variable. This can be most easily fixed with:

if $executeAcme =~ /controller: NVIDIA Corporation/ {

and similarly anywhere else the illegal name is used. Note that the easiest fix is to camelCase, but that normal Puppet convention is for snake case, so you may want to go a bit further anyway:

if $execute_acme =~ /controller: NVIDIA Corporation/ {
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading