madscience 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/Cheffile +1 -1
  3. data/Cheffile.lock +12 -12
  4. data/cookbooks/apt/CHANGELOG.md +25 -0
  5. data/cookbooks/apt/README.md +4 -7
  6. data/cookbooks/apt/attributes/default.rb +17 -0
  7. data/cookbooks/apt/metadata.json +2 -2
  8. data/cookbooks/apt/metadata.rb +1 -1
  9. data/cookbooks/apt/providers/repository.rb +62 -9
  10. data/cookbooks/apt/recipes/default.rb +15 -8
  11. data/cookbooks/apt/recipes/unattended-upgrades.rb +43 -0
  12. data/cookbooks/apt/templates/default/20auto-upgrades.erb +2 -0
  13. data/cookbooks/apt/templates/default/50unattended-upgrades.erb +62 -0
  14. data/cookbooks/apt/templates/default/unattended-upgrades.seed.erb +1 -0
  15. data/cookbooks/dmg/CHANGELOG.md +3 -0
  16. data/cookbooks/dmg/libraries/matchers.rb +24 -0
  17. data/cookbooks/dmg/metadata.json +1 -1
  18. data/cookbooks/dmg/metadata.rb +1 -1
  19. data/cookbooks/vagrant/README.md +4 -2
  20. data/cookbooks/vagrant/attributes/default.rb +5 -4
  21. data/cookbooks/vagrant/libraries/helpers.rb +50 -0
  22. data/cookbooks/vagrant/metadata.rb +1 -1
  23. data/cookbooks/vagrant/recipes/mac_os_x.rb +16 -0
  24. data/cookbooks/windows/Berksfile +7 -0
  25. data/cookbooks/windows/CHANGELOG.md +31 -0
  26. data/cookbooks/windows/CONTRIBUTING +46 -0
  27. data/cookbooks/windows/Gemfile +14 -0
  28. data/cookbooks/windows/LICENSE +201 -0
  29. data/cookbooks/windows/README.md +51 -6
  30. data/cookbooks/windows/TODO.md +6 -0
  31. data/cookbooks/windows/attributes/default.rb +1 -0
  32. data/cookbooks/windows/chefignore +2 -0
  33. data/cookbooks/windows/libraries/matchers.rb +18 -3
  34. data/cookbooks/windows/libraries/registry_helper.rb +10 -3
  35. data/cookbooks/windows/libraries/version.rb +4 -3
  36. data/cookbooks/windows/libraries/windows_architecture_helper.rb +1 -0
  37. data/cookbooks/windows/libraries/windows_helper.rb +15 -1
  38. data/cookbooks/windows/libraries/windows_package.rb +266 -0
  39. data/cookbooks/windows/libraries/wmi_helper.rb +32 -0
  40. data/cookbooks/windows/metadata.json +12 -4
  41. data/cookbooks/windows/metadata.rb +1 -1
  42. data/cookbooks/windows/providers/auto_run.rb +2 -1
  43. data/cookbooks/windows/providers/batch.rb +1 -0
  44. data/cookbooks/windows/providers/feature_servermanagercmd.rb +17 -3
  45. data/cookbooks/windows/providers/font.rb +69 -0
  46. data/cookbooks/windows/providers/pagefile.rb +2 -2
  47. data/cookbooks/windows/providers/path.rb +21 -4
  48. data/cookbooks/windows/providers/printer.rb +1 -0
  49. data/cookbooks/windows/providers/printer_port.rb +1 -0
  50. data/cookbooks/windows/providers/reboot.rb +2 -0
  51. data/cookbooks/windows/providers/registry.rb +9 -6
  52. data/cookbooks/windows/providers/task.rb +44 -5
  53. data/cookbooks/windows/providers/zipfile.rb +3 -2
  54. data/cookbooks/windows/recipes/reboot_handler.rb +1 -1
  55. data/cookbooks/windows/resources/auto_run.rb +1 -1
  56. data/cookbooks/windows/resources/font.rb +25 -0
  57. data/cookbooks/windows/resources/path.rb +1 -1
  58. data/cookbooks/windows/resources/task.rb +3 -3
  59. data/cookbooks/windows/resources/zipfile.rb +1 -1
  60. data/cookbooks/yum/CHANGELOG.md +42 -0
  61. data/cookbooks/yum/README.md +11 -1
  62. data/cookbooks/yum/attributes/main.rb +0 -1
  63. data/cookbooks/yum/metadata.json +2 -2
  64. data/cookbooks/yum/metadata.rb +1 -2
  65. data/cookbooks/yum/providers/repository.rb +18 -3
  66. data/cookbooks/yum/recipes/default.rb +6 -14
  67. data/cookbooks/yum/resources/globalconfig.rb +5 -2
  68. data/cookbooks/yum/resources/repository.rb +7 -3
  69. data/cookbooks/yum/templates/default/main.erb +19 -4
  70. data/cookbooks/yum/templates/default/repo.erb +17 -4
  71. data/lib/madscience/version.rb +1 -1
  72. data/site-cookbooks/madscience-vagrant-cookbook/recipes/default.rb +11 -10
  73. metadata +17 -3
  74. data/cookbooks/windows/providers/package.rb +0 -252
  75. data/cookbooks/windows/resources/package.rb +0 -46
@@ -1,5 +1,5 @@
1
1
  #
2
- # Author:: Paul Morotn (<pmorton@biaprotect.com>)
2
+ # Author:: Paul Morton (<pmorton@biaprotect.com>)
3
3
  # Cookbook Name:: windows
4
4
  # Provider:: path
5
5
  #
