summaryrefslogtreecommitdiff
path: root/lib/chef/resource/yum_repository.rb
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2016-08-10 10:58:28 +0100
committerThom May <thom@chef.io>2016-08-24 10:17:12 +0100
commit62c04b47128009f80024226b1eb75a9f9f9db8c9 (patch)
tree9481a94ad554473e27e4f591d833169cd5622b12 /lib/chef/resource/yum_repository.rb
parentb1913dd1cc18448a2cbda81ef40886708b1ca6d0 (diff)
downloadchef-62c04b47128009f80024226b1eb75a9f9f9db8c9.tar.gz
Create and delete yum repositories
Signed-off-by: Thom May <thom@may.lt>
Diffstat (limited to 'lib/chef/resource/yum_repository.rb')
-rw-r--r--lib/chef/resource/yum_repository.rb76
1 files changed, 76 insertions, 0 deletions
diff --git a/lib/chef/resource/yum_repository.rb b/lib/chef/resource/yum_repository.rb
new file mode 100644
index 0000000000..4b3c6edfb7
--- /dev/null
+++ b/lib/chef/resource/yum_repository.rb
@@ -0,0 +1,76 @@
+#
+# Author:: Thom May (<thom@chef.io>)
+# Copyright:: Copyright (c) 2016 Chef Software, Inc.
+# License:: Apache License, Version 2.0
+#
+# 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.
+#
+
+require "chef/resource"
+
+class Chef
+ class Resource
+ class YumRepository < Chef::Resource
+ resource_name :yum_repository
+ provides :yum_repository
+
+ # http://linux.die.net/man/5/yum.conf
+ property :baseurl, String, regex: /.*/
+ property :cost, String, regex: /^\d+$/
+ property :clean_headers, [TrueClass, FalseClass], default: false # deprecated
+ property :clean_metadata, [TrueClass, FalseClass], default: true
+ property :description, String, regex: /.*/, default: "Ye Ole Rpm Repo"
+ property :enabled, [TrueClass, FalseClass], default: true
+ property :enablegroups, [TrueClass, FalseClass]
+ property :exclude, String, regex: /.*/
+ property :failovermethod, String, equal_to: %w{priority roundrobin}
+ property :fastestmirror_enabled, [TrueClass, FalseClass]
+ property :gpgcheck, [TrueClass, FalseClass]
+ property :gpgkey, [String, Array], regex: /.*/
+ property :http_caching, String, equal_to: %w{packages all none}
+ property :include_config, String, regex: /.*/
+ property :includepkgs, String, regex: /.*/
+ 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 :mirrorexpire, String, regex: /.*/
+ property :mirrorlist, String, regex: /.*/
+ property :mirror_expire, String, regex: [/^\d+$/, /^\d+[mhd]$/]
+ property :mirrorlist_expire, String, regex: [/^\d+$/, /^\d+[mhd]$/]
+ property :mode, default: "0644"
+ property :priority, String, regex: /^(\d?[0-9]|[0-9][0-9])$/
+ property :proxy, String, regex: /.*/
+ property :proxy_username, String, regex: /.*/
+ property :proxy_password, String, regex: /.*/
+ property :username, String, regex: /.*/
+ property :password, String, regex: /.*/
+ property :repo_gpgcheck, [TrueClass, FalseClass]
+ property :report_instanceid, [TrueClass, FalseClass]
+ property :repositoryid, String, regex: /.*/, name_attribute: true
+ property :sensitive, [TrueClass, FalseClass], default: false
+ property :skip_if_unavailable, [TrueClass, FalseClass]
+ property :source, String, regex: /.*/
+ property :sslcacert, String, regex: /.*/
+ property :sslclientcert, String, regex: /.*/
+ property :sslclientkey, String, regex: /.*/
+ property :sslverify, [TrueClass, FalseClass]
+ property :timeout, String, regex: /^\d+$/
+
+ property :options, Hash
+
+ default_action :create
+ allowed_actions :create, :remove, :make_cache, :add
+ end
+ end
+end