adrienthebo/puppet-alternatives — pull request #2 by jgoldschrafe (2013-05-22 17:59:08+00:00)
Title: Supoprt for Red Hat-style alternatives

This pull request adds support for Red Hat-style alternatives, which has a different discovery mechanism and slightly different semantics than Debian-style alternatives. It also adds a magic value `auto` to the `path` property, which is used in Red Hat systems for reverting the alternative to the available option with the highest-numbered priority. This is logically much simpler than adding a separate `mode` property, but I'm open to doing that if you don't like the magic-value approach.

Since Red Hat and Debian both use binaries named `/usr/sbin/update-alternatives` with slightly different semantics, this pull also adds `confine :osfamily => 'Debian'` on the existing dpkg provider.

Example output from `puppet resource alternatives` on a CentOS 6 system:

alternatives { 'emacs':
path => 'auto',
}
alternatives { 'emacs.etags':
path => 'auto',
}
alternatives { 'ip6tables.x86_64':
path => '/sbin/ip6tables-1.4.7',
}
alternatives { 'iptables.x86_64':
path => '/sbin/iptables-1.4.7',
}
alternatives { 'java':
path => 'auto',
}
alternatives { 'java_sdk_1.6.0':
path => 'auto',
}
alternatives { 'java_sdk_openjdk':
path => 'auto',
}
alternatives { 'javac':
path => 'auto',
}
alternatives { 'jre_1.6.0':
path => 'auto',
}
alternatives { 'jre_openjdk':
path => 'auto',
}
alternatives { 'links':
path => '/usr/bin/elinks',
}
alternatives { 'mta':
path => 'auto',
}