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

Resource collection can't be done on Abstract Resources

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Won't Fix
    • None
    • None
    • Compiler
    • None
    • Froyo
    • Needs Assessment
    • Needs Assessment

    Description

      It is currently not possible to collect resources using an abstract resource collector.  There are two way that you can attempt to collect an abstract resource, and they both fail with compiler errors:

      ```
      Resource[$type] <| tag == 'some_tag' |> -> Package['some_package']
      ```
      This fails with a syntax error `Could not parse for environment root: Illegal expression. A '[]' expression is unacceptable as type name in a Virtual Query`.

      I also tried:

      ```
      Resource <| tag == 'some_tag' |> -> Package['some_package']
      ```

      This causes an error: 

      ```
      Puppet::PreformattedError:
      Evaluation Error: Error while evaluating a Virtual Query, Resource type resource doesn't exist
      ```

      The example code I used that prompted this finding is here:

      class gitlab::omnibus_package_repository (
        Hash $repository_configuration,
        Boolean $manage_omnibus_repository,
      ) {
        if $manage_omnibus_repository {
          $repository_configuration.each() | String $resource_type, Hash $resources | {
            create_resources($resource_type, $resources, {tag => 'gitlab_omnibus_repository_resource'})
          }
       
          # ensure all repository configuration are in place before the gitlab omnibus package is installed
          Resource <| tag == 'gitlab_omnibus_repository_resource' |> -> Package['gitlab-omnibus']
        }
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            LongLiveCHIEF Brian Vanderbusch
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support