Git Product home page Git Product logo

yum's Introduction

yum Cookbook

Cookbook Version CI State OpenCollective OpenCollective License

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://man7.org/linux/man-pages/man5/yum.conf.5.html

Maintainers

This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit sous-chefs.org or come chat with us on the Chef Community Slack in #sous-chefs.

Requirements

Platforms

  • RHEL/CentOS and derivatives
  • Fedora

Chef

  • Chef 15.3+

Cookbooks

  • none

Resources

Recipes (deprecated)

  • 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

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

For Amazon platform nodes, the default is to receive a continuous flow of updates,

default['yum']['main']['releasever'] = 'latest'

To lock existing instances to the current version of the Amazon AMI,

default['yum']['main']['releasever'] = ''

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.

Contributors

This project exists thanks to all the people who contribute.

Backers

Thank you to all our backers!

https://opencollective.com/sous-chefs#backers

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

https://opencollective.com/sous-chefs/sponsor/0/website https://opencollective.com/sous-chefs/sponsor/1/website https://opencollective.com/sous-chefs/sponsor/2/website https://opencollective.com/sous-chefs/sponsor/3/website https://opencollective.com/sous-chefs/sponsor/4/website https://opencollective.com/sous-chefs/sponsor/5/website https://opencollective.com/sous-chefs/sponsor/6/website https://opencollective.com/sous-chefs/sponsor/7/website https://opencollective.com/sous-chefs/sponsor/8/website https://opencollective.com/sous-chefs/sponsor/9/website

yum's People

Contributors

alanivey avatar atrbgithub avatar bigkraig avatar breu avatar chuckfloyd avatar damacus avatar detjensrobert avatar eedgar avatar guilhem avatar hynd avatar iennae avatar jblaine avatar johntdyer avatar jontg avatar jtimberman avatar juliandunn avatar kierenevans avatar kitchen-porter avatar matt-thomson avatar mattray avatar miketheman avatar nathenharvey avatar prajaktapurohit avatar ramereth avatar renovate[bot] avatar schwing avatar sethvargo avatar tas50 avatar tk0miya avatar xorimabot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yum's Issues

enabling a yum repo should implicitly set the `manage` attribute to true

Cookbook version

4.1.0

Chef-client version

12.14.89

Platform Details

redhat 6

Scenario:

I intended to enable a yum repo, but setting only the yum//enable attribute doesn't do the trick. It also requires setting the yum//managed attribute to true before a file is dropped onto /etc/yum.repos.d/.repo.

Steps to Reproduce:

in a role, set the enabled attribute to true:

    "yum": {
      "remi": {
        "enabled": true
      }
    }

Expected Result:

I should see /etc/yum.repos.d/remi.repo on the target node. Setting the enabled attribute should imply that the managed attribute is also true.

Actual Result:

nothing is created.

Bug in yum.conf defaults affecting CentOS 5

Hi:

The default value of /var/cache/yum/$basearch/$releasever in ./attributes/main.rb does not actually have $basearch and $releasever substituted with their values on CentOS 5:

[vagrant@default-centos-510 $releasever]$ pwd
/var/cache/yum/$basearch/$releasever
[vagrant@default-centos-510 $releasever]$ ls
base  epel  extras  updates

Which is not technically an invalid path, but it is a bit ugly and has some interesting side effects.

If:

  • a repository is installed without using the yum cookbook (via a noarch rpm, which is a common way to install repo configs, or just directly as a file managed by chef in to /etc/yum.repos.d/)
  • the repository has a GPG key for either repository metadata or rpm signature checking
  • a repository is installed using the yum cookbook AFTER the above happens

Then:

  • the GPG keys will appear to have failed being imported

because the gpg keys are written to the cachedir, then the cachedir is overwritten by chef to be "/var/cache/yum/$basearch/$releasever", and so yum can't find keys written to the old cachedir.

