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

Provide a way to distinguish environment resources from node resources during compilation



    • Type: Task
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 4.3.0
    • Component/s: None
    • Labels:
    • Template:
    • Story Points:
    • Sprint:
      Language 2015-09-16, Language 2015-09-30
    • Release Notes:
      Not Needed
    • Release Notes Summary:
      Part of new feature


      Problem statement

      Because the environment compiler and the node compiler have different rules about what kind of code is allowed, they should have separate site manifests. The site manifest for nodes can have resources declared that are applied to all nodes; if the environment compiler looks in the same manifests, it needs to understand that those kinds of resources may appear and need to be ignored (currently they will cause failures). Similarly, application resources are declared at topscope (ie. outside any definition) and are currently explicitly ignored by the node compiler.

      Possible solution (discarded):
      Splitting site manifests between environment and node compilation simplifies these issues, since each compiler can simply always consider unexpected resources to be errors. It also means that compilation follows a similar flow for each compiler: parse and evaluate everything in the site dir, then recursively evaluate any resource declarations (including external nodes and applications).

      Solution based on discussion between Ryan Coleman, Melinda Campbell and David Lutterkort:

      We will continue to use site.pp for everything it can do today, and we will introduce the new keyword site as a grouping construct, which behaves as follows:

      # When you want the orchestrator to do things, stick them inside this container, 
      # which is declared at the top scope of site.pp. It cannot be named (like a node resource), 
      # does not allow conditionals, and may not be placed inside any expressions. This container
      # can only appear once in an environment, in a single file.
      # Code in the site declaration will be evaluated as the entry point to environment catalog
      # compilation, and all other code in $manifest will be ignored.
      # The node compiler will also evaluate the site declaration, in addition to its normal evaluation,
      # in order to determine which applications/components the given node is mapped to.
      site {
        # This container can contain the following things:
        # Non-host resources (APPMGMT-620)
        ec2_instance { 'blërg':
          size => 'whatever',
        # Arbitarily ordered nodes (APPMGMT-772)
        Node['node1.example.com'] -> Node['node2.example.com']
        # Instances of application models (APPMGMT-10)
        demo { 'site':
          demos      => $app_instances,
          grouping   => 'monitoring_host',
          nodes => {
            Node['jdseokennpihde3.delivery.puppetlabs.net'] => [ Demo::App['Production'] ],


          Issue Links



              nick Nick Lewis
              0 Vote for this issue
              8 Start watching this issue



                  Zendesk Support