Forge Home

resources_deep_merge

provides a function deep-merges every memeber of one hash1 with hash2

11,202 downloads

10,993 latest version

3.8 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.9.1 (latest)
  • 0.9.0
released Sep 3rd 2014

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'brainsware-resources_deep_merge', '0.9.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add brainsware-resources_deep_merge
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install brainsware-resources_deep_merge --version 0.9.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

brainsware/resources_deep_merge — version 0.9.1 Sep 3rd 2014

####Table of Contents

  1. Overview
  2. Setup - The basics of getting started with resources_deep_merge
  3. Usage - Configuration options and additional functionality
  4. Limitations - OS compatibility, etc.
  5. Development - Guide for contributing to the module

##Overview

This module provides the function resources_deep_merge. It's based on stdlib deep_merge() function. Its intended use to provide hashes, such as those passed to create_resources() with default values.

##Setup

 % puppet module install brainsware-resources_deep_merge

##Usage

resources_deep_merge

Returns a deep-merged resource hash (hash of hashes).

Examples:

    $tcresource_defaults = {
      ensure     => 'present',
      attributes => {
        driverClassName => 'org.postgresql.Driver',
      }
    }

    $tcresources = {
      'app1:jdbc/db1' => {
        attributes => {
          url      => 'jdbc:postgresql://localhost:5432/db1',
          userpass => 'user1:pass1',
        },
      },
      'app2:jdbc/db2' => {
        attributes => {
          url      => 'jdbc:postgresql://localhost:5432/db2',
          userpass => 'user2:pass2',
        },
      }
    }

When called as:

    $result = resources_deep_merge($tcresources, $tcresource_defaults)

will return:

    {
     'app1:jdbc/db1' => {
       ensure     => 'present',
       attributes => {
         url      => 'jdbc:postgresql://localhost:5432/db1',
         userpass => 'user1:pass1',
         driverClassName => 'org.postgresql.Driver',
       },
     },
     'app2:jdbc/db2' => {
       ensure     => 'present',
       attributes => {
         url      => 'jdbc:postgresql://localhost:5432/db2',
         userpass => 'user2:pass2',
         driverClassName => 'org.postgresql.Driver',
       },
     }
    }
  • Type: rvalue

##Limitations

This module requires puppetlabs-stdlib >=3.2.1, which is when deep_merge() was introduced.

##Development

This module uses blacksmith for releasing and rspec for tests. All contributions are highly welcome, especially if they include documentation and tests.