resources_deep_merge

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

Brainsware

brainsware

9,872 downloads

9,750 latest version

3.8 quality score

Version information

  • 0.9.1 (latest)
  • 0.9.0
released Jul 3rd 2019

Start using this module

Documentation

brainsware/resources_deep_merge — version 0.9.1 Jul 3rd 2019

####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.