summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2017-12-19 15:08:47 -0800
committerGitHub <noreply@github.com>2017-12-19 15:08:47 -0800
commit0007d3f817c4103e2520e8ae531ee4b137120f47 (patch)
treecd5ad430a86c25a105bde6a38b043cf827b4fd1f
parentb97167a9acadef2c0122605f98c44bb2d6a00549 (diff)
parent64014cb9830b8da7123e01212c5dd3d8fe6617a0 (diff)
downloadchef-0007d3f817c4103e2520e8ae531ee4b137120f47.tar.gz
Merge pull request #6697 from chef/yum_repo_cleanup
Fix yum_repository allowing priority of 0 and remove string regexes
-rw-r--r--lib/chef/resource/yum_repository.rb44
-rw-r--r--spec/unit/resource/yum_repository_spec.rb1
2 files changed, 23 insertions, 22 deletions
diff --git a/lib/chef/resource/yum_repository.rb b/lib/chef/resource/yum_repository.rb
index 231315e662..7c30bc5457 100644
--- a/lib/chef/resource/yum_repository.rb
+++ b/lib/chef/resource/yum_repository.rb
@@ -1,6 +1,6 @@
#
# Author:: Thom May (<thom@chef.io>)
-# Copyright:: Copyright (c) 2016 Chef Software, Inc.
+# Copyright:: Copyright (c) 2016-2017 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,49 +30,49 @@ class Chef
# http://linux.die.net/man/5/yum.conf as well as
# http://dnf.readthedocs.io/en/latest/conf_ref.html
- property :baseurl, [String, Array], regex: /.*/
+ property :baseurl, [String, Array]
property :clean_headers, [TrueClass, FalseClass], default: false # deprecated
property :clean_metadata, [TrueClass, FalseClass], default: true
property :cost, String, regex: /^\d+$/
- property :description, String, regex: /.*/, default: "Yum Repository"
+ property :description, String, default: "Yum Repository"
property :enabled, [TrueClass, FalseClass], default: true
property :enablegroups, [TrueClass, FalseClass]
- property :exclude, String, regex: /.*/
+ property :exclude, String
property :failovermethod, String, equal_to: %w{priority roundrobin}
property :fastestmirror_enabled, [TrueClass, FalseClass]
property :gpgcheck, [TrueClass, FalseClass], default: true
- property :gpgkey, [String, Array], regex: /.*/
+ property :gpgkey, [String, Array]
property :http_caching, String, equal_to: %w{packages all none}
- property :include_config, String, regex: /.*/
- property :includepkgs, String, regex: /.*/
+ property :include_config, String
+ property :includepkgs, String
property :keepalive, [TrueClass, FalseClass]
property :make_cache, [TrueClass, FalseClass], default: true
property :max_retries, [String, Integer]
property :metadata_expire, String, regex: [/^\d+$/, /^\d+[mhd]$/, /never/]
- property :metalink, String, regex: /.*/
+ property :metalink, String
property :mirror_expire, String, regex: [/^\d+$/, /^\d+[mhd]$/]
- property :mirrorexpire, String, regex: /.*/
+ property :mirrorexpire, String
property :mirrorlist_expire, String, regex: [/^\d+$/, /^\d+[mhd]$/]
- property :mirrorlist, String, regex: /.*/
+ property :mirrorlist, String
property :mode, default: "0644"
property :options, Hash
- property :password, String, regex: /.*/
- property :priority, String, regex: /^(\d?[0-9]|[0-9][0-9])$/
- property :proxy_password, String, regex: /.*/
- property :proxy_username, String, regex: /.*/
- property :proxy, String, regex: /.*/
+ property :password, String
+ property :priority, String, regex: /^(\d?[1-9]|[0-9][0-9])$/
+ property :proxy_password, String
+ property :proxy_username, String
+ property :proxy, String
property :repo_gpgcheck, [TrueClass, FalseClass]
property :report_instanceid, [TrueClass, FalseClass]
- property :repositoryid, String, regex: /.*/, name_property: true
+ property :repositoryid, String, name_property: true
property :skip_if_unavailable, [TrueClass, FalseClass]
- property :source, String, regex: /.*/
- property :sslcacert, String, regex: /.*/
- property :sslclientcert, String, regex: /.*/
- property :sslclientkey, String, regex: /.*/
+ property :source, String
+ property :sslcacert, String
+ property :sslclientcert, String
+ property :sslclientkey, String
property :sslverify, [TrueClass, FalseClass]
- property :timeout, String, regex: /^\d+$/
property :throttle, [String, Integer]
- property :username, String, regex: /.*/
+ property :timeout, String, regex: /^\d+$/
+ property :username, String
default_action :create
allowed_actions :create, :remove, :makecache, :add, :delete
diff --git a/spec/unit/resource/yum_repository_spec.rb b/spec/unit/resource/yum_repository_spec.rb
index c3732c2eab..3ff9b85f88 100644
--- a/spec/unit/resource/yum_repository_spec.rb
+++ b/spec/unit/resource/yum_repository_spec.rb
@@ -41,6 +41,7 @@ describe Chef::Resource::YumRepository do
expect { resource.priority "99" }.not_to raise_error(ArgumentError)
expect { resource.priority "1" }.not_to raise_error(ArgumentError)
expect { resource.priority "100" }.to raise_error(ArgumentError)
+ expect { resource.priority "0" }.to raise_error(ArgumentError)
end
it "the failovermethod property accepts 'priority' or 'roundrobin'" do