Forge Home

property_list_key

Property List key/value management in Puppet on OS X

13,942 downloads

12,251 latest version

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

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

Version information

  • 0.2.1 (latest)
  • 0.2.0
  • 0.1.0
  • 0.0.1
released May 20th 2014
This version is compatible with:
  • Darwin

Start using this module

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

Add this module to your Puppetfile:

mod 'glarizza-property_list_key', '0.2.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add glarizza-property_list_key
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install glarizza-property_list_key --version 0.2.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

glarizza/property_list_key — version 0.2.1 May 20th 2014

##property_list_key

This is a Puppet module that will manage OS X plist files. It's unique from other resources in that it manages individual KEYS and VALUES in a plist file. Because of this, you can have multiple resources for a single file specified in the path attribute.

It's important that you set the value_type attribute, especially if you're trying to set a value like an integer or a boolean. Also, if you indicate that you're passing a value type of a hash or an array, then you'll need to use that native value type when you're specifying the value (see the below example for the array syntax).

Finally, this type currently can only manage an ENTIRE hash if you specify a value_type of 'hash'. Ideally, it would be nice to manage individual hash keys/values, but the mechanics of that have yet to be sussed out.

A NOTE FOR MAVERICKS SUPPORT!

Previously, this provider supported the RubyCocoa library that Apple shipped as part of OS X (which acted as a bridge between Ruby and, well, Cocoa). As of Mavericks (10.9) and Apple's inclusion of Ruby 2.0.0, Apple has removed the RubyCocoa library. Boo. I'm still shipping the RubyCocoa provider, but have added a NEW provider, CFPropertyList, to support another awesome lib for reading/writing binary/XML plists.

The CFPropertyList Provider

The CFPropertyList provider will work with Ruby 2.0.0, however there's one little problem: the version of CFPropertyList that ships with Mavericks has a bug. Due to this bug, I'm requiring that CFPropertyList version 2.2.5 or greater be installed in order to use the CFPropertyList provider (in fact, if you DON'T have that version or greater installed, Puppet will raise an error and the provider will not be available). The way to install CFPropertyList is to choose ONE of the following methods (i.e. CHOOSE THE BEST - DON'T TRY TO DO THEM ALL!):

  • For Boxen Users, add the following to the Gemfile in the root of your Boxen repository:
gem 'CFPropertyList',         '>= 2.2.6'

This will allow Boxen to pull down the correct version of the gem and load it in Boxen's load path

  • For people using the system version of Rubygems, update the version of CFPropertyList with gem update:
    └(~/src/puppet-property_list_key)▷ sudo /usr/bin/gem update CFPropertyList
    Updating installed gems
    Updating CFPropertyList
    Fetching: CFPropertyList-2.2.6.gem (100%)
    Successfully installed CFPropertyList-2.2.6
    Gems updated: CFPropertyList
  • For users of Bundler, simply use the Gemfile I've provide to bundle install your way to CFPropertyList
    └(~/src/puppet-property_list_key)▷ bundle install
  • For users who are using the system version of Rubygems and don't have CFPropertyList installed, use gem to install the version of CFPropertyList you need
    └(~/src/puppet-property_list_key)▷sudo /usr/bin/gem install CFPropertyList -v 2.2.6

Once you have the correct version of CFPropertyList available, the provider will be rendered suitable/available and life should get much better! Usage remains exactly the same whether you're using CFPropertyList or RubyCocoa.

Contact

Gary Larizza gary@puppetlabs.com

Usage

    property_list_key { 'test3':
      ensure     => present,
      path       => '/tmp/com.puppetlabs.puppet',
      key        => 'arraytest',
      value      => ['array', 'values'],
      value_type => 'array',
    }

    # Disable Gatekeeper in 10.8
    property_list_key { 'Disable Gatekeeper':
      ensure => present,
      path   => '/var/db/SystemPolicy-prefs.plist',
      key    => 'enabled',
      value  => 'no',
    }

See more usage information in the tests/property_list.pp file