Initial Chef repository

This commit is contained in:
Greg Karékinian
2015-07-21 19:45:23 +02:00
parent 7e5401fc71
commit ee4079fa85
1151 changed files with 185163 additions and 0 deletions

276
cookbooks/yum/CHANGELOG.md Normal file
View File

@@ -0,0 +1,276 @@
yum Cookbook CHANGELOG
======================
This file is used to list changes made in each version of the yum cookbook.
v3.6.1 (2015-06-04)
-------------------
- Executing yum clean before makecache
- Adding repo_gpgcheck
v3.6.0 (2015-04-23)
-------------------
- Adding "yum clean" before "yum makecache" in yum_repository :create
- Adding why_run support to yum_globalconfig
v3.5.4 (2015-04-07)
-------------------
- Changing tolerant config line to stringified integer
v3.5.3 (2015-01-16)
-------------------
- Adding reposdir to globalconfig template
v3.5.2 (2014-12-24)
-------------------
- Fixing redhat-release detection for Redhat 7
v3.5.1 (2014-11-24)
-------------------
- Reverting management of ca-certificates because EL5 was broken
v3.5.0 (2014-11-24)
-------------------
- Adding management of ca-certificates package to yum_repository provider
v3.4.1 (2014-10-29)
-------------------
- Run yum-makecache only_if new_resource.enabled
- Allow setting of reposdir in global yum config and man page
- Change default 'obsoletes' behavior to match yum defaults
v3.4.0 (2014-10-15)
-------------------
- Dynamically generate the new_resource attributes
v3.3.2 (2014-09-11)
-------------------
- Fix globalconfig resource param for http_caching
v3.3.1 (2014-09-04)
-------------------
- Fix issue with sslverify if set to false
- Add fancy badges
v3.3.0 (2014-09-03)
-------------------
- Adding tuning attributes for all supported resource parameters
- Adding options hash parameter
- Adding (real) rhel-6.5 and centos-7.0 to test-kitchen coverage
- Updating regex for mirror_expire and mirrorlist_expire to include /^\d+[mhd]$/
- Updating README so keepcache reflects reality (defaults to false)
- Changing 'obsoletes' behavior in globalconfig resource to match
default behavior. (now defaults to nil, yum defaults to false)
- Adding makecache action to repository resource
- Adding mode parameter to repository resource. Defaults to '0644'.
v3.2.4 (2014-08-20)
-------------------
#82 - Adding a makecache parameter
v3.2.2 (2014-06-11)
-------------------
#77 - Parameter default to be Trueclass instead of "1"
#78 - add releasever parameter
v3.2.0 (2014-04-09)
-------------------
- [COOK-4510] - Adding username and password parameters to node attributes
- [COOK-4518] - Fix Scientific Linux distroverpkg
v3.1.6 (2014-03-27)
-------------------
- [COOK-4463] - support multiple GPG keys
- [COOK-4364] - yum_repository delete action fails
v3.1.4 (2014-03-12)
-------------------
- [COOK-4417] Expand test harness to encompass 32-bit boxes
v3.1.2 (2014-02-23)
-------------------
Fixing bugs around :delete action and cache clean
Fixing specs to cover :remove and :delete aliasing properly
Adding Travis-ci build matrix bits
v3.1.0 (2014-02-13)
-------------------
- Updating testing harness for integration testing on Travis-ci
- Adding TESTING.md and Guardfile
- PR #67 - Add skip_if_unvailable repository option
- PR #64 - Fix validation of 'metadata_expire' option to match documentation
- [COOK-3591] - removing node.name from repo template rendering
- [COOK-4275] - Enhancements to yum cookbook
- Adding full spec coverage
- Adding support for custom source template to yum_repository
v3.0.8 (2014-01-27)
-------------------
Fixing typo in default.rb. yum_globalconfig now passes proxy attribute correctly.
v3.0.6 (2014-01-27)
-------------------
Updating default.rb to consume node['yum']['main']['proxy']
v3.0.4 (2013-12-29)
-------------------
### Bug
- **[COOK-4156](https://tickets.chef.io/browse/COOK-4156)** - yum cookbook creates a yum.conf with "cachefir" directive
v3.0.2
------
Updating globalconfig provider for Chef 10 compatability
v3.0.0
------
3.0.0
Major rewrite with breaking changes.
Recipes broken out into individual cookbooks
yum_key resource has been removed
yum_repository resource now takes gpgkey as a URL directly
yum_repository actions have been reduced to :create and :delete
'name' has been changed to repositoryid to avoid ambiguity
chefspec test coverage
gpgcheck is set to 'true' by default and must be explicitly disabled
v2.4.4
------
Reverting to Ruby 1.8 hash syntax.
v2.4.2
------
[COOK-3275] LWRP repository.rb :add method fails to create yum repo in
some cases which causes :update to fail Amazon rhel
v2.4.0
------
### Improvement
- [COOK-3025] - Allow per-repo proxy definitions
v2.3.4
------
### Improvement
- **[COOK-3689](https://tickets.chef.io/browse/COOK-3689)** - Fix warnings about resource cloning
- **[COOK-3574](https://tickets.chef.io/browse/COOK-3574)** - Add missing "description" field in metadata
v2.3.2
------
### Bug
- **[COOK-3145](https://tickets.chef.io/browse/COOK-3145)** - Use correct download URL for epel `key_url`
v2.3.0
------
### New Feature
- [COOK-2924]: Yum should allow type setting in repo file
v2.2.4
------
### Bug
- [COOK-2360]: last commit to `yum_repository` changes previous behaviour
- [COOK-3015]: Yum cookbook test minitest to fail
v2.2.2
------
### Improvement
- [COOK-2741]: yum::elrepo
- [COOK-2946]: update tests, test kitchen support in yum cookbook
### Bug
- [COOK-2639]: Yum cookbook - epel - always assumes url is a mirror list
- [COOK-2663]: Yum should allow metadata_expire setting in repo file
- [COOK-2751]: Update yum.ius_release version to 1.0-11
v2.2.0
------
- [COOK-2189] - yum::ius failed on install (caused from rpm dependency)
- [COOK-2196] - Make includepkgs and exclude configurable for each repos
- [COOK-2244] - Allow configuring caching using attributes
- [COOK-2399] - yum cookbook LWRPs fail FoodCritic
- [COOK-2519] - Add priority option to Yum repo files
- [COOK-2593] - allow integer or string for yum priority
- [COOK-2643] - don't use conditional attribute for `yum_key` `remote_file`
v2.1.0
------
- [COOK-2045] - add remi repository recipe
- [COOK-2121] - add `:create` action to `yum_repository`
v2.0.6
------
- [COOK-2037] - minor style fixes
- [COOK-2038] - updated README
v2.0.4
------
- [COOK-1908] - unable to install repoforge on CentOS 6 32 bit
v2.0.2
------
- [COOK-1758] - Add default action for repository resource
v2.0.0
------
This version changes the behavior of the EPEL recipe (most commonly used in other Chef cookbooks) on Amazon, and removes an attribute, `node['yum']['epel_release']`. See the README for details.
- [COOK-1772] - Simplify management of EPEL with LWRP
v1.0.0
------
`mirrorlist` in the `yum_repository` LWRP must be set to the mirror list URI to use rather than setting it to true. See README.md.
- [COOK-1088] - use dl.fedoraproject.org for EPEL to prevent redirects
- [COOK-1653] - fix mirrorlist
- [COOK-1710] - support http proxy
- [COOK-1722] - update IUS version
v0.8.2
------
- [COOK-1521] - add :update action to `yum_repository`
v0.8.0
------
- [COOK-1204] - Make 'add' default action for yum_repository
- [COOK-1351] - option to not make the yum cache (via attribute)
- [COOK-1353] - x86_64 centos path fixes
- [COOK-1414] - recipe for repoforge
v0.6.2
------
- Updated README to remove git diff artifacts.
v0.6.0
------
- Default action for the yum_repository LWRP is now add.
- [COOK-1227] - clear Chefs internal cache after adding new yum repo
- [COOK-1262] - yum::epel should enable existing repo on Amazon Linux
- [COOK-1272], [COOK-1302] - update RPM file for CentOS / RHEL 6
- [COOK-1330] - update cookbook documentation on excludes for yum
- [COOK-1346] - retry remote_file for EPEL in case we get an FTP mirror
v0.5.2
------
- [COOK-825] - epel and ius `remote_file` should notify the `rpm_package` to install
v0.5.0
------
- [COOK-675] - add recipe for handling EPEL repository
- [COOK-722] - add recipe for handling IUS repository
v.0.1.2
------
- Remove yum update in default recipe, that doesn't update caches, it updates packages installed.

280
cookbooks/yum/README.md Normal file
View File

@@ -0,0 +1,280 @@
yum Cookbook
============
[![Join the chat at https://gitter.im/chef-cookbooks/yum](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/chef-cookbooks/yum?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Cookbook Version](https://img.shields.io/cookbook/v/yum.svg)](https://supermarket.chef.io/cookbooks/yum)
[![Travis status](http://img.shields.io/travis/chef-cookbooks/yum.svg)](https://travis-ci.org/chef-cookbooks/yum)
The Yum cookbook exposes the `yum_globalconfig` and `yum_repository`
resources that allows a user to both control global behavior and make
individual Yum repositories available for use. These resources aim to
allow the user to configure all options listed in the `yum.conf` man
page, found at http://linux.die.net/man/5/yum.conf
NOTES
-----
WARNING: Yum cookbook version 3.0.0 and above contain non-backwards
compatible breaking changes and will not work with cookbooks written
against the 2.x and 1.x series. Changes have been made to the
yum_repository resource, and the yum_key resource has been eliminated
entirely. Recipes have been eliminated and moved into their own
cookbooks. Please lock yum to the 2.x series in your Chef environments
until all dependent cookbooks have been ported.
Requirements
------------
* Chef 11 or higher
* Ruby 1.9 (preferably from the Chef full-stack installer)
* RHEL5, RHEL6, or other platforms within the family
Resources/Providers
-------------------
### yum_repository
This resource manages a yum repository configuration file at
/etc/yum.repos.d/`repositoryid`.repo. When the file needs to be
repaired, it calls yum-makecache so packages in the repo become
available to the next resource.
#### Example
``` ruby
# add the Zenoss repository
yum_repository 'zenoss' do
description "Zenoss Stable repo"
baseurl "http://dev.zenoss.com/yum/stable/"
gpgkey 'http://dev.zenoss.com/yum/RPM-GPG-KEY-zenoss'
action :create
end
# add the EPEL repo
yum_repository 'epel' do
description 'Extra Packages for Enterprise Linux'
mirrorlist 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch'
gpgkey 'http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6'
action :create
end
```
``` ruby
# delete CentOS-Media repo
yum_repository 'CentOS-Media' do
action :delete
end
```
#### Actions
- `:create` - creates a repository file and builds the repository listing
- `:delete` - deletes the repository file
- `:makecache` - update yum cache
#### Parameters
* `baseurl` - Must be a URL to the directory where the yum repository's
'repodata' directory lives. Can be an http://, ftp:// or file://
URL. You can specify multiple URLs in one baseurl statement.
* `cost` - relative cost of accessing this repository. Useful for
weighing one repo's packages as greater/less than any other.
defaults to 1000
* `description` - Maps to the 'name' parameter in a repository .conf.
Descriptive name for the repository channel. This directive must be
specified.
* `enabled` - Either `true` or `false`. This tells yum whether or not use this repository.
* `enablegroups` - Either `true` or `false`. Determines whether yum
will allow the use of package groups for this repository. Default is
`true` (package groups are allowed).
* `exclude` - List of packages to exclude from updates or installs. This
should be a space separated list in a single string. Shell globs using wildcards (eg. *
and ?) are allowed.
* `failovermethod` - Either 'roundrobin' or 'priority'.
* `fastestmirror_enabled` - Either `true` or `false`
* `gpgcheck` - Either `true` or `false`. This tells yum whether or not
it should perform a GPG signature check on packages. When this is
set in the [main] section it sets the default for all repositories.
The default is `true`.
* `gpgkey` - A URL pointing to the ASCII-armored GPG key file for the
repository. This option is used if yum needs a public key to verify
a package and the required key hasn't been imported into the RPM
database. If this option is set, yum will automatically import the
key from the specified URL.
* `http_caching` - Either 'all', 'packages', or 'none'. Determines how
upstream HTTP caches are instructed to handle any HTTP downloads
that Yum does. Defaults to 'all'
* `includepkgs` - Inverse of exclude. This is a list of packages you
want to use from a repository. If this option lists only one package
then that is all yum will ever see from the repository. Defaults to
an empty list.
* `keepalive` - Either `true` or `false`. This tells yum whether or not
HTTP/1.1 keepalive should be used with this repository.
* `make_cache` - Optional, Default is `true`, if `false` then `yum -q makecache` will not
be ran
* `max_retries` - Set the number of times any attempt to retrieve a file
should retry before returning an error. Setting this to '0' makes
yum try forever. Default is '10'.
* `metadata_expire` - Time (in seconds) after which the metadata will
expire. So that if the current metadata downloaded is less than this
many seconds old then yum will not update the metadata against the
repository. If you find that yum is not downloading information on
updates as often as you would like lower the value of this option.
You can also change from the default of using seconds to using days,
hours or minutes by appending a d, h or m respectively. The default
is 6 hours, to compliment yum-updatesd running once an hour. It's
also possible to use the word "never", meaning that the metadata
will never expire. Note that when using a metalink file the metalink
must always be newer than the metadata for the repository, due to
the validation, so this timeout also applies to the metalink file.
* `mirrorlist` - Specifies a URL to a file containing a list of
baseurls. This can be used instead of or with the baseurl option.
Substitution variables, described below, can be used with this
option. As a special hack is the mirrorlist URL contains the word
"metalink" then the value of mirrorlist is copied to metalink (if
metalink is not set)
* `mirror_expire` - Time (in seconds) after which the mirrorlist locally
cached will expire. If the current mirrorlist is less than this many
seconds old then yum will not download another copy of the
mirrorlist, it has the same extra format as metadata_expire. If you
find that yum is not downloading the mirrorlists as often as you
would like lower the value of this option.
* `mirrorlist_expire` - alias for mirror_expire
* `mode` - Permissions mode of .repo file on disk. Useful for
scenarios where secrets are in the repo file. If set to '600',
normal users will not be able to use yum search, yum info, etc.
Defaults to '0644'
* `priority` - When the yum-priorities plug-in is enabled, you set
priorities on repository entries, where N is an integer from 1 to 99. The
default priority for repositories is 99.
* `proxy` - URL to the proxy server that yum should use.
* `proxy_username` - username to use for proxy
* `proxy_password` - password for this proxy
* `report_instanceid` - Report instance ID when using Amazon Linux AMIs
and repositories
* `repositoryid` - Must be a unique name for each repository, one word.
Defaults to name attribute.
* `source` - Use a custom template source instead of the default one
in the yum cookbook
* `sslcacert` - Path to the directory containing the databases of the
certificate authorities yum should use to verify SSL certificates.
Defaults to none - uses system default
* `sslclientcert` - Path to the SSL client certificate yum should use to
connect to repos/remote sites Defaults to none.
* `sslclientkey` - Path to the SSL client key yum should use to connect
to repos/remote sites Defaults to none.
* `sslverify` - Either `true` or `false`. Determines if yum will verify SSL certificates/hosts. Defaults to `true`
* `timeout` - Number of seconds to wait for a connection before timing
out. Defaults to 30 seconds. This may be too short of a time for
extremely overloaded sites.
### yum_globalconfig
This renders a template with global yum configuration parameters. The
default recipe uses it to render `/etc/yum.conf`. It is flexible
enough to be used in other scenarios, such as building RPMs in
isolation by modifying `installroot`.
#### Example
``` ruby
yum_globalconfig '/my/chroot/etc/yum.conf' do
cachedir '/my/chroot/etc/yum.conf'
keepcache 'yes'
debuglevel '2'
installroot '/my/chroot'
action :create
end
```
#### Parameters
`yum_globalconfig` can take most of the same parameters as a
`yum_repository`, plus more, too numerous to describe here. Below are
a few of the more commonly used ones. For a complete list, please
consult the `yum.conf` man page, found here:
http://linux.die.net/man/5/yum.conf
* `cachedir` - Directory where yum should store its cache and db
files. The default is '/var/cache/yum'.
* `keepcache` - Either `true` or `false`. Determines whether or not
yum keeps the cache of headers and packages after successful
installation. Default is `false`
* `debuglevel` - Debug message output level. Practical range is 0-10.
Default is '2'.
* `exclude` - List of packages to exclude from updates or installs.
This should be a space separated list. Shell globs using wildcards
(eg. * and ?) are allowed.
* `installonlypkgs` = List of package provides that should only ever
be installed, never updated. Kernels in particular fall into this
category. Defaults to kernel, kernel-bigmem, kernel-enterprise,
kernel-smp, kernel-debug, kernel-unsupported, kernel-source,
kernel-devel, kernel-PAE, kernel-PAE-debug.
* `logfile` - Full directory and file name for where yum should write
its log file.
* `exactarch` - Either `true` or `false`. Set to `true` to make 'yum update' only
update the architectures of packages that you have installed. ie:
with this enabled yum will not install an i686 package to update an
x86_64 package. Default is `true`
* `gpgcheck` - Either `true` or `false`. This tells yum whether or not
it should perform a GPG signature check on the packages gotten from
this repository.
Recipes
-------
* `default` - Configures `yum_globalconfig[/etc/yum.conf]` with values
found in node attributes at `node['yum']['main']`
Attributes
----------
The following attributes are set by default
``` ruby
default['yum']['main']['cachedir'] = '/var/cache/yum/$basearch/$releasever'
default['yum']['main']['keepcache'] = false
default['yum']['main']['debuglevel'] = nil
default['yum']['main']['exclude'] = nil
default['yum']['main']['logfile'] = '/var/log/yum.log'
default['yum']['main']['exactarch'] = nil
default['yum']['main']['obsoletes'] = nil
default['yum']['main']['installonly_limit'] = nil
default['yum']['main']['installonlypkgs'] = nil
default['yum']['main']['installroot'] = nil
```
Related Cookbooks
-----------------
Recipes from older versions of this cookbook have been moved
individual cookbooks. Recipes for managing platform yum configurations
and installing specific repositories can be found in one (or more!) of
the following cookbook.
* yum-centos
* yum-fedora
* yum-amazon
* yum-epel
* yum-elrepo
* yum-repoforge
* yum-ius
* yum-percona
* yum-pgdg
Usage
-----
Put `depends 'yum'` in your metadata.rb to gain access to the
yum_repository resource.
License & Authors
-----------------
- Author:: Eric G. Wolfe
- Author:: Matt Ray (<matt@chef.io>)
- Author:: Joshua Timberman (<joshua@chef.io>)
- Author:: Sean OMeara (<someara@chef.io>)
```text
Copyright:: 2011 Eric G. Wolfe
Copyright:: 2013 Chef
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```

View File

@@ -0,0 +1,99 @@
# http://linux.die.net/man/5/yum.conf
case node['platform_version'].to_i
when 5
default['yum']['main']['cachedir'] = '/var/cache/yum'
else
default['yum']['main']['cachedir'] = '/var/cache/yum/$basearch/$releasever'
end
case node['platform']
when 'amazon'
default['yum']['main']['distroverpkg'] = 'system-release'
when 'scientific'
default['yum']['main']['distroverpkg'] = 'sl-release'
when 'redhat'
default['yum']['main']['distroverpkg'] = nil
else
default['yum']['main']['distroverpkg'] = "#{node['platform']}-release"
end
default['yum']['main']['alwaysprompt'] = nil # [TrueClass, FalseClass]
default['yum']['main']['assumeyes'] = nil # [TrueClass, FalseClass]
default['yum']['main']['bandwidth'] = nil # /^\d+$/
default['yum']['main']['bugtracker_url'] = nil # /.*/
default['yum']['main']['clean_requirements_on_remove'] = nil # [TrueClass, FalseClass]
default['yum']['main']['color'] = nil # %w{ always never }
default['yum']['main']['color_list_available_downgrade'] = nil # /.*/
default['yum']['main']['color_list_available_install'] = nil # /.*/
default['yum']['main']['color_list_available_reinstall'] = nil # /.*/
default['yum']['main']['color_list_available_upgrade'] = nil # /.*/
default['yum']['main']['color_list_installed_extra'] = nil # /.*/
default['yum']['main']['color_list_installed_newer'] = nil # /.*/
default['yum']['main']['color_list_installed_older'] = nil # /.*/
default['yum']['main']['color_list_installed_reinstall'] = nil # /.*/
default['yum']['main']['color_search_match'] = nil # /.*/
default['yum']['main']['color_update_installed'] = nil # /.*/
default['yum']['main']['color_update_local'] = nil # /.*/
default['yum']['main']['color_update_remote'] = nil # /.*/
default['yum']['main']['commands'] = nil # /.*/
default['yum']['main']['debuglevel'] = nil # /^\d+$/
default['yum']['main']['diskspacecheck'] = nil # [TrueClass, FalseClass]
default['yum']['main']['enable_group_conditionals'] = nil # [TrueClass, FalseClass]
default['yum']['main']['errorlevel'] = nil # /^\d+$/
default['yum']['main']['exactarch'] = nil # [TrueClass, FalseClass]
default['yum']['main']['exclude'] = nil # /.*/
default['yum']['main']['gpgcheck'] = true # [TrueClass, FalseClass]
default['yum']['main']['group_package_types'] = nil # /.*/
default['yum']['main']['groupremove_leaf_only'] = nil # [TrueClass, FalseClass]
default['yum']['main']['history_list_view'] = nil # /.*/
default['yum']['main']['history_record'] = nil # [TrueClass, FalseClass]
default['yum']['main']['history_record_packages'] = nil # /.*/
default['yum']['main']['http_caching'] = nil # %w{ packages all none }
default['yum']['main']['installonly_limit'] = nil # /\d+/, /keep/
default['yum']['main']['installonlypkgs'] = nil # /.*/
default['yum']['main']['installroot'] = nil # /.*/
default['yum']['main']['keepalive'] = nil # [TrueClass, FalseClass]
default['yum']['main']['keepcache'] = false # [TrueClass, FalseClass]
default['yum']['main']['kernelpkgnames'] = nil # /.*/
default['yum']['main']['localpkg_gpgcheck'] = nil # [TrueClass,# FalseClass]
default['yum']['main']['logfile'] = '/var/log/yum.log' # /.*/
default['yum']['main']['max_retries'] = nil # /^\d+$/
default['yum']['main']['mdpolicy'] = nil # %w{ packages all none }
default['yum']['main']['metadata_expire'] = nil # /^\d+$/
default['yum']['main']['mirrorlist_expire'] = nil # /^\d+$/
default['yum']['main']['multilib_policy'] = nil # %w{ all best }
default['yum']['main']['obsoletes'] = nil # [TrueClass, FalseClass]
default['yum']['main']['overwrite_groups'] = nil # [TrueClass, FalseClass]
default['yum']['main']['password'] = nil # /.*/
default['yum']['main']['path'] = '/etc/yum.conf' # /.*/
default['yum']['main']['persistdir'] = nil # /.*/
default['yum']['main']['pluginconfpath'] = nil # /.*/
default['yum']['main']['pluginpath'] = nil # /.*/
default['yum']['main']['plugins'] = nil # [TrueClass, FalseClass]
default['yum']['main']['protected_multilib'] = nil # /.*/
default['yum']['main']['protected_packages'] = nil # /.*/
default['yum']['main']['proxy'] = nil # /.*/
default['yum']['main']['proxy_password'] = nil # /.*/
default['yum']['main']['proxy_username'] = nil # /.*/
default['yum']['main']['password'] = nil # /.*/
default['yum']['main']['recent'] = nil # /^\d+$/
default['yum']['main']['releasever'] = nil # /.*/
default['yum']['main']['repo_gpgcheck'] = nil # [TrueClass, FalseClass]
default['yum']['main']['reposdir'] = nil # /.*/
default['yum']['main']['reset_nice'] = nil # [TrueClass, FalseClass]
default['yum']['main']['rpmverbosity'] = nil # %w{ info critical# emergency error warn debug }
default['yum']['main']['showdupesfromrepos'] = nil # [TrueClass, FalseClass]
default['yum']['main']['skip_broken'] = nil # [TrueClass, FalseClass]
default['yum']['main']['ssl_check_cert_permissions'] = nil # [TrueClass, FalseClass]
default['yum']['main']['sslcacert'] = nil # /.*/
default['yum']['main']['sslclientcert'] = nil # /.*/
default['yum']['main']['sslclientkey'] = nil # /.*/
default['yum']['main']['sslverify'] = nil # [TrueClass, FalseClass]
default['yum']['main']['syslog_device'] = nil # /.*/
default['yum']['main']['syslog_facility'] = nil # /.*/
default['yum']['main']['syslog_ident'] = nil # /.*/
default['yum']['main']['throttle'] = nil # [/\d+k/, /\d+M/, /\d+G/]
default['yum']['main']['timeout'] = nil # /\d+/
default['yum']['main']['tolerant'] = false
default['yum']['main']['tsflags'] = nil # /.*/
default['yum']['main']['username'] = nil # /.*/

View File

@@ -0,0 +1,27 @@
# Matchers for chefspec 3
if defined?(ChefSpec)
def create_yum_repository(resource_name)
ChefSpec::Matchers::ResourceMatcher.new(:yum_repository, :create, resource_name)
end
def add_yum_repository(resource_name)
ChefSpec::Matchers::ResourceMatcher.new(:yum_repository, :add, resource_name)
end
def delete_yum_repository(resource_name)
ChefSpec::Matchers::ResourceMatcher.new(:yum_repository, :delete, resource_name)
end
def remove_yum_repository(resource_name)
ChefSpec::Matchers::ResourceMatcher.new(:yum_repository, :remove, resource_name)
end
def create_yum_globalconfig(resource_name)
ChefSpec::Matchers::ResourceMatcher.new(:yum_globalconfig, :create, resource_name)
end
def delete_yum_globalconfig(resource_name)
ChefSpec::Matchers::ResourceMatcher.new(:yum_globalconfig, :delete, resource_name)
end
end

View File

@@ -0,0 +1 @@
{"name":"yum","version":"3.6.1","description":"Configures various yum components on Red Hat-like systems","long_description":"","maintainer":"Chef","maintainer_email":"cookbooks@chef.io","license":"Apache 2.0","platforms":{"redhat":">= 0.0.0","centos":">= 0.0.0","scientific":">= 0.0.0","amazon":">= 0.0.0","fedora":">= 0.0.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{}}

View File

@@ -0,0 +1,41 @@
#
# Cookbook Name:: yum
# Provider:: repository
#
# Author:: Sean OMeara <someara@chef.io>
# Copyright 2013, Chef
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Allow for Chef 10 support
use_inline_resources if defined?(use_inline_resources)
def whyrun_supported?
true
end
action :create do
template new_resource.path do
source 'main.erb'
cookbook 'yum'
mode '0644'
variables(:config => new_resource)
end
end
action :delete do
file new_resource.path do
action :delete
end
end

View File

@@ -0,0 +1,106 @@
#
# Cookbook Name:: yum
# Provider:: repository
#
# Author:: Sean OMeara <someara@chef.io>
# Copyright 2013, Chef
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# In Chef 11 and above, calling the use_inline_resources method will
# make Chef create a new "run_context". When an action is called, any
# nested resources are compiled and converged in isolation from the
# recipe that calls it.
# Allow for Chef 10 support
use_inline_resources if defined?(use_inline_resources)
def whyrun_supported?
true
end
action :create do
# Hack around the lack of "use_inline_resources" before Chef 11 by
# uniquely naming the execute[yum-makecache] resources. Set the
# notifies timing to :immediately for the same reasons. Remove both
# of these when dropping Chef 10 support.
template "/etc/yum.repos.d/#{new_resource.repositoryid}.repo" do
if new_resource.source.nil?
source 'repo.erb'
cookbook 'yum'
else
source new_resource.source
end
mode new_resource.mode
variables(:config => new_resource)
if new_resource.make_cache
notifies :run, "execute[yum clean #{new_resource.repositoryid}]", :immediately
notifies :run, "execute[yum-makecache-#{new_resource.repositoryid}]", :immediately
notifies :create, "ruby_block[yum-cache-reload-#{new_resource.repositoryid}]", :immediately
end
end
execute "yum clean #{new_resource.repositoryid}" do
command "yum clean all --disablerepo=* --enablerepo=#{new_resource.repositoryid}"
action :nothing
end
# get the metadata for this repo only
execute "yum-makecache-#{new_resource.repositoryid}" do
command "yum -q makecache --disablerepo=* --enablerepo=#{new_resource.repositoryid}"
action :nothing
only_if { new_resource.enabled }
end
# reload internal Chef yum cache
ruby_block "yum-cache-reload-#{new_resource.repositoryid}" do
block { Chef::Provider::Package::Yum::YumCache.instance.reload }
action :nothing
end
end
action :delete do
file "/etc/yum.repos.d/#{new_resource.repositoryid}.repo" do
action :delete
notifies :run, "execute[yum clean #{new_resource.repositoryid}]", :immediately
notifies :create, "ruby_block[yum-cache-reload-#{new_resource.repositoryid}]", :immediately
end
execute "yum clean #{new_resource.repositoryid}" do
command "yum clean all --disablerepo=* --enablerepo=#{new_resource.repositoryid}"
only_if "yum repolist | grep -P '^#{new_resource.repositoryid}([ \t]|$)'"
action :nothing
end
ruby_block "yum-cache-reload-#{new_resource.repositoryid}" do
block { Chef::Provider::Package::Yum::YumCache.instance.reload }
action :nothing
end
end
action :makecache do
execute "yum-makecache-#{new_resource.repositoryid}" do
command "yum -q makecache --disablerepo=* --enablerepo=#{new_resource.repositoryid}"
action :run
end
ruby_block "yum-cache-reload-#{new_resource.repositoryid}" do
block { Chef::Provider::Package::Yum::YumCache.instance.reload }
action :run
end
end
alias_method :action_add, :action_create
alias_method :action_remove, :action_delete

View File

@@ -0,0 +1,26 @@
#
# Author:: Sean OMeara (<someara@chef.io>)
# Author:: Joshua Timberman (<joshua@chef.io>)
# Recipe:: yum::default
#
# Copyright 2013-2014, Chef Software, Inc (<legal@chef.io>)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
yum_globalconfig '/etc/yum.conf' do
node['yum']['main'].each do |config, value|
send(config.to_sym, value)
end
action :create
end

View File

@@ -0,0 +1,108 @@
#
# Cookbook Name:: yum
# Resource:: repository
#
# Author:: Sean OMeara <someara@chef.io>
# Copyright 2013, Chef
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
actions :create, :delete
default_action :create
# http://linux.die.net/man/5/yum.conf
attribute :alwaysprompt, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :assumeyes, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :bandwidth, :kind_of => String, :regex => /^\d+/, :default => nil
attribute :bugtracker_url, :kind_of => String, :regex => /.*/, :default => nil
attribute :clean_requirements_on_remove, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :cachedir, :kind_of => String, :regex => /.*/, :default => '/var/cache/yum/$basearch/$releasever'
attribute :color, :kind_of => String, :equal_to => %w(always never), :default => nil
attribute :color_list_available_downgrade, :kind_of => String, :regex => /.*/, :default => nil
attribute :color_list_available_install, :kind_of => String, :regex => /.*/, :default => nil
attribute :color_list_available_reinstall, :kind_of => String, :regex => /.*/, :default => nil
attribute :color_list_available_upgrade, :kind_of => String, :regex => /.*/, :default => nil
attribute :color_list_installed_extra, :kind_of => String, :regex => /.*/, :default => nil
attribute :color_list_installed_newer, :kind_of => String, :regex => /.*/, :default => nil
attribute :color_list_installed_older, :kind_of => String, :regex => /.*/, :default => nil
attribute :color_list_installed_reinstall, :kind_of => String, :regex => /.*/, :default => nil
attribute :color_search_match, :kind_of => String, :regex => /.*/, :default => nil
attribute :color_update_installed, :kind_of => String, :regex => /.*/, :default => nil
attribute :color_update_local, :kind_of => String, :regex => /.*/, :default => nil
attribute :color_update_remote, :kind_of => String, :regex => /.*/, :default => nil
attribute :commands, :kind_of => String, :regex => /.*/, :default => nil
attribute :debuglevel, :kind_of => String, :regex => /^\d+$/, :default => '2'
attribute :diskspacecheck, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :distroverpkg, :kind_of => String, :regex => /.*/, :default => nil
attribute :enable_group_conditionals, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :errorlevel, :kind_of => String, :regex => /^\d+$/, :default => nil
attribute :exactarch, :kind_of => [TrueClass, FalseClass], :default => true
attribute :exclude, :kind_of => String, :regex => /.*/, :default => nil
attribute :gpgcheck, :kind_of => [TrueClass, FalseClass], :default => true
attribute :group_package_types, :kind_of => String, :regex => /.*/, :default => nil
attribute :groupremove_leaf_only, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :history_list_view, :kind_of => String, :equal_to => %w(users commands single-user-commands), :default => nil
attribute :history_record, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :history_record_packages, :kind_of => String, :regex => /.*/, :default => nil
attribute :http_caching, :kind_of => String, :equal_to => %w(packages all none), :default => nil
attribute :installonly_limit, :kind_of => String, :regex => [/^\d+/, /keep/], :default => '3'
attribute :installonlypkgs, :kind_of => String, :regex => /.*/, :default => nil
attribute :installroot, :kind_of => String, :regex => /.*/, :default => nil
attribute :keepalive, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :keepcache, :kind_of => [TrueClass, FalseClass], :default => false
attribute :kernelpkgnames, :kind_of => String, :regex => /.*/, :default => nil
attribute :localpkg_gpgcheck, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :logfile, :kind_of => String, :regex => /.*/, :default => '/var/log/yum.log'
attribute :max_retries, :kind_of => String, :regex => /^\d+$/, :default => nil
attribute :mdpolicy, :kind_of => String, :equal_to => %w(instant group:primary group:small group:main group:all), :default => nil
attribute :metadata_expire, :kind_of => String, :regex => [/^\d+$/, /^\d+[mhd]$/, /never/], :default => nil
attribute :mirrorlist_expire, :kind_of => String, :regex => /^\d+$/, :default => nil
attribute :multilib_policy, :kind_of => String, :equal_to => %w(all best), :default => nil
attribute :obsoletes, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :overwrite_groups, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :password, :kind_of => String, :regex => /.*/, :default => nil
attribute :path, :kind_of => String, :regex => /.*/, :default => nil, :name_attribute => true
attribute :persistdir, :kind_of => String, :regex => /.*/, :default => nil
attribute :pluginconfpath, :kind_of => String, :regex => /.*/, :default => nil
attribute :pluginpath, :kind_of => String, :regex => /.*/, :default => nil
attribute :plugins, :kind_of => [TrueClass, FalseClass], :default => true
attribute :protected_multilib, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :protected_packages, :kind_of => String, :regex => /.*/, :default => nil
attribute :proxy, :kind_of => String, :regex => /.*/, :default => nil
attribute :proxy_password, :kind_of => String, :regex => /.*/, :default => nil
attribute :proxy_username, :kind_of => String, :regex => /.*/, :default => nil
attribute :recent, :kind_of => String, :regex => /^\d+$/, :default => nil
attribute :releasever, :kind_of => String, :regex => /.*/, :default => nil
attribute :repo_gpgcheck, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :reposdir, :kind_of => String, :regex => /.*/, :default => nil
attribute :reset_nice, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :rpmverbosity, :kind_of => String, :equal_to => %w(info critical emergency error warn debug), :default => nil
attribute :showdupesfromrepos, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :skip_broken, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :ssl_check_cert_permissions, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :sslcacert, :kind_of => String, :regex => /.*/, :default => nil
attribute :sslclientcert, :kind_of => String, :regex => /.*/, :default => nil
attribute :sslclientkey, :kind_of => String, :regex => /.*/, :default => nil
attribute :sslverify, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :syslog_device, :kind_of => String, :regex => /.*/, :default => nil
attribute :syslog_facility, :kind_of => String, :regex => /.*/, :default => nil
attribute :syslog_ident, :kind_of => String, :regex => /.*/, :default => nil
attribute :throttle, :kind_of => String, :regex => [/\d+k/, /\d+M/, /\d+G/], :default => nil
attribute :timeout, :kind_of => String, :regex => /^\d+$/, :default => nil
attribute :tolerant, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :tsflags, :kind_of => String, :regex => /.*/, :default => nil
attribute :username, :kind_of => String, :regex => /.*/, :default => nil
attribute :options, :kind_of => Hash

View File

@@ -0,0 +1,68 @@
#
# Cookbook Name:: yum
# Resource:: repository
#
# Author:: Sean OMeara <someara@chef.io>
# Copyright 2013, Chef
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
actions :create, :delete, :add, :remove, :makecache
default_action :create
# http://linux.die.net/man/5/yum.conf
attribute :baseurl, :kind_of => String, :regex => /.*/, :default => nil
attribute :cost, :kind_of => String, :regex => /^\d+$/, :default => nil
attribute :description, :kind_of => String, :regex => /.*/, :default => 'Ye Ole Rpm Repo'
attribute :enabled, :kind_of => [TrueClass, FalseClass], :default => true
attribute :enablegroups, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :exclude, :kind_of => String, :regex => /.*/, :default => nil
attribute :failovermethod, :kind_of => String, :equal_to => %w(priority roundrobin), :default => nil
attribute :fastestmirror_enabled, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :gpgcheck, :kind_of => [TrueClass, FalseClass], :default => true
attribute :gpgkey, :kind_of => [String, Array], :regex => /.*/, :default => nil
attribute :http_caching, :kind_of => String, :equal_to => %w(packages all none), :default => nil
attribute :include_config, :kind_of => String, :regex => /.*/, :default => nil
attribute :includepkgs, :kind_of => String, :regex => /.*/, :default => nil
attribute :keepalive, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :make_cache, :kind_of => [TrueClass, FalseClass], :default => true
attribute :max_retries, :kind_of => String, :regex => /.*/, :default => nil
attribute :metadata_expire, :kind_of => String, :regex => [/^\d+$/, /^\d+[mhd]$/, /never/], :default => nil
attribute :mirrorexpire, :kind_of => String, :regex => /.*/, :default => nil
attribute :mirrorlist, :kind_of => String, :regex => /.*/, :default => nil
attribute :mirror_expire, :kind_of => String, :regex => [/^\d+$/, /^\d+[mhd]$/], :default => nil
attribute :mirrorlist_expire, :kind_of => String, :regex => [/^\d+$/, /^\d+[mhd]$/], :default => nil
attribute :mode, :default => '0644'
attribute :priority, :kind_of => String, :regex => /^(\d?[0-9]|[0-9][0-9])$/, :default => nil
attribute :proxy, :kind_of => String, :regex => /.*/, :default => nil
attribute :proxy_username, :kind_of => String, :regex => /.*/, :default => nil
attribute :proxy_password, :kind_of => String, :regex => /.*/, :default => nil
attribute :username, :kind_of => String, :regex => /.*/, :default => nil
attribute :password, :kind_of => String, :regex => /.*/, :default => nil
attribute :repo_gpgcheck, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :report_instanceid, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :repositoryid, :kind_of => String, :regex => /.*/, :name_attribute => true
attribute :skip_if_unavailable, :kind_of => [TrueClass, FalseClass], :default => nil
attribute :source, :kind_of => String, :regex => /.*/, :default => nil
attribute :sslcacert, :kind_of => String, :regex => /.*/, :default => nil
attribute :sslclientcert, :kind_of => String, :regex => /.*/, :default => nil
attribute :sslclientkey, :kind_of => String, :regex => /.*/, :default => nil
attribute :sslverify, :kind_of => [TrueClass, FalseClass], :default => true
attribute :timeout, :kind_of => String, :regex => /^\d+$/, :default => nil
attribute :options, :kind_of => Hash
alias_method :url, :baseurl
alias_method :keyurl, :gpgkey

View File

@@ -0,0 +1,269 @@
# This file was generated by Chef
# Do NOT modify this file by hand.
[main]
<% if @config.alwaysprompt %>
alwaysprompt=<%= @config.alwaysprompt %>
<% end %>
<% if @config.assumeyes %>
assumeyes=<%= @config.assumeyes %>
<% end %>
<% if @config.bandwidth %>
bandwidth=<%= @config.bandwidth %>
<% end %>
<% if @config.bugtracker_url %>
bugtracker_url=<%= @config.bugtracker_url %>
<% end %>
<% if @config.cachedir %>
cachedir=<%= @config.cachedir %>
<% end %>
<% if @config.clean_requirements_on_remove %>
clean_requirements_on_remove=<%= @config.clean_requirements_on_remove %>
<% end %>
<% if @config.color %>
color=<%= @config.color %>
<% end %>
<% if @config.color_list_available_downgrade %>
color_list_available_downgrade=<%= @config.color_list_available_downgrade %>
<% end %>
<% if @config.color_list_available_install %>
color_list_available_install=<%= @config.color_list_available_install %>
<% end %>
<% if @config.color_list_available_reinstall %>
color_list_available_reinstall=<%= @config.color_list_available_reinstall %>
<% end %>
<% if @config.color_list_available_upgrade %>
color_list_available_upgrade=<%= @config.color_list_available_upgrade %>
<% end %>
<% if @config.color_list_installed_extra %>
color_list_installed_extra=<%= @config.color_list_installed_extra %>
<% end %>
<% if @config.color_list_installed_newer %>
color_list_installed_newer=<%= @config.color_list_installed_newer %>
<% end %>
<% if @config.color_list_installed_older %>
color_list_installed_older=<%= @config.color_list_installed_older %>
<% end %>
<% if @config.color_list_installed_reinstall %>
color_list_installed_reinstall=<%= @config.color_list_installed_reinstall %>
<% end %>
<% if @config.color_search_match %>
color_search_match=<%= @config.color_search_match %>
<% end %>
<% if @config.color_update_installed %>
color_update_installed=<%= @config.color_update_installed %>
<% end %>
<% if @config.color_update_local %>
color_update_local=<%= @config.color_update_local %>
<% end %>
<% if @config.color_update_remote %>
color_update_remote=<%= @config.color_update_remote %>
<% end %>
<% if @config.commands %>
commands=<%= @config.commands %>
<% end %>
<% if @config.debuglevel %>
debuglevel=<%= @config.debuglevel %>
<% end %>
<% if @config.diskspacecheck %>
diskspacecheck=<%= @config.diskspacecheck %>
<% end %>
<% if @config.distroverpkg %>
distroverpkg=<%= @config.distroverpkg %>
<% end %>
<% if @config.enable_group_conditionals %>
enable_group_conditionals=1
<% end %>
<% if @config.errorlevel %>
errorlevel=<%= @config.errorlevel %>
<% end %>
<% if @config.exactarch %>
exactarch=1
<% else %>
exactarch=0
<% end %>
<% if @config.exclude %>
exclude=<%= @config.exclude %>
<% end %>
<% if @config.gpgcheck %>
gpgcheck=1
<% else %>
gpgcheck=0
<% end %>
<% if @config.group_package_types %>
group_package_types=<%= @config.group_package_types %>
<% end %>
<% if @config.groupremove_leaf_only %>
groupremove_leaf_only=<%= @config.groupremove_leaf_only %>
<% end %>
<% if @config.history_list_view %>
history_list_view=<%= @config.history_list_view %>
<% end %>
<% if @config.history_record %>
history_record=<%= @config.history_record %>
<% end %>
<% if @config.history_record_packages %>
history_record_packages=<%= @config.history_record_packages %>
<% end %>
<% if @config.http_caching %>
http_caching=<%= @config.http_caching %>
<% end %>
<% if @config.installonly_limit %>
installonly_limit=<%= @config.installonly_limit %>
<% end %>
<% if @config.installonlypkgs %>
installonlypkgs=<%= @config.installonlypkgs %>
<% end %>
<% if @config.installroot %>
installroot=<%= @config.installroot %>
<% end %>
<% if @config.keepalive %>
keepalive=<%= @config.keepalive %>
<% end %>
<% if @config.keepcache %>
keepcache=1
<% else %>
keepcache=0
<% end %>
<% if @config.kernelpkgnames %>
kernelpkgnames=<%= @config.kernelpkgnames %>
<% end %>
<% if @config.localpkg_gpgcheck %>
localpkg_gpgcheck=<%= @config.localpkg_gpgcheck %>
<% end %>
<% if @config.logfile %>
logfile=<%= @config.logfile %>
<% end %>
<% if @config.max_retries %>
max_retries=<%= @config.max_retries %>
<% end %>
<% if @config.mdpolicy %>
mdpolicy=<%= @config.mdpolicy %>
<% end %>
<% if @config.metadata_expire %>
metadata_expire=<%= @config.metadata_expire %>
<% end %>
<% if @config.mirrorlist_expire %>
mirrorlist_expire=<%= @config.mirrorlist_expire %>
<% end %>
<% if @config.multilib_policy %>
multilib_policy=<%= @config.multilib_policy %>
<% end %>
<% if @config.obsoletes == false %>
obsoletes=0
<% else %>
obsoletes=1
<% end %>
<% if @config.overwrite_groups %>
overwrite_groups=<%= @config.overwrite_groups %>
<% end %>
<% if @config.password %>
password=<%= @config.password %>
<% end %>
<% if @config.persistdir %>
persistdir=<%= @config.persistdir %>
<% end %>
<% if @config.pluginconfpath %>
pluginconfpath=<%= @config.pluginconfpath %>
<% end %>
<% if @config.pluginpath %>
pluginpath=<%= @config.pluginpath %>
<% end %>
<% if @config.plugins %>
plugins=1
<% else %>
plugins=0
<% end %>
<% if @config.protected_multilib %>
protected_multilib=<%= @config.protected_multilib %>
<% end %>
<% if @config.protected_packages %>
protected_packages=<%= @config.protected_packages %>
<% end %>
<% if @config.proxy %>
proxy=<%= @config.proxy %>
<% end %>
<% if @config.proxy_password %>
proxy_password=<%= @config.proxy_password %>
<% end %>
<% if @config.proxy_username %>
proxy_username=<%= @config.proxy_username %>
<% end %>
<% if @config.recent %>
recent=<%= @config.recent %>
<% end %>
<% if @config.releasever %>
releasever=<%= @config.releasever %>
<% end %>
<% if @config.repo_gpgcheck %>
repo_gpgcheck=<%= @config.repo_gpgcheck %>
<% end %>
<% if @config.reposdir %>
reposdir=<%= @config.reposdir %>
<% end %>
<% if @config.reset_nice %>
reset_nice=<%= @config.reset_nice %>
<% end %>
<% if @config.rpmverbosity %>
rpmverbosity=<%= @config.rpmverbosity %>
<% end %>
<% if @config.showdupesfromrepos %>
showdupesfromrepos=<%= @config.showdupesfromrepos %>
<% end %>
<% if @config.skip_broken %>
skip_broken=<%= @config.skip_broken %>
<% end %>
<% if @config.ssl_check_cert_permissions %>
ssl_check_cert_permissions=<%= @config.ssl_check_cert_permissions %>
<% end %>
<% if @config.sslcacert %>
sslcacert=<%= @config.sslcacert %>
<% end %>
<% if @config.sslclientcert %>
sslclientcert=<%= @config.sslclientcert %>
<% end %>
<% if @config.sslclientkey %>
sslclientkey=<%= @config.sslclientkey %>
<% end %>
<% unless @config.sslverify.nil? %>
sslverify=<%= @config.sslverify %>
<% end %>
<% if @config.syslog_device %>
syslog_device=<%= @config.syslog_device %>
<% end %>
<% if @config.syslog_facility %>
syslog_facility=<%= @config.syslog_facility %>
<% end %>
<% if @config.syslog_ident %>
syslog_ident=<%= @config.syslog_ident %>
<% end %>
<% if @config.throttle %>
throttle=<%= @config.throttle %>
<% end %>
<% if @config.timeout %>
timeout=<%= @config.timeout %>
<% end %>
<% if @config.tolerant %>
tolerant=<%= ( @config.tolerant ) ? '1' : '0' %>
<% end %>
<% if @config.tsflags %>
tsflags=<%= @config.tsflags %>
<% end %>
<% if @config.username %>
username=<%= @config.username %>
<% end %>
<% if @config.options -%>
<% @config.options.each do |key, value| -%>
<%= key %>=<%=
case value
when Array
value.join("\n ")
when TrueClass
'1'
when FalseClass
'0'
else
value
end %>
<% end -%>
<% end -%>

View File

@@ -0,0 +1,125 @@
# This file was generated by Chef
# Do NOT modify this file by hand.
[<%= @config.repositoryid %>]
name=<%= @config.description %>
<% if @config.baseurl %>
baseurl=<%= @config.baseurl %>
<% end %>
<% if @config.cost %>
cost=<%= @config.cost %>
<% end %>
<% if @config.enabled %>
enabled=1
<% else %>
enabled=0
<% end %>
<% if @config.enablegroups %>
enablegroups=1
<% end %>
<% if @config.exclude %>
exclude=<%= @config.exclude %>
<% end %>
<% if @config.failovermethod %>
failovermethod=<%= @config.failovermethod %>
<% end %>
<% if @config.fastestmirror_enabled %>
fastestmirror_enabled=<%= @config.fastestmirror_enabled %>
<% end %>
<% if @config.gpgcheck %>
gpgcheck=1
<% else %>
gpgcheck=0
<% end %>
<% if @config.gpgkey %>
gpgkey=<%= case @config.gpgkey
when Array
@config.gpgkey.join("\n ")
else
@config.gpgkey
end %>
<% end -%>
<% if @config.http_caching %>
http_caching=<%= @config.http_caching %>
<% end %>
<% if @config.include_config %>
include=<%= @config.include_config %>
<% end %>
<% if @config.includepkgs %>
includepkgs=<%= @config.includepkgs %>
<% end %>
<% if @config.keepalive %>
keepalive=1
<% end %>
<% if @config.metadata_expire %>
metadata_expire=<%= @config.metadata_expire %>
<% end %>
<% if @config.mirrorlist %>
mirrorlist=<%= @config.mirrorlist %>
<% end %>
<% if @config.mirror_expire %>
mirror_expire=<%= @config.mirror_expire %>
<% end %>
<% if @config.mirrorlist_expire %>
mirrorlist_expire=<%= @config.mirrorlist_expire %>
<% end %>
<% if @config.priority %>
priority=<%= @config.priority %>
<% end %>
<% if @config.proxy %>
proxy=<%= @config.proxy %>
<% end %>
<% if @config.proxy_username %>
proxy_username=<%= @config.proxy_username %>
<% end %>
<% if @config.proxy_password %>
proxy_password=<%= @config.proxy_password %>
<% end %>
<% if @config.username %>
username=<%= @config.username %>
<% end %>
<% if @config.password %>
password=<%= @config.password %>
<% end %>
<% if @config.repo_gpgcheck %>
repo_gpgcheck=1
<% end %>
<% if @config.max_retries %>
retries=<%= @config.max_retries %>
<% end %>
<% if @config.report_instanceid %>
report_instanceid=<%= @config.report_instanceid %>
<% end %>
<% if @config.skip_if_unavailable %>
skip_if_unavailable=1
<% end %>
<% if @config.sslcacert %>
sslcacert=<%= @config.sslcacert %>
<% end %>
<% if @config.sslclientcert %>
sslclientcert=<%= @config.sslclientcert %>
<% end %>
<% if @config.sslclientkey %>
sslclientkey=<%= @config.sslclientkey %>
<% end %>
<% unless @config.sslverify.nil? %>
sslverify=<%= @config.sslverify %>
<% end %>
<% if @config.timeout %>
timeout=<%= @config.timeout %>
<% end %>
<% if @config.options -%>
<% @config.options.each do |key, value| -%>
<%= key %>=<%=
case value
when Array
value.join("\n ")
when TrueClass
'1'
when FalseClass
'0'
else
value
end %>
<% end -%>
<% end -%>