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

Resource collection can't be done on Abstract Resources

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Needs Information
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Compiler
    • Labels:
      None
    • Template:
      PUP Bug Template
    • Sub-team:
    • Team:
      Froyo
    • Method Found:
      Needs Assessment
    • QA Risk 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

            Assignee:
            Unassigned
            Reporter:
            LongLiveCHIEF Brian Vanderbusch
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Zendesk Support