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

put warn/error for attempt to instantiate virtual class under --strict control

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 2.7.25, PUP 3.7.3
    • Fix Version/s: PUP 4.10.2
    • Component/s: Language
    • Labels:
    • Template:
    • Team:
      Puppet Developer Experience
    • Sprint:
      PDE 2017-05-31
    • Release Notes:
      Deprecation
    • Release Notes Summary:
      Hide
      Attempts to use {{@class}} or {{@@class}} to create virtual or exported classes were earlier silently ignored. The attempted use is now either a warning or an error depending on the level set for {{\--strict}}. In a future major release it will be an error to combine virtual/exported with a class.
      Show
      Attempts to use {{@class}} or {{@@class}} to create virtual or exported classes were earlier silently ignored. The attempted use is now either a warning or an error depending on the level set for {{\--strict}}. In a future major release it will be an error to combine virtual/exported with a class.
    • QA Risk Assessment:
      No Action

      Description

      Declaring a virtual class should not instantiate it without being realized. This worked in puppet 2.6.1 but is broken in 2.6.7. I also tried it in 2.7.9 and it still seems to be broken. The code below is a very simple example. vclass and the notify should not happen because it is not realized.

      class vclass {
          notify {"vclass":
              message => "I've been realized"
          }
      }
       
      class iclass {
          @class {"vclass": }
      }
       
      class {"iclass":}
      

      Puppet 2.7.9 output:

      puppet apply --debug iclass.pp
      debug: importing '/root/iclass.pp' in environment production
      debug: Creating default schedules
      debug: Failed to load library 'selinux' for feature 'selinux'
      debug: Failed to load library 'shadow' for feature 'libshadow'
      debug: Puppet::Type::User::ProviderDirectoryservice: file /usr/bin/dscl does not exist
      debug: Puppet::Type::User::ProviderUser_role_add: file roleadd does not exist
      debug: Failed to load library 'ldap' for feature 'ldap'
      debug: Puppet::Type::User::ProviderLdap: feature ldap is missing
      debug: Puppet::Type::User::ProviderPw: file pw does not exist
      debug: /File[/etc/puppet/ssl/public_keys]: Autorequiring File[/etc/puppet/ssl]
      debug: /File[/etc/puppet/ssl/certificate_requests]: Autorequiring File[/etc/puppet/ssl]
      debug: /File[/var/lib/puppet/state/state.yaml]: Autorequiring File[/var/lib/puppet/state]
      debug: /File[/var/lib/puppet/clientbucket]: Autorequiring File[/var/lib/puppet]
      debug: /File[/var/lib/puppet/state/last_run_report.yaml]: Autorequiring File[/var/lib/puppet/state]
      debug: /File[/var/lib/puppet/run]: Autorequiring File[/var/lib/puppet]
      debug: /File[/etc/puppet/ssl/private_keys]: Autorequiring File[/etc/puppet/ssl]
      debug: /File[/var/lib/puppet/state/graphs]: Autorequiring File[/var/lib/puppet/state]
      debug: /File[/var/lib/puppet/client_data]: Autorequiring File[/var/lib/puppet]
      debug: /File[/var/lib/puppet/log]: Autorequiring File[/var/lib/puppet]
      debug: /File[/etc/puppet/ssl]: Autorequiring File[/etc/puppet]
      debug: /File[/etc/puppet/ssl/private]: Autorequiring File[/etc/puppet/ssl]
      debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet]
      debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/puppet]
      debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/puppet]
      debug: /File[/var/lib/puppet/state/last_run_summary.yaml]: Autorequiring File[/var/lib/puppet/state]
      debug: /File[/var/lib/puppet/client_yaml]: Autorequiring File[/var/lib/puppet]
      debug: /File[/etc/puppet/ssl/certs]: Autorequiring File[/etc/puppet/ssl]
      debug: Finishing transaction 23948234472800
      debug: Loaded state in 0.00 seconds
      debug: Loaded state in 0.00 seconds
      info: Applying configuration version '1327691293'
      debug: /Schedule[daily]: Skipping device resources because running on a host
      debug: /Schedule[monthly]: Skipping device resources because running on a host
      notice: I've been realized
      notice: /Notify[vclass]/message: defined 'message' as 'I've been realized'
      debug: /Schedule[hourly]: Skipping device resources because running on a host
      debug: /Schedule[never]: Skipping device resources because running on a host
      debug: /Schedule[weekly]: Skipping device resources because running on a host
      debug: /Schedule[puppet]: Skipping device resources because running on a host
      debug: Finishing transaction 23948233321400
      debug: Storing state
      debug: Stored state in 0.00 seconds
      notice: Finished catalog run in 0.03 seconds
      debug: Finishing transaction 23948233059620
      

      Puppet 2.6.1:

      puppet apply --debug iclass.pp
      debug: Creating default schedules
      debug: Failed to load library 'selinux' for feature 'selinux'
      debug: Puppet::Type::File::ProviderMicrosoft_windows: feature microsoft_windows is missing
      debug: Failed to load library 'ldap' for feature 'ldap'
      debug: /File[/home/keibaker/.puppet/ssl/private_keys]: Autorequiring File[/home/keibaker/.puppet/ssl]
      debug: /File[/home/keibaker/.puppet/ssl/public_keys]: Autorequiring File[/home/keibaker/.puppet/ssl]
      debug: /File[/home/keibaker/.puppet/ssl]: Autorequiring File[/home/keibaker/.puppet]
      debug: /File[/home/keibaker/.puppet/var/log]: Autorequiring File[/home/keibaker/.puppet/var]
      debug: /File[/home/keibaker/.puppet/var]: Autorequiring File[/home/keibaker/.puppet]
      debug: /File[/home/keibaker/.puppet/var/state/graphs]: Autorequiring File[/home/keibaker/.puppet/var/state]
      debug: /File[/home/keibaker/.puppet/ssl/certificate_requests]: Autorequiring File[/home/keibaker/.puppet/ssl]
      debug: /File[/home/keibaker/.puppet/var/clientbucket]: Autorequiring File[/home/keibaker/.puppet/var]
      debug: /File[/home/keibaker/.puppet/var/client_data]: Autorequiring File[/home/keibaker/.puppet/var]
      debug: /File[/home/keibaker/.puppet/var/client_yaml]: Autorequiring File[/home/keibaker/.puppet/var]
      debug: /File[/home/keibaker/.puppet/var/facts]: Autorequiring File[/home/keibaker/.puppet/var]
      debug: /File[/home/keibaker/.puppet/var/lib]: Autorequiring File[/home/keibaker/.puppet/var]
      debug: /File[/home/keibaker/.puppet/var/run]: Autorequiring File[/home/keibaker/.puppet/var]
      debug: /File[/home/keibaker/.puppet/ssl/certs]: Autorequiring File[/home/keibaker/.puppet/ssl]
      debug: /File[/home/keibaker/.puppet/var/state/state.yaml]: Autorequiring File[/home/keibaker/.puppet/var/state]
      debug: /File[/home/keibaker/.puppet/ssl/private]: Autorequiring File[/home/keibaker/.puppet/ssl]
      debug: /File[/home/keibaker/.puppet/var/state]: Autorequiring File[/home/keibaker/.puppet/var]
      debug: Finishing transaction 70277340166120
      debug: Loaded state in 0.02 seconds
      info: Applying configuration version '1327691483'
      debug: Finishing transaction 70277340695320
      debug: Storing state
      debug: Stored state in 0.01 seconds
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              redmine.exporter redmine.exporter
              QA Contact:
              Kurt Wall
              Votes:
              1 Vote for this issue
              Watchers:
              13 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support