Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-6480

Error Message Is Unclear When Forgetting To Capitalize a reference to a resource type

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 4.5.2
    • Fix Version/s: PUP 4.8.0
    • Component/s: None
    • Labels:
    • Template:
    • Acceptance Criteria:
      Hide

      When an attempt is made to get a character from a string using a non numeric index (for example user[dba]), the error message should state that it fails because 'dba' is not a numeric index value required to get a character from the string 'user'.

      Show
      When an attempt is made to get a character from a string using a non numeric index (for example user[dba] ), the error message should state that it fails because 'dba' is not a numeric index value required to get a character from the string 'user'.
    • Story Points:
      1
    • Sprint:
      Language 2016-09-07

      Description

      The Problem

      Try the following code and see the non-specific error it provides.

      [root@puppet-master-201620 ~]# cat /tmp/test.pp
      @group { 'dba':
        ensure => 'present',
        gid   => 102,
        #noop => true,
      }
      realize(group['dba'])
       
      [root@puppet-master-201620 ~]# puppet apply /tmp/test.pp
      Error: Evaluation Error: The value 'dba' cannot be converted to Numeric. at /tmp/test.pp:8:15 on node puppet-master-201620
      

      The correct code will capitalize group inside of the realize function.

      realize(Group['dba'])
      

      Suggested Improvement

      The error message should provide more context as to what the problem is. The error message is saying it's trying to access the 'dba'th character in the string group and dba isn't numeric but that is not very clear to the average user.

      In fact I didn't realize it was treating group as a string and trying to access a character in it when reading the message and Henrik Lindberg had to explain it to me.

        Attachments

          Activity

            People

            • Assignee:
              phong Phong Ly
              Reporter:
              nick.walker Nick Walker
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support