Uploaded image for project: 'Modules'
  1. Modules
  2. MODULES-8695

scheduled_task: Module uses keyword arguments, breaking Server 5.x catalog compilation



    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • None
    • scheduled_task
    • Needs Assessment
    • 33189
    • 1
    • Needs Assessment


      Basic Info
      Module Version: 1.0.0
      Puppet Version: Server 5.x and later
      OS Name/Version: N/A

      Desired Behavior:

      Using types from puppetlabs-scheduled_task succeeds when running Puppet Server 5.x.

      Actual Behavior:

      Catalog compilation fails with a "syntax error, unexpected tLABEL" error.

      Customer running PE 2016.4.3:

      2019-01-03 04:26:04,407 ERROR [qtp558044898-167070] [puppetserver] Puppet Could not autoload puppet/type/scheduled_task: Could not autoload puppet/provider/scheduled_task/taskscheduler_api2: /etc/puppetlabs/code/environments/common_testint/modules/scheduled_task/lib/puppet_x/puppetlabs/scheduled_task/task.rb:391: syntax error, unexpected tLABEL
      def default_action(create_if_missing: false)
      # ruby -c task.rb
      # ^ this will work, but running through puppetserver (jruby) results in the error:
      # puppetserver ruby -c task.rb
      SyntaxError in task.rb:391: syntax error, unexpected tLABEL
      def default_action(create_if_missing: false)


      A similar problem will occur when puppetserver 5.x tries to compile a catalog with a scheduled_task resource, because puppetserver 5.x contains JRuby 1.7, but it is only compatible with MRI Ruby 1.9.3 language features.

      The scheduled task needs to not use keyword arguments so that it can be used with puppet-agent 1.10.x and puppetserver 5.x.


      I'd strongly recommend we fix the issue in the module, as there are plenty of opensource users on Puppet5 that could run into this issue. The module metadata also claims to support Puppet >= 4.9 which is not strictly true.


      Prior to Puppet6, the scheduled task type and provider were in core puppet, and it called Windows task scheduler v1 API (supported on 2003 and up). The module supports the task scheduler v2 API (available in 2008 and up, maybe Vista too). In Puppet 6, we extracted the the T&P from core puppet and moved it into the module. I expect you'll only see this issue for customers that explicitly install the scheduled_task module, and are running on a Puppet infrastructure that still uses JRuby 1.7.

      This also affects puppet generate types when using the module in a Ruby 1.9.3 environment:

      $ rbenv install 1.9.3-p551
      $ bundle install --path .bundle
      $ bundle exec puppet module install puppetlabs/scheduled_task
      $ bundle exec puppet generate types
      Warning: Support for ruby version 1.9.3 is deprecated and will be removed in a future release. See https://docs.puppet.com/puppet/latest/system_requirements.html#ruby for a list of supported ruby versions.
         (at /Users/josh/work/puppet/lib/puppet.rb:180:in `<module:Puppet>')
      Notice: Generating Puppet resource types.
      Error: Could not autoload puppet/provider/scheduled_task/taskscheduler_api2: /Users/josh/.puppetlabs/etc/code/environments/production/modules/scheduled_task/lib/puppet_x/puppetlabs/scheduled_task/task.rb:391: syntax error, unexpected tLABEL, expecting ')'
        def default_action(create_if_missing: false)


        Issue Links



              Unassigned Unassigned
              garrett.guillotte Garrett Guillotte
              0 Vote for this issue
              7 Start watching this issue



                Zendesk Support