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

environment_timeout in puppet.conf not honored if environmentpath does not exist at startup

    Details

    • Type: Bug
    • Status: Accepted
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: PUP 4.0.0, PUP 4.1.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • CS Priority:
      Minor
    • CS Frequency:
      1 - 1-5% of Customers
    • CS Severity:
      2 - Annoyance
    • CS Impact:
      Having no {{environmentpath}} seems like a situation that is unlikely to arise in production. The remediation for this is also pretty simple: restart the puppet master after fixing the missing directory.

      Description

      If environmentpath does not exist when the Puppet Master is started, environment_timeout in puppet.conf has no effect. e.g. Running with environment_timeout = 1y in puppet.conf still exhibits the default behavior of not caching environments (environment_timeout = 0).

      Here are steps to reproduce; I've used Puppet Server for this, but I'm reasonably certain the problem is in Puppet itself, not Puppet Server, and I'd expect the same behavior in any other type of Puppet master.

      #1 - Delete environmentpath

      rm -rf /etc/puppetlabs/code/environments
      

      #1.5 Give the puppet user ownership of codedir. (side note - shouldn't packaging be doing this? All of these directories are owned by root post-install. Seems weird.)

      chown -R puppet:puppet /etc/puppetlabs/code
      

      #2 - Set environment_timeout in puppet.conf

      echo "environment_timeout = 1y" >> /etc/puppetlabs/puppet/puppet.conf
      

      #3 - Start Puppet Server

      #4 - Run the agent. This should cache the environment, since we have the cache TTL set to 1 year in puppet.conf.

      #5 - Re-create environmentpath and a manifests subdirectory for the production environment, and write a site.pp.

      mkdir -p /etc/puppetlabs/code/environments/production/manifests
      echo "node default { notify {'hello world': } }" >> /etc/puppetlabs/code/environments/production/manifests/site.pp
      

      #6 - Run the agent again. Observe that the "hello world" resource shows-up - this is incorrect, since the environment should not have been refreshed.

      Notice: hello world

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              kevin.corcoran Kevin Corcoran
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:

                Zendesk Support