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

create_resources() doesn't include the file or line reference in resources it creates

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • PUP 4.5.2
    • PUP 4.6.0
    • Language
    • None
    • Tested on CentOS 6.8 with PE 2016.2.0

    • Hide

      That file and line information taken from the file/line where the call to create_resources is made is used for the file/line attributes of all resources created by the call.

      Show
      That file and line information taken from the file/line where the call to create_resources is made is used for the file/line attributes of all resources created by the call.
    • 1
    • Language 2016-08-10, Language 2016-08-24
    • Bug Fix
    • Hide
      When creating resources using the `create_resources` function there were no file and line information included in the resulting catalog for the resources created by the function. This is now fixed and this will improve downstream tooling that requires such information.
      Show
      When creating resources using the `create_resources` function there were no file and line information included in the resulting catalog for the resources created by the function. This is now fixed and this will improve downstream tooling that requires such information.

    Description

      Given the following Puppet code:

      class system::hashadmins {
        require mysql::server
        ## Defaults
        Mysql_user {
          ensure               => present,
          max_queries_per_hour => 700,
        }
        ## User Data
        $users = {
          'monica@localhost' => {},
          'brad@localhost'   => {},
          'luke@localhost'   => {},
          'zack@localhost'   => {
            'max_queries_per_hour' => 1300,
          },
          'ralph@localhost'  => {
            'ensure' => 'absent',
          }
        }
        ## Call the function
        create_resources('mysql_user', $users)
      }
      

      ...the resources that are queried look like this coming out of PuppetDB:

      {
              "certname": "gary.puppetlabs.vm",
              "environment": "gary",
              "exported": false,
              "file": null,
              "line": null,
              "parameters": {
                  "ensure": "present",
                  "max_queries_per_hour": 1300
              },
              "resource": "964a8bb11e504402830b17f2818b2a848b5fe4ae",
              "tags": [
                  "class",
                  "system::hashadmins",
                  "hashadmins",
                  "system",
                  "mysql_user",
                  "default",
                  "node"
              ],
              "title": "zack@localhost",
              "type": "Mysql_user"
          }
      

      You'll note that the line and file keys are null. This causes issues down the line with coverage reports like the issue that was posted here --> https://github.com/rodjek/rspec-puppet/issues/364

      Attachments

        Issue Links

          Activity

            People

              phong Phong Ly
              gary Gary Larizza
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support