Anyone using CentOS 6 or CentOS 7 wouldn't be affected because:

  • the default path on those systems is /var/cache/yum/$basearch/$releasever
  • the substitution actually works there.
  • 99.999...9% of people never touch /var/cache/yum/$basearch/$releasever so even when yum.conf gets overwritten by chef, it is overwritten to the default value where all the directories and keys and stuff already are.

On CentOS 5, the default path is: /var/cache/yum.

I'd suggest changing the default path to be /var/cache/yum in the yum cookbook for CentOS 5 and leaving the default path unchanged for CentOS 6 and 7 as it works fine as is.

yum_globalconfig doesn't read attributes

Cookbook version

5.1.0

Chef-client version

13.8.5

Platform Details

CentOS Linux 7.5

Scenario:

Perhaps I'm misunderstanding how yum_globalconfig works, but I'm trying to get it to create an /etc/yum.conf file with attributes that I set in default['yum']['main']. The attributes are set, but the /etc/yum/conf file that is created doesn't reflect those attributes.

Steps to Reproduce:

In my cookbook I have the following:

node.default['yum']['main']['exclude'] = 'foo'
yum_globalconfig '/etc/yum.conf' do
    action :create
end 

Expected Result:

I expect to see an "exclude=" line in /etc/yum.conf, e.g.

[main]
cachedir=/var/cache/yum/$basearch/$releasever
debuglevel=2
exactarch=1
exclude=foo
gpgcheck=1

This is what I get if I actually put the 'exclude' statement inside yum_globalconfig, like this:

yum_globalconfig '/etc/yum.conf' do
    exclude 'foo'
    action :create
end 

But I prefer to do this with attributes.

Actual Result:

The 'exclude=' line is missing from /etc/yum.conf:

[main]
cachedir=/var/cache/yum/$basearch/$releasever
debuglevel=2
exactarch=1
gpgcheck=1

Not using downloaded repomd.xml because it is older than what we have

yum makecache fails inside the yum_repository provider when you point to a mirror with an older repomd.xml than what has already been downloaded. This could happen if you start out pointing to an official mirror, then reconfigure yum to point to your own local mirror (which may not have had a chance to sync up yet):

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of yum -q makecache --disablerepo=* --enablerepo=foo ----
STDOUT:
STDERR: Not using downloaded repomd.xml because it is older than what we have:
 Current  : Tue Oct  7 15:14:53 2014
 Downloaded: Thu Oct  2 15:00:04 2014
http://example.com/repodata/filelists.xml.gz: [Errno -1] Metadata file does not match checksum
Trying other mirror.
Error: failure: repodata/filelists.xml.gz from foo: [Errno 256] No more mirrors to try.
---- End output of yum -q makecache --disablerepo=* --enablerepo=foo ----
Ran yum -q makecache --disablerepo=* --enablerepo=foo returned 1

I think the solution is to run a yum clean before running yum makecache. Unless there's some flag I'm missing to force yum to use the older repomd.xml.

disable the repo

I would like to have "disable the repository action available".
Do you think it can be useful?

I might look into that...

Support for `createrepo`

Enhancement request: it would be helpful if this cookbook could help use createrepo to create a local repository. This could either be another resource, or a property on the repository resource.

Yum cache should be purged before repository config file is deleted

The yum clean command only operates against repositories that are currently defined and enabled.
From the yum man page:

CLEAN OPTIONS
The following are the ways which you can invoke yum in clean mode. Note
that "all files" in the commands below means "all files in currently
enabled repositories". If you want to also clean any (temporarily)
disabled repositories you need to use --enablerepo=’*’ option.

In the provider, the repository config file is deleted and then the cache is cleaned; however, this means that the cache is left intact for the cache that you just removed.
It looks like the provider is trying to explicitly enable the deleted repo, but if you try this on a box with a repo that's undefined, you get an error:

[root@server01 yum]# yum clean all --disablerepo=* --enablerepo=chef_stable
Loaded plugins: security


Error getting repository data for chef_stable, repository not found

The provider should try to flush the cache first, delete the repository file, and then reload the cache.