@@ -17,19 +17,36 @@
17
17
  # See the License for the specific language governing permissions and
18
18
  # limitations under the License.
19
19
  #
20
+ use_inline_resources if defined?(use_inline_resources)
21
+
22
+ include Windows::Helper
20
23
 
21
24
  action :add do
22
- env "PATH" do
25
+ env "path" do
23
26
  action :modify
24
27
  delim ::File::PATH_SEPARATOR
25
28
  value new_resource.path
29
+ notifies :run, "ruby_block[fix ruby ENV['PATH']]", :immediately
30
+ end
31
+
32
+ # The windows Env provider does not correctly expand variables in
33
+ # the PATH environment variable. Ruby expects these to be expanded.
34
+ # This is a temporary fix for that.
35
+ #
36
+ # Follow at https://github.com/opscode/chef/pull/1876
37
+ #
38
+ ruby_block "fix ruby ENV['PATH']" do
39
+ block do
40
+ ENV['PATH'] = expand_env_vars(ENV['PATH'])
41
+ end
42
+ action :nothing
26
43
  end
27
44
  end
28
45
 
29
46
  action :remove do
30
- env "PATH" do
47
+ env "path" do
31
48
  action :delete
32
49
  delim ::File::PATH_SEPARATOR
33
50
  value new_resource.path
34
51
  end
35
- end
52
+ end
@@ -17,6 +17,7 @@
17
17
  # See the License for the specific language governing permissions and
18
18
  # limitations under the License.
19
19
  #
20
+ use_inline_resources if defined?(use_inline_resources)
20
21
 
21
22
  # Support whyrun
22
23
  def whyrun_supported?
@@ -17,6 +17,7 @@
17
17
  # See the License for the specific language governing permissions and
18
18
  # limitations under the License.
19
19
  #
20
+ use_inline_resources if defined?(use_inline_resources)
20
21
 
21
22
  # Support whyrun
22
23
  def whyrun_supported?
@@ -22,10 +22,12 @@ action :request do
22
22
  node.run_state[:reboot_requested] = true
23
23
  node.run_state[:reboot_timeout] = @new_resource.timeout
24
24
  node.run_state[:reboot_reason] = @new_resource.reason
25
+ new_resource.updated_by_last_action(true)
25
26
  end
26
27
 
27
28
  action :cancel do
28
29
  node.run_state.delete(:reboot_requested)
29
30
  node.run_state.delete(:reboot_timeout)
30
31
  node.run_state.delete(:reboot_reason)
32
+ new_resource.updated_by_last_action(true)
31
33
  end
@@ -25,11 +25,13 @@
25
25
  include Windows::RegistryHelper
26
26
 
27
27
  action :create do
28
- registry_update(:create)
28
+ updated = registry_update(:create)
29
+ new_resource.updated_by_last_action(updated)
29
30
  end
30
31
 
31
32
  action :modify do
32
- registry_update(:open)
33
+ updated = registry_update(:open)
34
+ new_resource.updated_by_last_action(updated)
33
35
  end
34
36
 
35
37
  action :force_modify do
@@ -46,9 +48,11 @@ action :force_modify do
46
48
  else
47
49
  Chef::Log.debug("#{@new_resource} value [#{value_name}] current [#{current_value_data}] data not equal to desired [#{desired_value_data}] data. Setting value and restarting check loop.")
48
50
  begin
49
- registry_update(:open)
51
+ updated = registry_update(:open)
52
+ new_resource.updated_by_last_action(updated)
50
53
  rescue Exception
51
- registry_update(:create)
54
+ updated = registry_update(:create)
55
+ new_resource.updated_by_last_action(updated)
52
56
  end
53
57
  i=0 # start count loop over
54
58
  end
@@ -60,6 +64,7 @@ end
60
64
 
61
65
  action :remove do
62
66
  delete_value(@new_resource.key_name,@new_resource.values)
67
+ new_resource.updated_by_last_action(true)
63
68
  end
64
69
 
65
70
  private
@@ -67,6 +72,4 @@ def registry_update(mode)
67
72
 
68
73
  Chef::Log.debug("Registry Mode (#{mode})")
69
74
  updated = set_value(mode,@new_resource.key_name,@new_resource.values,@new_resource.type)
70
- @new_resource.updated_by_last_action(updated)
71
-
72
75
  end
@@ -38,7 +38,7 @@ action :create do
38
38
  cmd += "/RP \"#{@new_resource.password}\" " if @new_resource.user and @new_resource.password
39
39
  cmd += "/RL HIGHEST " if @new_resource.run_level == :highest
40
40
  shell_out!(cmd, {:returns => [0]})
41
- @new_resource.updated_by_last_action true
41
+ new_resource.updated_by_last_action true
42
42
  Chef::Log.info "#{@new_resource} task created"
43
43
  end
44
44
  end
@@ -50,7 +50,7 @@ action :run do
50
50
  else
51
51
  cmd = "schtasks /Run /TN \"#{@current_resource.name}\""
52
52
  shell_out!(cmd, {:returns => [0]})
53
- @new_resource.updated_by_last_action true
53
+ new_resource.updated_by_last_action true
54
54
  Chef::Log.info "#{@new_resource} task ran"
55
55
  end
56
56
  else
@@ -68,7 +68,7 @@ action :change do
68
68
  Chef::Log.fatal "#{@new_resource.name}: Can't specify user or password without both!"
69
69
  end
70
70
  shell_out!(cmd, {:returns => [0]})
71
- @new_resource.updated_by_last_action true
71
+ new_resource.updated_by_last_action true
72
72
  Chef::Log.info "Change #{@new_resource} task ran"
73
73
  else
