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

FreeBSD Service definition not working with missing rc.conf definition

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Cannot Reproduce
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:
    • Template:

      Description

      TL;DR When no service definition exists on FreeBSD in /etc/rc.conf.d will result in this error:

      Error: /Stage[main]/Dovecot/Service[dovecot]: Could not evaluate: undefined method `gsub' for nil:NilClass


      ------

      Consider the following code:

      service { 'dovecot':
        ensure => running,
        name   => dovecot,
        enable => true,
      }

      The error happens whenever the `enable` parameter/directive (what's the convention here?) is given. The outcome being the same, whether the value is either `false` or `true`.

      This resulted in the following error:

      Error: /Stage[main]/Dovecot/Service[dovecot]: Could not evaluate: undefined method `gsub' for nil:NilClass
      /usr/local/lib/ruby/site_ruby/1.9/puppet/provider/service/freebsd.rb:26:in `rcvar'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/provider/service/freebsd.rb:52:in `rcvar_value'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/provider/service/freebsd.rb:113:in `enabled?'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/type/service.rb:56:in `retrieve'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/type.rb:1045:in `block in retrieve'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/type.rb:1040:in `each'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/type.rb:1040:in `retrieve'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/type.rb:1063:in `retrieve_resource'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/transaction/resource_harness.rb:223:in `from_resource'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/transaction/resource_harness.rb:17:in `evaluate'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/transaction.rb:174:in `apply'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/transaction.rb:187:in `eval_resource'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/transaction.rb:117:in `call'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/transaction.rb:117:in `block (2 levels) in evaluate'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/util.rb:327:in `block in thinmark'
      /usr/local/lib/ruby/1.9/benchmark.rb:295:in `realtime'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/util.rb:326:in `thinmark'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/transaction.rb:117:in `block in evaluate'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/graph/relationship_graph.rb:118:in `traverse'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/transaction.rb:108:in `evaluate'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/resource/catalog.rb:164:in `block in apply'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/util/log.rb:149:in `with_destination'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/transaction/report.rb:108:in `as_logging_destination'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/resource/catalog.rb:163:in `apply'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/configurer.rb:125:in `block in apply_catalog'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/util.rb:161:in `block in benchmark'
      /usr/local/lib/ruby/1.9/benchmark.rb:295:in `realtime'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/util.rb:160:in `benchmark'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/configurer.rb:124:in `apply_catalog'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/configurer.rb:192:in `run'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/agent.rb:44:in `block (4 levels) in run'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/agent/locker.rb:20:in `lock'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/agent.rb:44:in `block (3 levels) in run'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/agent.rb:114:in `with_client'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/agent.rb:41:in `block (2 levels) in run'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/agent.rb:79:in `run_in_fork'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/agent.rb:40:in `block in run'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/application.rb:179:in `call'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/application.rb:179:in `controlled_run'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/agent.rb:38:in `run'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/application/agent.rb:355:in `onetime'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/application/agent.rb:321:in `run_command'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/application.rb:364:in `block (2 levels) in run'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/application.rb:470:in `plugin_hook'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/application.rb:364:in `block in run'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/util.rb:478:in `exit_on_fail'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/application.rb:364:in `run'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/util/command_line.rb:137:in `run'
      /usr/local/lib/ruby/site_ruby/1.9/puppet/util/command_line.rb:91:in `execute'
      /usr/local/bin/puppet:4:in `<main>'

      Merely ensuring the file is present (empty) doesn't fix this issue. The following however prevents this issue from occuring:
      sudo echo '# Added by Puppet
      dovecot_enable="yes"' | sudo tee /etc/rc.conf.d/dovecot

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                Freeaqingme Dolf Schimmel
                Reporter:
                Freeaqingme Dolf Schimmel
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support