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

Tags should issue an error when they are invalid

    Details

    • Type: Bug
    • Status: Accepted
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: PUP 2.7.23, PUP 3.4.3, PUP 3.5.1
    • Fix Version/s: None
    • Component/s: Compiler
    • Labels:
      None
    • Template:
    • Epic Link:
    • Team:
      Coremunity

      Description

      The docs ( http://docs.puppetlabs.com/puppet/3/reference/lang_reserved.html#tags ) state ( emphasis added) that tags names should confirm to

      \A[a-z0-9_][a-z0-9_:\.\-]*\Z

      and also:

      Tags must begin with a lowercase letter, number, or underscore, and can include:

      • Lowercase letters
      • Numbers
      • Underscores
      • Colons
      • Periods
      • Hyphens

      Tags with illegal characters ( such as ^ or # ) cause an error in a tag => block.

      However, tags entered in all caps or with uppercase letters have those letters silently converted to lowercase when the tag is set, but not when the tag is collected.

      Additionally, if you try to collect a tag that has illegal characters, no error is generated.

      [root@pe-321-master ~]# cat resource_collect.pp
      @notify {
        'tags are fun':
          tag => ['foo'];
        'this is really fun':
          tag => ['BAR', 'foo'];
        'wheeeeee':
          tag => ['FOO'];
      #  '8909'
      #    tag => ['fo#o'];
      }
       
      Notify <| tag == 'FOO' |>
      Notify <| tag == 'foo' and tag == 'BAR' |>
      Notify <| tag == 'foo' and tag == 'bar' |>
      Notify <| tag == '^foo' |>
      Notify <| tag == 'f^oo' |>
      Notify <| tag == 'fo#o' |>
      [root@pe-321-master ~]# /usr/local/bin/puppet apply resource_collect.pp
      Notice: Compiled catalog for pe-321-master.puppetdebug.vlan in environment production in 0.09 seconds
      Notice: this is really fun
      Notice: /Stage[main]/Main/Notify[this is really fun]/message: defined 'message' as 'this is really fun'
      Notice: Finished catalog run in 0.39 seconds
      

      I suspect that this will also impact exported resources, tagmail, and the usage of tags to restrict catalog runs, but have not investigated those aspects yet.

      There may also be similar handling fo tags in PuppetDB, but that also has not (yet) been investigated.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              lee Lee Lowder
              QA Contact:
              Kurt Wall
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:

                Zendesk Support