74
74
  Chef::Log.debug "#{@new_resource} task doesn't exists - nothing to do"
@@ -80,13 +80,47 @@ action :delete do
80
80
  use_force = @new_resource.force ? '/F' : ''
81
81
  cmd = "schtasks /Delete #{use_force} /TN \"#{@current_resource.name}\""
82
82
  shell_out!(cmd, {:returns => [0]})
83
- @new_resource.updated_by_last_action true
83
+ new_resource.updated_by_last_action true
84
84
  Chef::Log.info "#{@new_resource} task deleted"
85
85
  else
86
86
  Chef::Log.debug "#{@new_resource} task doesn't exists - nothing to do"
87
87
  end
88
88
  end
89
89
 
90
+ action :enable do
91
+ if @current_resource.exists
92
+ if @current_resource.enabled
93
+ Chef::Log.debug "#{@new_resource} already enabled - nothing to do"
94
+ else
95
+ cmd = "schtasks /Change /TN \"#{@current_resource.name}\" "
96
+ cmd += "/ENABLE"
97
+ shell_out!(cmd, {:returns => [0]})
98
+ @new_resource.updated_by_last_action true
99
+ Chef::Log.info "#{@new_resource} task enabled"
100
+ end
101
+ else
102
+ Chef::Log.fatal "#{@new_resource} task doesn't exist - nothing to do"
103
+ raise Errno::ENOENT, "#{@new_resource}: task does not exist, cannot enable"
104
+ end
105
+ end
106
+
107
+ action :disable do
108
+ if @current_resource.exists
109
+ if @current_resource.enabled
110
+ cmd = "schtasks /Change /TN \"#{@current_resource.name}\" "
111
+ cmd += "/DISABLE"
112
+ shell_out!(cmd, {:returns => [0]})
113
+ @new_resource.updated_by_last_action true
114
+ Chef::Log.info "#{@new_resource} task disabled"
115
+ else
116
+ Chef::Log.debug "#{@new_resource} already disabled - nothing to do"
117
+ end
118
+ else
119
+ Chef::Log.debug "#{@new_resource} task doesn't exist - nothing to do"
120
+ end
121
+ end
122
+
123
+
90
124
  def load_current_resource
91
125
  @current_resource = Chef::Resource::WindowsTask.new(@new_resource.name)
92
126
  @current_resource.name(@new_resource.name)
@@ -97,6 +131,9 @@ def load_current_resource
97
131
  if task_hash[:Status] == "Running"
98
132
  @current_resource.status = :running
99
133
  end
134
+ if task_hash[:ScheduledTaskState] == "Enabled"
135
+ @current_resource.enabled = true
136
+ end
100
137
  @current_resource.cwd(task_hash[:Folder])
101
138
  @current_resource.command(task_hash[:TaskToRun])
102
139
  @current_resource.user(task_hash[:RunAsUser])
@@ -107,7 +144,9 @@ private
107
144
 
108
145
  def load_task_hash(task_name)
109
146
  Chef::Log.debug "looking for existing tasks"
110
- output = `schtasks /Query /FO LIST /V /TN \"#{task_name}\" 2> NUL`
147
+
148
+ # we use shell_out here instead of shell_out! because a failure implies that the task does not exist
149
+ output = shell_out("schtasks /Query /FO LIST /V /TN \"#{task_name}\"").stdout
111
150
  if output.empty?
112
151
  task = false
113
152
  else
@@ -2,7 +2,7 @@
2
2
  # Author:: Doug MacEachern (<dougm@vmware.com>)
3
3
  # Author:: Seth Chisamore (<schisamo@opscode.com>)
4
4
  # Cookbook Name:: windows
5
- # Provider:: unzip
5
+ # Provider:: zipfile
6
6
  #
7
7
  # Copyright:: 2010, VMware, Inc.
8
8
  # Copyright:: 2011, Opscode, Inc.
@@ -38,7 +38,7 @@ action :unzip do
38
38
  zip.extract(entry, path)
39
39
  end
40
40
  end
41
- @new_resource.updated_by_last_action(true)
41
+ new_resource.updated_by_last_action(true)
42
42
  end
43
43
 
44
44
  action :zip do
@@ -71,6 +71,7 @@ action :zip do
71
71
  z.add(zip_fname, f)
72
72
  end
73
73
  z.close
74
+ new_resource.updated_by_last_action(true)
74
75
  else
75
76
  Chef::Log.info("Single directory must be specified for compression, and #{@new_resource.source} does not meet that criteria.")
76
77
  end
@@ -27,6 +27,6 @@ end
27
27
  chef_handler 'WindowsRebootHandler' do
28
28
  source "#{node['chef_handler']['handler_path']}/windows_reboot_handler.rb"
29
29
  arguments node['windows']['allow_pending_reboots']
30
- supports :report => true, :exception => false
30
+ supports :report => true, :exception => node['windows']['allow_reboot_on_failure']
31
31
  action :enable
32
32
  end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Author:: Paul Morotn (<pmorton@biaprotect.com>)
2
+ # Author:: Paul Morton (<pmorton@biaprotect.com>)
3
3
  # Cookbook Name:: windows
4
4
  # Resource:: auto_run
5
5
  #
@@ -0,0 +1,25 @@
1
+ #
2
+ # Author:: Sander Botman <sbotman@schubergphilis.com>
3
+ # Cookbook Name:: windows
4
+ # Resource:: font
5
+ #
6
+ # Copyright:: 2014, Schuberg Philis BV.
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+ #
20
+
21
+ actions :install
22
+
23
+ default_action :install
24
+
25
+ attribute :file, :kind_of => String, :name_attribute => true
@@ -1,5 +1,5 @@
1
1
  #
