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

Improve error for 'No title provided and "foo" is not a valid resource reference'

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 4.10.0
    • Fix Version/s: PUP 5.5.1
    • Component/s: None
    • Labels:
      None
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      When relationships are formed between resources using an invalid resource reference the error message now includes a reference to the source location.
    • QA Risk Assessment:
      Needs Assessment

      Description

      Puppet Version: 5.3.3
      Puppet Server Version: N/A

      Upon creating some rspec-puppet tests for a new Puppet module, the following error was encountered:

      1) actora on centos-7-x86_64 with defaults should compile into a catalogue without dependency cycles
      Failure/Error: it { should compile }
      error during compilation: No title provided and "actora" is not a valid resource reference on node lt0772.local
      

      As there was no traceback to a specific file/line provided, this one proved challenging to track down. 

      In the end, the following code was at fault:

      ## install actora rpm (which should install nodejs and npm)
      package { $actora::package_name:
        ensure => $actora::version,
        notify => $actora::service_name,
        tag => ['actora::package']
      }
      

      The notify here resolves to 'actora'.

      A simple reproducer is:

      $ cat foo/manifests/init.pp
      class foo () {
        notify { 'testing':
          notify => xyz,
        }
      }
      $ puppet apply -t --exec 'include foo'
      Info: Loading facts
      Error: No title provided and "xyz" is not a valid resource reference on node host.example.net

      Thanks to Johnson Earls for the reproducer.

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              fatmcgav Gavin Williams
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support