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

Resources type unless_uid exhibits bad behavior

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Cannot Reproduce
    • Affects Version/s: PUP 3.6.2
    • Fix Version/s: None
    • Component/s: Types and Providers
    • Labels:
      None
    • Template:

      Description

      The unless_uid tag in the resources type exhibits incorrect behavior.

      First, it seems to not apply unless the "unless_system_user" is set. This is due to check here:

       # Make sure we don't purge users with specific uids
        def user_check(resource)
          return true unless self[:name] == "user"
          return true unless self[:unless_system_user]
      

      Second, it seems to not work correctly in cases of arrays of integers. A manifest such as this fails to properly execute:

      resources { 'user':
              purge      => true,
                         unless_uid =>  [0,1,2,3,4,5,6,7,8,10,11,12,13,14,99,81,69,173,68,38,499,89,74,72,32,29,52,498,65534],
                         unless_system_user => 1,
                         noop => true,
      }
      

      This will try to remove the users in the list. The issue seems to be that the numbers aren't being compared as integers in the resource. Adding to_i to the end of both current_uid and unless_uid in the comparison fixes the issue, but there may be a better way to do it.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            jslagle Jason Slagle
            QA Contact:
            Kurt Wall
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support