A :before timer could be used instead of :immediately, but that is only supported in Chef 12+ somewhere. Alternatively, an only_if block could be used to test for the file's existence, which would preserve chef 11 support.

diskspacecheck parameter cannot be set to 'false'

If you attempt to set 'diskspacecheck' to 'false', the diskspacecheck parameter does not get written to the config file at all. Because the parameter defaults to true, there is no way to set it to false via this cookbook.

obsoletes appears to have an unexpected behavior

the obsoletes attribute is defaulted to nil
the resource for globalconfig then sets the default of true.

when the recipe runs this "under the covers" set the default to true which chef compiles the resource in.

the only way to make obsoletes false in this scenario, i think, is to make a node override of false.

i would request that the attribute be defaulted to true and to have the resource not have a default

yum makecache fails for resource with remote repository key

Hi - I'm not certain this is a bug with this cookbook, so apologies in advance if not. I have a problem installing a repository with repo_gpgcheck = true without manual intervention.

Version info:

  • Chef 12.3.0
  • Centos 7.0
  • yum cookbook 3.6.1

Steps to reproduce:

Converge the following recipe:

# somecookbook/recipes/default.rb

yum_repository "passenger" do
  description "Phusion Passenger repository"
  baseurl "https://oss-binaries.phusionpassenger.com/yum/passenger/el/$releasever/$basearch"
  gpgcheck false
  repo_gpgcheck true
  gpgkey "https://packagecloud.io/gpg.key"
end

Output:

[2015-06-19T12:31:57+00:00] ERROR: yum_repository[passenger] (somecookbook::default line 14) had an error: Mixlib::ShellOut::ShellCommandFailed: execute[yum-makecache-passenger] (/tmp/kitchen/cookbooks/yum/providers/repository.rb line 61) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of yum -q makecache --disablerepo=* --enablerepo=passenger ----
STDOUT: Is this ok [y/N]:
STDERR: Importing GPG key 0xD59097AB:
 Userid     : "packagecloud ops (production key) <[email protected]>"
 Fingerprint: 418a 7f2f b0e1 e6e7 eabf 6fe8 c2e7 3424 d590 97ab
 From       : https://packagecloud.io/gpg.key
https://oss-binaries.phusionpassenger.com/yum/passenger/el/7/x86_64/repodata/repomd.xml: [Errno -1] Gpg Keys not imported, cannot verify repomd.xml for repo passenger
Trying other mirror.

The problem appears to be that an interactive prompt is generated, receives the default response and the repo verification fails as a result, preventing the makecache call from succeeding. If I manually run the command with -y on the node, the recipe then converges successfully:

$ yum -q makecache -y --disablerepo=* --enablerepo=passenger

FWIW this is how packagecloud's own cookbook handles it. Even if I switch the key reference to a local file (even one in /etc/pki/rpm-gpg) the prompt still appears and the node fails to converge.

Would a patch adding the -y flag to the makecache call be considered, or is that barking up completely the wrong tree?

baseurl should support multiple url per documentation

Cookbook version

  • yum (3.10.0)

Chef-client version

Starting Chef Client, version 12.9.41

Platform Details

CentOS 6.7

Scenario:

Per the baseurl documentation i expect to be able to specify multiple url.

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.

Steps to Reproduce:

yum_repository 'centos' do
description "demo"
baseurl [ 'http://mirror.hmc.edu/centos/6.7/os/x86_64/', 'http://mirrors.liquidweb.com/CentOS/6.7/os/x86_64/ ]
gpgkey 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6'
action :create
end

Expected Result:

this should produce 1 baseurl entry and the addition entry should be url. as in manpage
reference http://linux.die.net/man/5/yum.conf

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. The best way to do this is like this:

[repositoryid]
name=Some name for this repository
baseurl=url://server1/path/to/repository/
url://server2/path/to/repository/
url://server3/path/to/repository/

Actual Result:

only produces a single baseurl

Parent directory /etc/yum.repos.d does not exist - On Centos 6.4

We are using this cookbook on Centos 6.4, and get the folowing error, as the repository.rb never makes the nessessary folder etc/yum.repos.d
Chef::Exceptions::EnclosingDirectoryDoesNotExist

template[/etc/yum.repos.d/mysql56-community.repo](/tmp/kitchen/cache/cookbooks/yum/providers/repository.rb line 39) had an error: Chef::Exceptions::EnclosingDirectoryDoesNotExist: Parent directory /etc/yum.repos.d does not exist.

on centos 6.6 this error disappears, so its version specific.

greetings alex

EDIT: was using accidently ubuntu 12.04 while this error occured, issue closed

Need to be able to prevent makecache in yum_repository, then manually trigger it

I have a recipe which installs several repositories:

%w{ftp3 ftp3-updates ftp3-optional ftp3-supplementary}.each do |repo|
  yum_repository repo do
    description node['yum'][repo]['description']
    baseurl node['yum'][repo]['baseurl']
    gpgkey node['yum'][repo]['gpgkey']
    enabled node['yum'][repo]['enabled']
  end
end

I've observed a significant delay after each repository add instead of waiting until all are complete. This per-repository action seems to unnecessarily extend the recipe's run time by several minutes.

I think that I'd like the ability to suppress the makecache and Chef yum cache rebuild until after I've added all of the repositories. Then, I can manually trigger the actions.

max tries

it is failing if you setup any numeric value like 2 ..
and if is set up "2", it is failing in repo side...

Have you guys tested it..
I am setting up values in environment file

yum clean headers change breaks dnf compatibility

This change 121da3b which introduced a yum clean headers call in place of yum clean all has broken compatibility with dnf. We had been using this cook with dnf on fedora-22 for several weeks with no other issues, FWIW.

    docker: [2015-09-08T01:20:15+00:00] ERROR: yum_repository[fedora] (pantheon_package_repository::fedora line 8) had an error: Mixlib::ShellOut::ShellCommandFailed: execute[yum clean fedora] (/opt/pantheon/infrastructure/cookbooks/yum/providers/repository.rb line 55) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
    docker: ---- Begin output of yum clean headers --disablerepo=* --enablerepo=fedora ----
    docker: STDOUT:
    docker: STDERR: Yum command has been deprecated, redirecting to '/usr/bin/dnf clean headers --disablerepo=* --enablerepo=fedora'.
    docker: See 'man dnf' and 'man yum2dnf' for more information.
    docker: To transfer transaction metadata from yum to DNF, run:
    docker: 'dnf install python-dnf-plugins-extras-migrate && dnf-2 migrate'
    docker:
    docker: Error: invalid clean argument: u'headers'
    docker: Mini usage:
    docker:
    docker: clean [packages|metadata|dbcache|plugins|expire-cache|all]

yum clean metadata might be an acceptable compromise for yum and dnf? I'm not sure what the difference between metadata and headers is, though, and mostly just wondering if someone else already has a good answer here.

"releasever" should be set to "latest" on Amazon Linux

not entirely sure if this is the right place.

one of my dependencies uses the yum cookbook version ~>3.6 and i've come to realize that it removes the pair releasever=latest from /etc/yum.conf, thereby breaking the rolling release mechanism of Amazon's distro. This should probably be considered, as the default in this cookbook equals nil, afaik.

does that make sense?

Installation of packages on centos

Cookbook version

yum 3.10.0

Chef-client version

version 12.11.18

Platform Details

Centos openlogic- 7.1 azure VM

Scenario:

I want to install these packages
gcc gcc-c++ graphviz graphviz-devel patchutils gd gd-devel wget perl* -x perl-homedir

Steps to Reproduce:

[If you are filing an issue what are the things we need to do in order to repro your problem? How are you using this cookbook or any resources it includes?]

Expected Result:

Installation of above packages

How can I install them?

support globalconfig options available to newer versions of yum

Cookbook version

5.1.0

Chef-client version

12 - 15

Platform Details

CentOS Linux release 7.7.1908

Scenario:

I'd like to use yum_globalconfig to set ip_resolve=4 in the default yum configuration file.

Steps to Reproduce:

Nothing to do here.

Expected Result:

Ability to leave ip_resolve unset, or set to either 4 or 6

Actual Result:

n/a

5.1.0 is not available from the supermarket

Cookbook version

5.1.0

Chef-client version

12.13.37

Platform Details

macOS

Scenario:

Trying to download yum 5.1.0 from the chef supermarket

Steps to Reproduce:

knife cookbook site show yum

Expected Result:

expect knife to show 5.1.0 version since it was release back in Aug per the CHANGELOG

Actual Result:

Only shows the 5.0.1 version

average_rating:  
category:        Other
created_at:      2011-04-20T22:16:12.000Z
deprecated:      false
description:     Configures various yum components on Red Hat-like systems
external_url:    https://github.com/chef-cookbooks/yum
issues_url:      https://github.com/chef-cookbooks/yum/issues
latest_version:  https://supermarket.chef.io/api/v1/cookbooks/yum/versions/5.0.1

yum_repository support for :enable and :disable repositories

I have a use case where I am using a third party cookbook which installs a rpm package via a yum repository on a RHEL 7 OS in AWS. The problem I am experiencing is that the rpm package is in a RHEL optional repository that is not enabled by default. I figured with this cookbook, I could own the AWS RHEL repository and create definitions for all of the various AWS RHEL repositories.

However instead of doing that, it may be an interesting use case (since this cookbook effectively owns the yum_repository namespace 😄 ) if yum_repository could have two actions to enable and disable a repository without having to own the entire repository definition. I figured behind the scenes it would perform a yum-config-manager --enable or yum-config-manager --disable behind the scenes.

If this is something that you think would fit into the purview of this cookbook, I would be more than happy to whip something up.

Just wanted to run this past you before doing so.

Thanks!

Can't unset mirrorlist

I have a deployment scenario in which I only want to use a specific baseurl for the repos. I can set this just fine with attributes, however there does not seem to be a way to unset mirrorlist.

yum makecache in a recipe

Scenario:

The apt Cookbook provides a mechanism to do an apt-get update as part of the chef run in its default recipe. I am wondering if the yum Cookbook should provide a similar construct for parity which seems like it would be yum makecache

where can i download chef client for rhel 8

Cookbook version

[Version of the cookbook where you are encountering the issue]

Chef-client version

[Version of chef-client in your environment]

Platform Details

[Operating system distribution and release version. Cloud provider if running in the cloud]

Scenario:

[What you are trying to achieve and you can't?]

Steps to Reproduce:

[If you are filing an issue what are the things we need to do in order to repro your problem? How are you using this cookbook or any resources it includes?]

Expected Result:

[What are you expecting to happen as the consequence of above reproduction steps?]

Actual Result:

[What actually happens after the reproduction steps? Include the error output or a link to a gist if possible.]

i don't see the chef client rpm for rhel 8
https://downloads.chef.io/chef, Can someone please tell me

[QUESTION] yum cookbook backward compatibility promises

Cookbook version

5.0.0

Question

I noticed that this cookbook is certified for use with Chef Client version 12.14+. The question I have is that I would have thought the the community maintained cookbooks published by Chef would have the same backwards compatibility promise as the Chef Client (back to v12.0). Is this no longer the case? Just curious.

tolerant returns "true" string in yum config (and other attributes are amiss)

Here is an example of my yum.conf after a chef run.

My role set the attribute node["yum"]["main"]["tolerant"] to TrueClass. Note how the value was not turned into a 1 inside of the config.

I also noticed that multilib_policy is set in the documentation as an array, but the resource demands a string. Perhaps other config attributes are amiss as well!

# This file was generated by Chef
# Do NOT modify this file by hand.

[main]
cachedir=/var/cache/yum/$basearch/$releasever
debuglevel=2
distroverpkg=centos-release
exactarch=1
gpgcheck=1
installonly_limit=3
keepcache=0
logfile=/var/log/yum.log
multilib_policy=best
obsoletes=1
plugins=1
tolerant=true
tsflags=repackage

'Deprecated features used!' warning message

Warning message from Chef 13

==> Server-003: Deprecated features used!

==> Server-003:   Cannot specify both default and name_property together on property path of resource yum_globalconfig. Only one (name_property) will be obeyed. In Chef 13, this will become an error. at 1 location:

==> Server-003:     - /var/chef/cache/cookbooks/yum/resources/globalconfig.rb:76:in `class_from_file'

==> Server-003:   version nil currently does not overwrite the value of version. This will change in Chef 13, and the value will be set to nil instead. Please change your code to explicitly accept nil using "property :version, [MyType, nil]", or stop setting this value to nil. at 3 locations:

==> Server-003:     - /var/chef/cache/cookbooks/python/recipes/pip.rb:52:in `block in from_file'

==> Server-003:     - /var/chef/cache/cookbooks/python/recipes/virtualenv.rb:25:in `block in from_file'

==> Server-003:     - /var/chef/cache/cookbooks/python/providers/pip.rb:98:in `load_current_resource'

sslverify default value issue

As per resources sslverify can take either true or false
resources/repository.rb
attribute :sslverify, :kind_of => [TrueClass, FalseClass], :default => true
but in template it checks sslverify is nil ..
<% unless @config.sslverify.nil? %>
sslverify=<%= @config.sslverify %>
<% end %>

Because of this when I use the LWRP
sslverify nil => repo file has sslverify=true

In my opinion
attribute :sslverify, :kind_of => [TrueClass, FalseClass], :default => true
should be
attribute :sslverify, :kind_of => [TrueClass, FalseClass], :default => nil

Provide a way to make `yum clean REPO_NAME` optional

We're testing a bunch of cookbooks using kitchen and vagrant-cachier to cache yum, apt, rubygems and a few other packages.

However the yum clean operation that got added in version 3.6 is a bit of an inconvenience because it blows away all yum caches.

I'm happy to submit a PR to make that behaviour optional by specifying a yum_clean (?) parameter that defaults to true, but can be turned off if desired.

Thoughts?

/cc @someara (the original author who added that line of code)

Resolve Chef 13 deprecation warning

   Deprecated features used!
     Cannot specify both default and name_property together on property path of resource yum_globalconfig. Only one (name_property) will be obeyed. In Chef 13, this will become an error. at 1 location:
       - /tmp/kitchen/cache/cookbooks/yum/resources/globalconfig.rb:77:in `class_from_file'

Locking Amazon Linux to a specific version via releasever

Cookbook version

5.0.1

Chef-client version

12.19.36

Platform Details

AWS, various AMIs

Scenario:

Amazon releases new AMIs semi-annually. New AMIs may include breaking changes, somewhat akin to a RHEL or CentOS major release. I would like to lock the AMI to a specific release. Per Amazon's instructions:

To lock existing instances to their current version (indicated in /etc/system-release), edit /etc/yum.conf. Comment out the line that reads releasever=latest and run yum clean all to clear the cache.

Steps to Reproduce:

I have created a role to configure the yum cookbook to render /etc/yum.conf:

{
  "name": "my_yum",
  "description": "Apply MyCO's standard config to yum.conf",
  "json_class": "Chef::Role",
  "default_attributes": {
      "yum": {
          "main": {
              "exclude": "kernel* nginx* mongo* mysql-server* varnish* Percona-Server-server*",
              "exactarch": true,
              "obsoletes": true,
              "gpgcheck": true,
              "deltarpm": false
          }
      }
  },
  "chef_type": "role",
  "run_list": [
      "recipe[yum]"
  ],
  "env_run_lists": {
  }
}

On Amazon Linux boxes (as documented), this creates an /etc/yum.conf containing:

releasever=latest

Expected Result:

I would like to create an /etc/yum.conf file on Amazon Linux without any releasever line.

Actual Result:

If I use "releasever": false, I get a validation error from here. If I use "releasever": "", I end up with releasever= in /etc/yum.conf, which breaks yum.

node['yum']['main']['exclude'] would be better as an array, no?

Cookbook version

3.11.0

Chef-client version

12.6.0

Platform Details

RHEL 6, 7

Scenario:

Is there any reason, aside from backward compatibility with previous versions of this cookbook, why node['yum']['main']['exclude'] is a space-separated string and not an array that then gets munged in the code for the yum_globalconfig resource? On the surface, an array makes much more sense for the data type, to me.

Maybe an array for a 4.0.0 release?

Fails to add repo if `/etc/yum.repos.d` directory does not exist

The repository resource doesn't check to see if /etc/yum.repos.d directory already exists.

This caused a problem for me on Ubuntu (I know Ubuntu isn't technically supported, but I have a bunch of RPMs to install, and adding a local yum repo seemed like the way to go).

yum fails to install packages, works manually

I've tried cleaning, making fresh caches, etc. no luck.

Recipe: python::package

  • yum_package[python] action install (up to date)

  • yum_package[python-devel] action install

    Error executing action install on resource 'yum_package[python-devel]'

    Chef::Exceptions::Exec

    yum -d0 -e0 -y install python-devel-2.6.6-51.el6 returned 1:
    STDOUT:
    STDERR:

    Error Downloading Packages:
    python-devel-2.6.6-51.el6.x86_64: failure: python-devel-2.6.6-51.el6.x86_64.rpm from oracle_linux_base_6: [Errno 256] No more mirrors to try.

    Resource Declaration:

    In /var/chef/cache/cookbooks/python/recipes/package.rb

    41: package pkg do
    42: action :install
    43: end
    44: end

    Compiled Resource:

    Declared in /var/chef/cache/cookbooks/python/recipes/package.rb:41:in `block in from_file'

    yum_package("python-devel") do
    action [:install]
    retries 0
    retry_delay 2
    default_guard_interpreter :default
    package_name "python-devel"
    version "2.6.6-51.el6"
    flush_cache {:before=>false, :after=>false}
    declared_type :package
    cookbook_name "python"
    recipe_name "package"
    end

Running handlers:
[2015-08-31T17:51:16+00:00] ERROR: Running exception handlers
Running handlers complete
[2015-08-31T17:51:16+00:00] ERROR: Exception handlers complete
Chef Client failed. 1 resources updated in 6.802199844 seconds
[2015-08-31T17:51:16+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2015-08-31T17:51:16+00:00] ERROR: yum_package[python-devel](python::package line 41) had an error: Chef::Exceptions::Exec: yum -d0 -e0 -y install python-devel-2.6.6-51.el6 returned 1:
STDOUT:
STDERR:

Error Downloading Packages:
python-devel-2.6.6-51.el6.x86_64: failure: python-devel-2.6.6-51.el6.x86_64.rpm from oracle_linux_base_6: [Errno 256] No more mirrors to try.

[2015-08-31T17:51:16+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
[root@derp ~]# chef-client -v
Chef: 12.4.1
[root@derp ~]# yum -d0 -e0 -y install python-devel-2.6.6-51.el6
[root@derp ~]# echo $?
0
[root@derp ~]# rpm -q python-devel-2.6.6-51.el6
python-devel-2.6.6-51.el6.x86_64

Proxy option not being populated

I attempted to add a proxy attribute and have proxy=<proxyserver> show up in the yum.conf and it doesn't seems to show up.

I tried:
ip of proxy:port
proxy:port
http://proxy:port

None of them showed up 😦

No candidate version available for ca-certificates on CentOS 5.10& 5.11

After pulling in the yum 3.5.0 package all my converges on my 5.10 and 5.11 boxes fail on the yum-epel package with the following error

package[ca-certificates] (/var/chef/cache/cookbooks/yum/providers/repository.rb line 40) had an error: Chef::Exceptions::Package: No candidate version available for ca-certificates

CentOS 6.6 if fine

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.