2
- # Author:: Paul Morotn (<pmorton@biaprotect.com>)
2
+ # Author:: Paul Morton (<pmorton@biaprotect.com>)
3
3
  # Cookbook Name:: windows
4
4
  # Resource:: path
5
5
  #
@@ -20,9 +20,9 @@
20
20
 
21
21
  # Passwords can't be loaded for existing tasks, making :modify both confusing
22
22
  # and not very useful
23
- actions :create, :delete, :run, :change
23
+ actions :create, :delete, :run, :change, :enable, :disable
24
24
 
25
- attribute :name, :kind_of => String, :name_attribute => true
25
+ attribute :name, :kind_of => String, :name_attribute => true, :regex => [ /\A[^\\\/\:\*\?\<\>\|]+\z/ ]
26
26
  attribute :command, :kind_of => String
27
27
  attribute :cwd, :kind_of => String
28
28
  attribute :user, :kind_of => String, :default => nil
@@ -42,7 +42,7 @@ attribute :frequency, :equal_to => [:minute,
42
42
  attribute :start_day, :kind_of => String, :default => nil
43
43
  attribute :start_time, :kind_of => String, :default => nil
44
44
 
45
- attr_accessor :exists, :status
45
+ attr_accessor :exists, :status, :enabled
46
46
 
47
47
  def initialize(name, run_context=nil)
48
48
  super
@@ -2,7 +2,7 @@
2
2
  # Author:: Doug MacEachern (<dougm@vmware.com>)
3
3
  # Author:: Seth Chisamore (<schisamo@opscode.com>)
4
4
  # Cookbook Name:: windows
5
- # Resource:: unzip
5
+ # Resource:: zipfile
6
6
  #
7
7
  # Copyright:: 2010, VMware, Inc.
8
8
  # Copyright:: 2011, Opscode, Inc.
@@ -2,6 +2,48 @@ yum Cookbook CHANGELOG
2
2
  ======================
3
3
  This file is used to list changes made in each version of the yum cookbook.
4
4
 
5
+ v3.5.1 (2014-11-24)
6
+ -------------------
7
+ - Reverting management of ca-certificates because EL5 was broken
8
+
9
+ v3.5.0 (2014-11-24)
10
+ -------------------
11
+ - Adding management of ca-certificates package to yum_repository provider
12
+
13
+ v3.4.1 (2014-10-29)
14
+ -------------------
15
+ - Run yum-makecache only_if new_resource.enabled
16
+ - Allow setting of reposdir in global yum config and man page
17
+ - Change default 'obsoletes' behavior to match yum defaults
18
+
19
+ v3.4.0 (2014-10-15)
20
+ -------------------
21
+ - Dynamically generate the new_resource attributes
22
+
23
+ v3.3.2 (2014-09-11)
24
+ -------------------
25
+ - Fix globalconfig resource param for http_caching
26
+
27
+ v3.3.1 (2014-09-04)
28
+ -------------------
29
+ - Fix issue with sslverify if set to false
30
+ - Add fancy badges
31
+
32
+ v3.3.0 (2014-09-03)
33
+ -------------------
34
+ - Adding tuning attributes for all supported resource parameters
35
+ - Adding options hash parameter
36
+ - Adding (real) rhel-6.5 and centos-7.0 to test-kitchen coverage
37
+ - Updating regex for mirror_expire and mirrorlist_expire to include /^\d+[mhd]$/
38
+ - Updating README so keepcache reflects reality (defaults to false)
39
+ - Changing 'obsoletes' behavior in globalconfig resource to match
40
+ default behavior. (now defaults to nil, yum defaults to false)
41
+ - Adding makecache action to repository resource
42
+ - Adding mode parameter to repository resource. Defaults to '0644'.
43
+
44
+ v3.2.4 (2014-08-20)
45
+ -------------------
46
+ #82 - Adding a makecache parameter
5
47
 
6
48
  v3.2.2 (2014-06-11)
7
49
  -------------------
@@ -1,6 +1,9 @@
1
1
  yum Cookbook
2
2
  ============
3
3
 
4
+ [![Cookbook Version](https://img.shields.io/cookbook/v/yum.svg)](https://supermarket.getchef.com/cookbooks/yum)
5
+ [![Travis status](http://img.shields.io/travis/opscode-cookbooks/yum.svg)](https://travis-ci.org/opscode-cookbooks/yum)
6
+
4
7
  The Yum cookbook exposes the `yum_globalconfig` and `yum_repository`
5
8
  resources that allows a user to both control global behavior and make
6
9
  individual Yum repositories available for use. These resources aim to
@@ -60,6 +63,7 @@ end
60
63
  #### Actions
61
64
  - `:create` - creates a repository file and builds the repository listing
62
65
  - `:delete` - deletes the repository file
66
+ - `:makecache` - update yum cache
63
67
 
64
68
  #### Parameters
65
69
  * `baseurl` - Must be a URL to the directory where the yum repository's
@@ -98,6 +102,8 @@ end
98
102
  an empty list.
99
103
  * `keepalive` - Either `true` or `false`. This tells yum whether or not
100
104
  HTTP/1.1 keepalive should be used with this repository.
105
+ * `make_cache` - Optional, Default is `true`, if `false` then `yum -q makecache` will not
106
+ be ran
101
107
  * `max_retries` - Set the number of times any attempt to retrieve a file
102
108
  should retry before returning an error. Setting this to '0' makes
103
109
  yum try forever. Default is '10'.
@@ -126,6 +132,10 @@ end
126
132
  find that yum is not downloading the mirrorlists as often as you
127
133
  would like lower the value of this option.
128
134
  * `mirrorlist_expire` - alias for mirror_expire
135
+ * `mode` - Permissions mode of .repo file on disk. Useful for
136
+ scenarios where secrets are in the repo file. If set to '600',
137
+ normal users will not be able to use yum search, yum info, etc.
138
+ Defaults to '0644'
129
139
  * `priority` - When the yum-priorities plug-in is enabled, you set
130
140
  priorities on repository entries, where N is an integer from 1 to 99. The
131
141
  default priority for repositories is 99.
@@ -178,7 +188,7 @@ http://linux.die.net/man/5/yum.conf
178
188
  files. The default is '/var/cache/yum'.
179
189
  * `keepcache` - Either `true` or `false`. Determines whether or not
180
190
  yum keeps the cache of headers and packages after successful
181
- installation. Default is `true` (keep files)
191
+ installation. Default is `false`
182
192
  * `debuglevel` - Debug message output level. Practical range is 0-10.
183
193
  Default is '2'.
184
194
  * `exclude` - List of packages to exclude from updates or installs.
@@ -73,7 +73,6 @@ default['yum']['main']['protected_packages'] = nil # /.*/
73
73
  default['yum']['main']['proxy'] = nil # /.*/
74
74
  default['yum']['main']['proxy_password'] = nil # /.*/
75
75
  default['yum']['main']['proxy_username'] = nil # /.*/
76
- default['yum']['main']['username'] = nil # /.*/
77
76
  default['yum']['main']['password'] = nil # /.*/
78
77
  default['yum']['main']['recent'] = nil # /^\d+$/
79
78
  default['yum']['main']['releasever'] = nil # /.*/
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "yum",
3
- "version": "3.2.2",
3
+ "version": "3.5.1",
4
4
  "description": "Configures various yum components on Red Hat-like systems",
5
- "long_description": "yum Cookbook\n============\n\nThe Yum cookbook exposes the `yum_globalconfig` and `yum_repository`\nresources that allows a user to both control global behavior and make\nindividual Yum repositories available for use. These resources aim to\nallow the user to configure all options listed in the `yum.conf` man\npage, found at http://linux.die.net/man/5/yum.conf\n\nNOTES\n-----\nWARNING: Yum cookbook version 3.0.0 and above contain non-backwards\ncompatible breaking changes and will not work with cookbooks written\nagainst the 2.x and 1.x series. Changes have been made to the\nyum_repository resource, and the yum_key resource has been eliminated\nentirely. Recipes have been eliminated and moved into their own\ncookbooks. Please lock yum to the 2.x series in your Chef environments\nuntil all dependent cookbooks have been ported.\n\nRequirements\n------------\n* Chef 11 or higher\n* Ruby 1.9 (preferably from the Chef full-stack installer)\n* RHEL5, RHEL6, or other platforms within the family\n\nResources/Providers\n-------------------\n### yum_repository\nThis resource manages a yum repository configuration file at\n/etc/yum.repos.d/`repositoryid`.repo. When the file needs to be\nrepaired, it calls yum-makecache so packages in the repo become\navailable to the next resource.\n\n#### Example\n``` ruby\n# add the Zenoss repository\nyum_repository 'zenoss' do\n description \"Zenoss Stable repo\"\n baseurl \"http://dev.zenoss.com/yum/stable/\"\n gpgkey 'http://dev.zenoss.com/yum/RPM-GPG-KEY-zenoss'\n action :create\nend\n\n# add the EPEL repo\nyum_repository 'epel' do\n description 'Extra Packages for Enterprise Linux'\n mirrorlist 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch'\n gpgkey 'http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6'\n action :create\nend\n```\n\n``` ruby\n# delete CentOS-Media repo\nyum_repository 'CentOS-Media' do\n action :delete\nend\n```\n\n#### Actions\n- `:create` - creates a repository file and builds the repository listing\n- `:delete` - deletes the repository file\n\n#### Parameters\n* `baseurl` - Must be a URL to the directory where the yum repository's\n 'repodata' directory lives. Can be an http://, ftp:// or file://\n URL. You can specify multiple URLs in one baseurl statement.\n* `cost` - relative cost of accessing this repository. Useful for\n weighing one repo's packages as greater/less than any other.\n defaults to 1000\n* `description` - Maps to the 'name' parameter in a repository .conf.\n Descriptive name for the repository channel. This directive must be\n specified.\n* `enabled` - Either `true` or `false`. This tells yum whether or not use this repository.\n* `enablegroups` - Either `true` or `false`. Determines whether yum\n will allow the use of package groups for this repository. Default is\n `true` (package groups are allowed).\n* `exclude` - List of packages to exclude from updates or installs. This\n should be a space separated list in a single string. Shell globs using wildcards (eg. *\n and ?) are allowed.\n* `failovermethod` - Either 'roundrobin' or 'priority'.\n* `fastestmirror_enabled` - Either `true` or `false`\n* `gpgcheck` - Either `true` or `false`. This tells yum whether or not\n it should perform a GPG signature check on packages. When this is\n set in the [main] section it sets the default for all repositories.\n The default is `true`.\n* `gpgkey` - A URL pointing to the ASCII-armored GPG key file for the\n repository. This option is used if yum needs a public key to verify\n a package and the required key hasn't been imported into the RPM\n database. If this option is set, yum will automatically import the\n key from the specified URL.\n* `http_caching` - Either 'all', 'packages', or 'none'. Determines how\n upstream HTTP caches are instructed to handle any HTTP downloads\n that Yum does. Defaults to 'all'\n* `includepkgs` - Inverse of exclude. This is a list of packages you\n want to use from a repository. If this option lists only one package\n then that is all yum will ever see from the repository. Defaults to\n an empty list.\n* `keepalive` - Either `true` or `false`. This tells yum whether or not\n HTTP/1.1 keepalive should be used with this repository. \n* `max_retries` - Set the number of times any attempt to retrieve a file\n should retry before returning an error. Setting this to '0' makes\n yum try forever. Default is '10'.\n* `metadata_expire` - Time (in seconds) after which the metadata will\n expire. So that if the current metadata downloaded is less than this\n many seconds old then yum will not update the metadata against the\n repository. If you find that yum is not downloading information on\n updates as often as you would like lower the value of this option.\n You can also change from the default of using seconds to using days,\n hours or minutes by appending a d, h or m respectively. The default\n is 6 hours, to compliment yum-updatesd running once an hour. It's\n also possible to use the word \"never\", meaning that the metadata\n will never expire. Note that when using a metalink file the metalink\n must always be newer than the metadata for the repository, due to\n the validation, so this timeout also applies to the metalink file.\n* `mirrorlist` - Specifies a URL to a file containing a list of\n baseurls. This can be used instead of or with the baseurl option.\n Substitution variables, described below, can be used with this\n option. As a special hack is the mirrorlist URL contains the word\n \"metalink\" then the value of mirrorlist is copied to metalink (if\n metalink is not set)\n* `mirror_expire` - Time (in seconds) after which the mirrorlist locally\n cached will expire. If the current mirrorlist is less than this many\n seconds old then yum will not download another copy of the\n mirrorlist, it has the same extra format as metadata_expire. If you\n find that yum is not downloading the mirrorlists as often as you\n would like lower the value of this option.\n* `mirrorlist_expire` - alias for mirror_expire\n* `priority` - When the yum-priorities plug-in is enabled, you set\n priorities on repository entries, where N is an integer from 1 to 99. The\n default priority for repositories is 99.\n* `proxy` - URL to the proxy server that yum should use.\n* `proxy_username` - username to use for proxy\n* `proxy_password` - password for this proxy\n* `report_instanceid` - Report instance ID when using Amazon Linux AMIs\n and repositories\n* `repositoryid` - Must be a unique name for each repository, one word.\n Defaults to name attribute.\n* `source` - Use a custom template source instead of the default one\n in the yum cookbook\n* `sslcacert` - Path to the directory containing the databases of the\n certificate authorities yum should use to verify SSL certificates.\n Defaults to none - uses system default\n* `sslclientcert` - Path to the SSL client certificate yum should use to\n connect to repos/remote sites Defaults to none. \n* `sslclientkey` - Path to the SSL client key yum should use to connect\n to repos/remote sites Defaults to none.\n* `sslverify` - Either `true` or `false`. Determines if yum will verify SSL certificates/hosts. Defaults to `true`\n* `timeout` - Number of seconds to wait for a connection before timing\n out. Defaults to 30 seconds. This may be too short of a time for\n extremely overloaded sites.\n\n### yum_globalconfig\nThis renders a template with global yum configuration parameters. The\ndefault recipe uses it to render `/etc/yum.conf`. It is flexible\nenough to be used in other scenarios, such as building RPMs in\nisolation by modifying `installroot`. \n\n#### Example\n``` ruby\nyum_globalconfig '/my/chroot/etc/yum.conf' do\n cachedir '/my/chroot/etc/yum.conf'\n keepcache 'yes'\n debuglevel '2'\n installroot '/my/chroot'\n action :create\nend\n```\n\n#### Parameters\n`yum_globalconfig` can take most of the same parameters as a\n`yum_repository`, plus more, too numerous to describe here. Below are\na few of the more commonly used ones. For a complete list, please\nconsult the `yum.conf` man page, found here:\nhttp://linux.die.net/man/5/yum.conf\n\n* `cachedir` - Directory where yum should store its cache and db\n files. The default is '/var/cache/yum'. \n* `keepcache` - Either `true` or `false`. Determines whether or not\n yum keeps the cache of headers and packages after successful\n installation. Default is `true` (keep files)\n* `debuglevel` - Debug message output level. Practical range is 0-10.\n Default is '2'. \n* `exclude` - List of packages to exclude from updates or installs.\n This should be a space separated list. Shell globs using wildcards\n (eg. * and ?) are allowed. \n* `installonlypkgs` = List of package provides that should only ever\n be installed, never updated. Kernels in particular fall into this\n category. Defaults to kernel, kernel-bigmem, kernel-enterprise,\n kernel-smp, kernel-debug, kernel-unsupported, kernel-source,\n kernel-devel, kernel-PAE, kernel-PAE-debug.\n* `logfile` - Full directory and file name for where yum should write\n its log file.\n* `exactarch` - Either `true` or `false`. Set to `true` to make 'yum update' only\n update the architectures of packages that you have installed. ie:\n with this enabled yum will not install an i686 package to update an\n x86_64 package. Default is `true`\n* `gpgcheck` - Either `true` or `false`. This tells yum whether or not\n it should perform a GPG signature check on the packages gotten from\n this repository.\n \nRecipes\n-------\n* `default` - Configures `yum_globalconfig[/etc/yum.conf]` with values\n found in node attributes at `node['yum']['main']`\n\nAttributes\n----------\nThe following attributes are set by default\n\n``` ruby\ndefault['yum']['main']['cachedir'] = '/var/cache/yum/$basearch/$releasever'\ndefault['yum']['main']['keepcache'] = false\ndefault['yum']['main']['debuglevel'] = nil\ndefault['yum']['main']['exclude'] = nil\ndefault['yum']['main']['logfile'] = '/var/log/yum.log'\ndefault['yum']['main']['exactarch'] = nil\ndefault['yum']['main']['obsoletes'] = nil\ndefault['yum']['main']['installonly_limit'] = nil\ndefault['yum']['main']['installonlypkgs'] = nil\ndefault['yum']['main']['installroot'] = nil\n```\n\nRelated Cookbooks\n-----------------\nRecipes from older versions of this cookbook have been moved\nindividual cookbooks. Recipes for managing platform yum configurations\nand installing specific repositories can be found in one (or more!) of\nthe following cookbook.\n\n* yum-centos\n* yum-fedora\n* yum-amazon\n* yum-epel\n* yum-elrepo\n* yum-repoforge\n* yum-ius\n* yum-percona\n* yum-pgdg\n\nUsage\n-----\nPut `depends 'yum'` in your metadata.rb to gain access to the\nyum_repository resource.\n\nLicense & Authors\n-----------------\n- Author:: Eric G. Wolfe\n- Author:: Matt Ray (<matt@getchef.com>)\n- Author:: Joshua Timberman (<joshua@getchef.com>)\n- Author:: Sean OMeara (<someara@getchef.com>)\n\n```text\nCopyright:: 2011 Eric G. Wolfe\nCopyright:: 2013 Chef\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n",
5
+ "long_description": "",
6
6
  "maintainer": "Chef",
7
7
  "maintainer_email": "cookbooks@getchef.com",
8
8
  "license": "Apache 2.0",
@@ -3,8 +3,7 @@ maintainer 'Chef'
3
3
  maintainer_email 'cookbooks@getchef.com'
4
4
  license 'Apache 2.0'
5
5
  description 'Configures various yum components on Red Hat-like systems'
6
- long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
7
- version '3.2.2'
6
+ version '3.5.1'
8
7
 
9
8
  supports 'redhat'
10
9
  supports 'centos'
@@ -43,16 +43,19 @@ action :create do
43
43
  else
44
44
  source new_resource.source
45
45
  end
46
- mode '0644'
46
+ mode new_resource.mode
47
47
  variables(:config => new_resource)
48
- notifies :run, "execute[yum-makecache-#{new_resource.repositoryid}]", :immediately
49
- notifies :create, "ruby_block[yum-cache-reload-#{new_resource.repositoryid}]", :immediately
48
+ if new_resource.make_cache
49
+ notifies :run, "execute[yum-makecache-#{new_resource.repositoryid}]", :immediately
50
+ notifies :create, "ruby_block[yum-cache-reload-#{new_resource.repositoryid}]", :immediately
51
+ end
50
52
  end
51
53
 
52
54
  # get the metadata for this repo only
53
55
  execute "yum-makecache-#{new_resource.repositoryid}" do
54
56
  command "yum -q makecache --disablerepo=* --enablerepo=#{new_resource.repositoryid}"
55
57
  action :nothing
58
+ only_if { new_resource.enabled }
56
59
  end
57
60
 
58
61
  # reload internal Chef yum cache
@@ -81,5 +84,17 @@ action :delete do
81
84
  end
82
85
  end
83
86
 
87
+ action :makecache do
88
+ execute "yum-makecache-#{new_resource.repositoryid}" do
89
+ command "yum -q makecache --disablerepo=* --enablerepo=#{new_resource.repositoryid}"
90
+ action :run
91
+ end
92
+
93
+ ruby_block "yum-cache-reload-#{new_resource.repositoryid}" do
94
+ block { Chef::Provider::Package::Yum::YumCache.instance.reload }
95
+ action :run
96
+ end
97
+ end
98
+
84
99
  alias_method :action_add, :action_create
85
100
  alias_method :action_remove, :action_delete
@@ -1,8 +1,9 @@
1
1
  #
2
2
  # Author:: Sean OMeara (<someara@getchef.com>)
3
+ # Author:: Joshua Timberman (<joshua@getchef.com>)
3
4
  # Recipe:: yum::default
4
5
  #
5
- # Copyright 2013, Chef
6
+ # Copyright 2013-2014, Chef Software, Inc (<legal@getchef.com>)
6
7
  #
7
8
  # Licensed under the Apache License, Version 2.0 (the "License");
8
9
  # you may not use this file except in compliance with the License.
@@ -17,18 +18,9 @@
17
18
  # limitations under the License.
18
19
 
19
20
  yum_globalconfig '/etc/yum.conf' do
20
- cachedir node['yum']['main']['cachedir']
21
- keepcache node['yum']['main']['keepcache']
22
- debuglevel node['yum']['main']['debuglevel']
23
- exclude node['yum']['main']['exclude']
24
- logfile node['yum']['main']['logfile']
25
- exactarch node['yum']['main']['exactarch']
26
- obsoletes node['yum']['main']['obsoletes']
27
- proxy node['yum']['main']['proxy']
28
- installonly_limit node['yum']['main']['installonly_limit']
29
- installonlypkgs node['yum']['main']['installonlypkgs']
30
- installroot node['yum']['main']['installroot']
31
- distroverpkg node['yum']['main']['distroverpkg']
32
- releasever node['yum']['main']['releasever']
21
+ node['yum']['main'].each do |config, value|
22
+ send(config.to_sym, value)
23
+ end
24
+
33
25
  action :create
34
26
  end
@@ -56,7 +56,7 @@ attribute :groupremove_leaf_only, :kind_of => [TrueClass, FalseClass], :default
56
56
  attribute :history_list_view, :kind_of => String, :equal_to => %w(users commands single-user-commands), :default => nil
57
57
  attribute :history_record, :kind_of => [TrueClass, FalseClass], :default => nil
58
58
  attribute :history_record_packages, :kind_of => String, :regex => /.*/, :default => nil
59
- attribute :http_caching, :kind_of => [TrueClass, FalseClass], :default => nil
59
+ attribute :http_caching, :kind_of => String, :equal_to => %w(packages all none), :default => nil
60
60
  attribute :installonly_limit, :kind_of => String, :regex => [/^\d+/, /keep/], :default => '3'
61
61
  attribute :installonlypkgs, :kind_of => String, :regex => /.*/, :default => nil
62
62
  attribute :installroot, :kind_of => String, :regex => /.*/, :default => nil
@@ -70,7 +70,7 @@ attribute :mdpolicy, :kind_of => String, :equal_to => %w(instant group:primary g
70
70
  attribute :metadata_expire, :kind_of => String, :regex => [/^\d+$/, /^\d+[mhd]$/, /never/], :default => nil
71
71
  attribute :mirrorlist_expire, :kind_of => String, :regex => /^\d+$/, :default => nil
72
72
  attribute :multilib_policy, :kind_of => String, :equal_to => %w(all best), :default => nil
73
- attribute :obsoletes, :kind_of => [TrueClass, FalseClass], :default => true
73
+ attribute :obsoletes, :kind_of => [TrueClass, FalseClass], :default => nil
74
74
  attribute :overwrite_groups, :kind_of => [TrueClass, FalseClass], :default => nil
75
75
  attribute :password, :kind_of => String, :regex => /.*/, :default => nil
76
76
  attribute :path, :kind_of => String, :regex => /.*/, :default => nil, :name_attribute => true
@@ -86,6 +86,7 @@ attribute :proxy_username, :kind_of => String, :regex => /.*/, :default => nil
86
86
  attribute :recent, :kind_of => String, :regex => /^\d+$/, :default => nil
87
87
  attribute :releasever, :kind_of => String, :regex => /.*/, :default => nil
88
88
  attribute :repo_gpgcheck, :kind_of => [TrueClass, FalseClass], :default => nil
89
+ attribute :reposdir, :kind_of => String, :regex => /.*/, :default => nil
89
90
  attribute :reset_nice, :kind_of => [TrueClass, FalseClass], :default => nil
90
91
  attribute :rpmverbosity, :kind_of => String, :equal_to => %w(info critical emergency error warn debug), :default => nil
91
92
  attribute :showdupesfromrepos, :kind_of => [TrueClass, FalseClass], :default => nil
@@ -103,3 +104,5 @@ attribute :timeout, :kind_of => String, :regex => /^\d+$/, :default => nil
103
104
  attribute :tolerant, :kind_of => [TrueClass, FalseClass], :default => nil
104
105
  attribute :tsflags, :kind_of => String, :regex => /.*/, :default => nil
105
106
  attribute :username, :kind_of => String, :regex => /.*/, :default => nil
107
+
108
+ attribute :options, :kind_of => Hash
@@ -18,7 +18,7 @@
18
18
  # limitations under the License.
19
19
  #
20
20
 
21
- actions :create, :delete, :add, :remove
21
+ actions :create, :delete, :add, :remove, :makecache
22
22
 
23
23
  default_action :create
24
24
 
@@ -37,12 +37,14 @@ attribute :http_caching, :kind_of => String, :equal_to => %w(packages all none),
37
37
  attribute :include_config, :kind_of => String, :regex => /.*/, :default => nil
38
38
  attribute :includepkgs, :kind_of => String, :regex => /.*/, :default => nil
39
39
  attribute :keepalive, :kind_of => [TrueClass, FalseClass], :default => nil
40
+ attribute :make_cache, :kind_of => [TrueClass, FalseClass], :default => true
40
41
  attribute :max_retries, :kind_of => String, :regex => /.*/, :default => nil
41
42
  attribute :metadata_expire, :kind_of => String, :regex => [/^\d+$/, /^\d+[mhd]$/, /never/], :default => nil
42
43
  attribute :mirrorexpire, :kind_of => String, :regex => /.*/, :default => nil
43
44
  attribute :mirrorlist, :kind_of => String, :regex => /.*/, :default => nil
44
- attribute :mirror_expire, :kind_of => String, :regex => /^\d+$/, :default => nil
45
- attribute :mirrorlist_expire, :kind_of => String, :regex => /^\d+$/, :default => nil
45
+ attribute :mirror_expire, :kind_of => String, :regex => [/^\d+$/, /^\d+[mhd]$/], :default => nil
46
+ attribute :mirrorlist_expire, :kind_of => String, :regex => [/^\d+$/, /^\d+[mhd]$/], :default => nil
47
+ attribute :mode, :default => '0644'
46
48
  attribute :priority, :kind_of => String, :regex => /^(\d?[0-9]|[0-9][0-9])$/, :default => nil
47
49
  attribute :proxy, :kind_of => String, :regex => /.*/, :default => nil
48
50
  attribute :proxy_username, :kind_of => String, :regex => /.*/, :default => nil
@@ -59,5 +61,7 @@ attribute :sslclientkey, :kind_of => String, :regex => /.*/, :default => nil
59
61
  attribute :sslverify, :kind_of => [TrueClass, FalseClass], :default => true
60
62
  attribute :timeout, :kind_of => String, :regex => /^\d+$/, :default => nil
61
63
 
64
+ attribute :options, :kind_of => Hash
65
+
62
66
  alias_method :url, :baseurl
63
67
  alias_method :keyurl, :gpgkey