summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions/ensure_packages.rb
AgeCommit message (Collapse)Author
2016-03-15Add ensure_resources() functionNikhil Yadav
New function "ensure_resources()" to support passing hash as parameter OR from hiera backend This new function is extension of ensure_resource() which will now support to pass multiple values as hash/array OR from hiera backend variables in title argument with additional parameters needed. It will process multiple values for a resource type from the passed argument & pass each entry (type, title, params) to ensure_resource() in required format for further processing. Now user can have duplicate resource check functionality extended to multiple entries with this new function. Use: For multiple resources using hash: ensure_resources('user', {'dan' => { gid => 'mygroup', uid =>'600' } , 'alex' => { gid => 'mygroup' }}, {'ensure' =>'present'}) From Hiera Backend: userlist: dan: gid: 'mygroup' uid: '600' alex: gid: 'mygroup' Call: ensure_resources('user',hiera_hash('userlist'), {'ensure' => 'present'}) ensure_packages() Modified to also support Hash type argument for packages This modification will call newly added ensure_resources() for processing Hash as second argument. The original functionality remains same for Array type arguments. Use: hiera: packagelist: ksh: ensure: latest mlocate: {} myrpm: provider: rpm source: "/tmp/myrpm-1.0.0.x86_64.rpm" install_options: --prefix: /users/home openssl: provider: rpm source: "/tmp/openssl-1.0.1e-42.el7.x86_64.rpm" Call: ensure_packages($packagelist)
2014-03-30(MODULES-603) Add defaults arguments to ensure_packages()Yanis Guenane
Without this patch one can not specify package resource specific parameters. All the ensure_packages() function does it makes sure the named packages are installed. This patch allows one to pass default as a second argument and allow greater flexibility on packages installations. Use case like the following are now possible : * ensure_packages(['r10k', 'serverspec'], {'provider' => 'gem'}) * ensure_packages(['ntp'], {'require' => 'Exec[foobar]'})
2014-01-15(maint) refactor ensure_packages for clarityAdrien Thebo
2014-01-15Allow a single argument, rather than an arrayTomas Doran
2012-11-27Add an ensure_packages function.Chad Metcalf
Its often the case that modules need to install a handful of packages. In some cases its worth breaking these dependencies out into their own modules (e.g., Java). In others it makes more sense to keep them in the module. This can be problematic when multiple modules depend on common packages (git, python ruby, etc). ensure_resource was a good first step towards solving this problem. ensure_resource does not handle arrays and for 3 or more packages stamping out ensure_resource declarations is tedious. ensure_packages is a convenience function that takes an array of packages and wraps calls to ensure_resource. Currently users cannot specify package versions. But the function could be extended to use a hash if that functionality would be useful.