Update cookbooks for Ubuntu 16.04 TLS

This commit is contained in:
Greg Karékinian
2017-03-31 19:20:00 +02:00
parent 6430d71006
commit 8923d0d7ef
219 changed files with 2770 additions and 11511 deletions

View File

@@ -1 +0,0 @@
~FC016

View File

@@ -2,31 +2,6 @@
This file is used to list changes made in each version of the yum cookbook.
## 5.0.0 (2017-02-12)
### Breaking changes
- Removed the yum_repository resource and instead require chef-client 12.14 or later, which has the yum repository functionality built in. This resolves Chef 13 compatibility warnings for any cookbook with the yum cookbook.
### Other changes
- Convert yum_globalconfig from an LWRP to a custom resource
## 4.2.0 (2017-02-12)
- Make cache in the DNF compat recipe
- Fix `fastestmirror_enabled`.
- Require Chef 12.1 not 12.0
- Convert to Inspec
## 4.1.0 (2016-10-21)
- Purge yum cache before removing a repo not after
## 4.0.0 (2016-09-06)
- Remove support for Chef 11
## 3.13.0 (2016-09-06)
- Add deprecation warning for add/remove actions, which were replaced with create/delete in Yum 3.0

View File

@@ -1,10 +1,13 @@
<!-- This is a generated file. Please do not edit directly -->
# Maintainers
This file lists how this cookbook project is maintained. When making changes to the system, this
file tells you who needs to review your patch - you need a simple majority of maintainers
for the relevant subsystems to provide a :+1: on your pull request. Additionally, you need
to not receive a veto from a Lieutenant or the Project Lead.
This file lists how this cookbook project is maintained. When making changes to the system, this file tells you who needs to review your patch - you need a review from an existing maintainer for the cookbook to provide a :+1: on your pull request. Additionally, you need to not receive a veto from a Lieutenant or the Project Lead.
Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD) for details on the process and how to become a maintainer or the project lead.
Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD)
for details on the process and how to become a maintainer or the project lead.
# Project Maintainer
* [Tim Smith](https://github.com/tas50)

View File

@@ -1,28 +1,92 @@
# yum Cookbook
[![Build Status](https://travis-ci.org/chef-cookbooks/yum.svg?branch=master)](http://travis-ci.org/chef-cookbooks/yum) [![Cookbook Version](https://img.shields.io/cookbook/v/yum.svg)](https://supermarket.chef.io/cookbooks/yum)
The Yum cookbook exposes the `yum_globalconfig` resource which allows a user to control global yum behavior. This resources aims 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>
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](http://linux.die.net/man/5/yum.conf)
## Requirements
### Platforms
- RHEL/CentOS and derivatives
- Fedora
### Chef
- Chef 12.14+
- Chef 11+
### Cookbooks
- none
## Resources
## 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 some internal company repo
yum_repository 'OurCo' do
description 'OurCo yum repository'
mirrorlist 'http://artifacts.ourco.org/mirrorlist?repo=ourco-6&arch=$basearch'
gpgkey 'http://artifacts.ourco.org/pub/yum/RPM-GPG-KEY-OURCO-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
- `clean_metadata` - Run "yum clean metadata <reponame>" during repository creation. defaults to true.
- `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.
- `sensitive` - Optional, Default is `false`, if `true` then content of repository file is hidden from chef run output.
- `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
@@ -37,30 +101,22 @@ yum_globalconfig '/my/chroot/etc/yum.conf' do
end
```
#### Properties
`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>
#### 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](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'.
- `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`
- `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.
### yum_repository
This resource is now provided by chef-client 12.14 and later and has been removed from this cookbook. If you require this resource we highly recommend upgrading your chef-client, but if that is not an option you can pin the 4.X yum cookbook.
## Recipes
- `default` - Configures `yum_globalconfig[/etc/yum.conf]` with values found in node attributes at `node['yum']['main']`
- `dnf_yum_compat` - Installs the yum package using dnf on Fedora systems to provide support for the package resource in recipes. This is necessary on chef-client < 12.18\. This recipe should be 1st on a Fedora runlist
- `dnf_yum_compat` - Installs the yum package using dnf on Fedora systems to provide support for the package resource in recipes. This is necessary as Chef does not yet (as of Q4 2015) have native support for DNF. This recipe should be 1st on a Fedora runlist
## Attributes
The following attributes are set by default
```ruby
@@ -76,16 +132,14 @@ default['yum']['main']['installonlypkgs'] = nil
default['yum']['main']['installroot'] = nil
```
For Amazon platform nodes,
For Amazon platform nodes,
```ruby
default['yum']['main']['releasever'] = 'latest'
```
## 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
@@ -97,11 +151,9 @@ Recipes from older versions of this cookbook have been moved individual cookbook
- 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](mailto:matt@chef.io))
- Author:: Joshua Timberman ([joshua@chef.io](mailto:joshua@chef.io))
@@ -109,7 +161,7 @@ Put `depends 'yum'` in your metadata.rb to gain access to the yum_repository res
```text
Copyright:: 2011 Eric G. Wolfe
Copyright:: 2013-2017 Chef Software, Inc.
Copyright:: 2013-2016 Chef Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@@ -1,4 +1,20 @@
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

View File

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

View File

@@ -0,0 +1,40 @@
#
# Cookbook Name:: yum
# Provider:: repository
#
# Author:: Sean OMeara <someara@chef.io>
# Copyright 2013-2016, Chef Software, Inc.
#
# 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.
#
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,115 @@
#
# Cookbook Name:: yum
# Provider:: repository
#
# Author:: Sean OMeara <someara@chef.io>
# Copyright 2013-2016, Chef Software, Inc.
#
# 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.
use_inline_resources
def whyrun_supported?
true
end
action :add do
Chef::Log.warn('The :add method in yum_repository has been deprecated in favor of :create. Please update your cookbook to use the :create action')
action_create
end
action :remove do
Chef::Log.warn('The :remove method in yum_repository has been deprecated in favor of :delete. Repository deletion in Chef 12.14+ with :remove will fail')
action_delete
end
action :create do
if new_resource.clean_headers
Chef::Log.warn <<-eos
Use of `clean_headers` in resource yum[#{new_resource.repositoryid}] is now deprecated and will be removed in a future release.
`clean_metadata` should be used instead
eos
end
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
sensitive new_resource.sensitive
variables(config: new_resource)
if new_resource.make_cache
notifies :run, "execute[yum clean metadata #{new_resource.repositoryid}]", :immediately if new_resource.clean_metadata || new_resource.clean_headers
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 metadata #{new_resource.repositoryid}" do
command "yum clean metadata --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 -y 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 all #{new_resource.repositoryid}]", :immediately
notifies :create, "ruby_block[yum-cache-reload-#{new_resource.repositoryid}]", :immediately
end
execute "yum clean all #{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

View File

@@ -3,7 +3,7 @@
# Author:: Joshua Timberman (<joshua@chef.io>)
# Recipe:: yum::default
#
# Copyright:: 2013-2016, Chef Software, Inc (<legal@chef.io>)
# Copyright 2013-2016, 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.

View File

@@ -2,7 +2,7 @@
# Author:: Tim Smith (<tsmith@chef.io>)
# Recipe:: yum::fedora_yum_compat
#
# Copyright:: 2015-2016, Chef Software, Inc (<legal@chef.io>)
# Copyright 2015-2016, 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.
@@ -16,14 +16,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
execute 'make yum cache' do
command 'yum makecache'
action :nothing
end
execute 'install yum' do
command 'dnf install yum -y'
not_if { ::File.exist?('/var/lib/yum') }
action :nothing
notifies :run, 'execute[make yum cache]', :immediately
end.run_action(:run)

View File

@@ -1,9 +1,9 @@
#
# Cookbook:: yum
# Cookbook Name:: yum
# Resource:: repository
#
# Author:: Sean OMeara <someara@chef.io>
# Copyright:: 2013-2017, Chef Software, Inc.
# Copyright 2013-2016, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,102 +18,92 @@
# limitations under the License.
#
actions :create, :delete
default_action :create
# http://linux.die.net/man/5/yum.conf
property :alwaysprompt, [TrueClass, FalseClass]
property :assumeyes, [TrueClass, FalseClass]
property :bandwidth, String, regex: /^\d+/
property :bugtracker_url, String, regex: /.*/
property :clean_requirements_on_remove, [TrueClass, FalseClass]
property :cachedir, String, regex: /.*/, default: '/var/cache/yum/$basearch/$releasever'
property :color, String, equal_to: %w(always never)
property :color_list_available_downgrade, String, regex: /.*/
property :color_list_available_install, String, regex: /.*/
property :color_list_available_reinstall, String, regex: /.*/
property :color_list_available_upgrade, String, regex: /.*/
property :color_list_installed_extra, String, regex: /.*/
property :color_list_installed_newer, String, regex: /.*/
property :color_list_installed_older, String, regex: /.*/
property :color_list_installed_reinstall, String, regex: /.*/
property :color_search_match, String, regex: /.*/
property :color_update_installed, String, regex: /.*/
property :color_update_local, String, regex: /.*/
property :color_update_remote, String, regex: /.*/
property :commands, String, regex: /.*/
property :debuglevel, String, regex: /^\d+$/, default: '2'
property :deltarpm, [TrueClass, FalseClass]
property :diskspacecheck, [TrueClass, FalseClass]
property :distroverpkg, String, regex: /.*/
property :enable_group_conditionals, [TrueClass, FalseClass]
property :errorlevel, String, regex: /^\d+$/
property :exactarch, [TrueClass, FalseClass], default: true
property :exclude, String, regex: /.*/
property :gpgcheck, [TrueClass, FalseClass], default: true
property :group_package_types, String, regex: /.*/
property :groupremove_leaf_only, [TrueClass, FalseClass]
property :history_list_view, String, equal_to: %w(users commands single-user-commands)
property :history_record, [TrueClass, FalseClass]
property :history_record_packages, String, regex: /.*/
property :http_caching, String, equal_to: %w(packages all none)
property :installonly_limit, String, regex: [/^\d+/, /keep/], default: '3'
property :installonlypkgs, String, regex: /.*/
property :installroot, String, regex: /.*/
property :keepalive, [TrueClass, FalseClass]
property :keepcache, [TrueClass, FalseClass], default: false
property :kernelpkgnames, String, regex: /.*/
property :localpkg_gpgcheck, [TrueClass, FalseClass]
property :logfile, String, regex: /.*/, default: '/var/log/yum.log'
property :max_retries, String, regex: /^\d+$/
property :mdpolicy, String, equal_to: %w(instant group:primary group:small group:main group:all)
property :metadata_expire, String, regex: [/^\d+$/, /^\d+[mhd]$/, /never/]
property :mirrorlist_expire, String, regex: /^\d+$/
property :multilib_policy, String, equal_to: %w(all best)
property :obsoletes, [TrueClass, FalseClass]
property :overwrite_groups, [TrueClass, FalseClass]
property :password, String, regex: /.*/
property :path, String, regex: /.*/, name_property: true
property :persistdir, String, regex: /.*/
property :pluginconfpath, String, regex: /.*/
property :pluginpath, String, regex: /.*/
property :plugins, [TrueClass, FalseClass], default: true
property :protected_multilib, [TrueClass, FalseClass]
property :protected_packages, String, regex: /.*/
property :proxy, String, regex: /.*/
property :proxy_password, String, regex: /.*/
property :proxy_username, String, regex: /.*/
property :recent, String, regex: /^\d+$/
property :releasever, String, regex: /.*/
property :repo_gpgcheck, [TrueClass, FalseClass]
property :reposdir, String, regex: /.*/
property :reset_nice, [TrueClass, FalseClass]
property :rpmverbosity, String, equal_to: %w(info critical emergency error warn debug)
property :showdupesfromrepos, [TrueClass, FalseClass]
property :skip_broken, [TrueClass, FalseClass]
property :ssl_check_cert_permissions, [TrueClass, FalseClass]
property :sslcacert, String, regex: /.*/
property :sslclientcert, String, regex: /.*/
property :sslclientkey, String, regex: /.*/
property :sslverify, [TrueClass, FalseClass]
property :syslog_device, String, regex: /.*/
property :syslog_facility, String, regex: /.*/
property :syslog_ident, String, regex: /.*/
property :throttle, String, regex: [/\d+k/, /\d+M/, /\d+G/]
property :timeout, String, regex: /^\d+$/
property :tolerant, [TrueClass, FalseClass]
property :tsflags, String, regex: /.*/
property :username, String, regex: /.*/
property :options, Hash
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 :deltarpm, kind_of: [TrueClass, FalseClass], default: nil
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: /.*/, 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
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
attribute :options, kind_of: Hash

View File

@@ -0,0 +1,71 @@
#
# Cookbook Name:: yum
# Resource:: repository
#
# Author:: Sean OMeara <someara@chef.io>
# Copyright 2013-2016, Chef Software, Inc.
#
# 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, Array], regex: /.*/, default: nil
attribute :cost, kind_of: String, regex: /^\d+$/, default: nil
attribute :clean_headers, kind_of: [TrueClass, FalseClass], default: false # deprecated
attribute :clean_metadata, kind_of: [TrueClass, FalseClass], default: true
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, Integer], 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 :sensitive, kind_of: [TrueClass, FalseClass], default: false
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: nil
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,130 @@
# This file was generated by Chef
# Do NOT modify this file by hand.
[<%= @config.repositoryid %>]
name=<%= @config.description %>
<% if @config.baseurl %>
baseurl=<%= case @config.baseurl
when Array
@config.baseurl.join("\n")
else
@config.baseurl
end %>
<% 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 ) ? 'true' : 'false' %>
<% 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 -%>