chef 0.7.10

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of chef might be problematic. Click here for more details.

Files changed (120) hide show
  1. data/LICENSE +201 -0
  2. data/README.rdoc +135 -0
  3. data/bin/chef-client +26 -0
  4. data/bin/chef-solo +26 -0
  5. data/lib/chef.rb +49 -0
  6. data/lib/chef/application.rb +98 -0
  7. data/lib/chef/application/agent.rb +18 -0
  8. data/lib/chef/application/client.rb +209 -0
  9. data/lib/chef/application/indexer.rb +141 -0
  10. data/lib/chef/application/server.rb +18 -0
  11. data/lib/chef/application/solo.rb +214 -0
  12. data/lib/chef/client.rb +396 -0
  13. data/lib/chef/compile.rb +138 -0
  14. data/lib/chef/config.rb +141 -0
  15. data/lib/chef/cookbook.rb +144 -0
  16. data/lib/chef/cookbook/metadata.rb +407 -0
  17. data/lib/chef/cookbook/metadata/version.rb +87 -0
  18. data/lib/chef/cookbook_loader.rb +168 -0
  19. data/lib/chef/couchdb.rb +172 -0
  20. data/lib/chef/daemon.rb +170 -0
  21. data/lib/chef/exceptions.rb +36 -0
  22. data/lib/chef/file_cache.rb +205 -0
  23. data/lib/chef/log.rb +39 -0
  24. data/lib/chef/mixin/check_helper.rb +31 -0
  25. data/lib/chef/mixin/checksum.rb +37 -0
  26. data/lib/chef/mixin/command.rb +351 -0
  27. data/lib/chef/mixin/create_path.rb +56 -0
  28. data/lib/chef/mixin/deep_merge.rb +36 -0
  29. data/lib/chef/mixin/find_preferred_file.rb +99 -0
  30. data/lib/chef/mixin/from_file.rb +36 -0
  31. data/lib/chef/mixin/generate_url.rb +48 -0
  32. data/lib/chef/mixin/language.rb +79 -0
  33. data/lib/chef/mixin/params_validate.rb +197 -0
  34. data/lib/chef/mixin/template.rb +84 -0
  35. data/lib/chef/node.rb +406 -0
  36. data/lib/chef/node/attribute.rb +412 -0
  37. data/lib/chef/openid_registration.rb +181 -0
  38. data/lib/chef/platform.rb +253 -0
  39. data/lib/chef/provider.rb +40 -0
  40. data/lib/chef/provider/cron.rb +137 -0
  41. data/lib/chef/provider/directory.rb +72 -0
  42. data/lib/chef/provider/execute.rb +58 -0
  43. data/lib/chef/provider/file.rb +191 -0
  44. data/lib/chef/provider/group.rb +120 -0
  45. data/lib/chef/provider/group/groupadd.rb +92 -0
  46. data/lib/chef/provider/group/pw.rb +88 -0
  47. data/lib/chef/provider/http_request.rb +102 -0
  48. data/lib/chef/provider/ifconfig.rb +131 -0
  49. data/lib/chef/provider/link.rb +157 -0
  50. data/lib/chef/provider/mount.rb +121 -0
  51. data/lib/chef/provider/mount/mount.rb +208 -0
  52. data/lib/chef/provider/package.rb +160 -0
  53. data/lib/chef/provider/package/apt.rb +110 -0
  54. data/lib/chef/provider/package/dpkg.rb +113 -0
  55. data/lib/chef/provider/package/freebsd.rb +153 -0
  56. data/lib/chef/provider/package/macports.rb +105 -0
  57. data/lib/chef/provider/package/portage.rb +124 -0
  58. data/lib/chef/provider/package/rpm.rb +99 -0
  59. data/lib/chef/provider/package/rubygems.rb +130 -0
  60. data/lib/chef/provider/package/yum-dump.py +104 -0
  61. data/lib/chef/provider/package/yum.rb +175 -0
  62. data/lib/chef/provider/remote_directory.rb +126 -0
  63. data/lib/chef/provider/remote_file.rb +134 -0
  64. data/lib/chef/provider/route.rb +118 -0
  65. data/lib/chef/provider/ruby_block.rb +15 -0
  66. data/lib/chef/provider/script.rb +42 -0
  67. data/lib/chef/provider/service.rb +129 -0
  68. data/lib/chef/provider/service/debian.rb +64 -0
  69. data/lib/chef/provider/service/freebsd.rb +157 -0
  70. data/lib/chef/provider/service/gentoo.rb +54 -0
  71. data/lib/chef/provider/service/init.rb +126 -0
  72. data/lib/chef/provider/service/redhat.rb +62 -0
  73. data/lib/chef/provider/template.rb +141 -0
  74. data/lib/chef/provider/user.rb +170 -0
  75. data/lib/chef/provider/user/pw.rb +113 -0
  76. data/lib/chef/provider/user/useradd.rb +107 -0
  77. data/lib/chef/queue.rb +145 -0
  78. data/lib/chef/recipe.rb +210 -0
  79. data/lib/chef/resource.rb +256 -0
  80. data/lib/chef/resource/apt_package.rb +34 -0
  81. data/lib/chef/resource/bash.rb +33 -0
  82. data/lib/chef/resource/cron.rb +143 -0
  83. data/lib/chef/resource/csh.rb +33 -0
  84. data/lib/chef/resource/directory.rb +76 -0
  85. data/lib/chef/resource/dpkg_package.rb +34 -0
  86. data/lib/chef/resource/execute.rb +127 -0
  87. data/lib/chef/resource/file.rb +84 -0
  88. data/lib/chef/resource/gem_package.rb +41 -0
  89. data/lib/chef/resource/group.rb +68 -0
  90. data/lib/chef/resource/http_request.rb +52 -0
  91. data/lib/chef/resource/ifconfig.rb +134 -0
  92. data/lib/chef/resource/link.rb +78 -0
  93. data/lib/chef/resource/macports_package.rb +29 -0
  94. data/lib/chef/resource/mount.rb +135 -0
  95. data/lib/chef/resource/package.rb +80 -0
  96. data/lib/chef/resource/perl.rb +33 -0
  97. data/lib/chef/resource/portage_package.rb +33 -0
  98. data/lib/chef/resource/python.rb +33 -0
  99. data/lib/chef/resource/remote_directory.rb +91 -0
  100. data/lib/chef/resource/remote_file.rb +60 -0
  101. data/lib/chef/resource/route.rb +135 -0
  102. data/lib/chef/resource/ruby.rb +33 -0
  103. data/lib/chef/resource/ruby_block.rb +20 -0
  104. data/lib/chef/resource/script.rb +51 -0
  105. data/lib/chef/resource/service.rb +134 -0
  106. data/lib/chef/resource/template.rb +60 -0
  107. data/lib/chef/resource/user.rb +98 -0
  108. data/lib/chef/resource_collection.rb +176 -0
  109. data/lib/chef/resource_definition.rb +67 -0
  110. data/lib/chef/rest.rb +238 -0
  111. data/lib/chef/role.rb +231 -0
  112. data/lib/chef/run_list.rb +156 -0
  113. data/lib/chef/runner.rb +123 -0
  114. data/lib/chef/search.rb +88 -0
  115. data/lib/chef/search/result.rb +64 -0
  116. data/lib/chef/search_index.rb +77 -0
  117. data/lib/chef/tasks/chef_repo.rake +345 -0
  118. data/lib/chef/util/file_edit.rb +125 -0
  119. data/lib/chef/util/fileedit.rb +121 -0
  120. metadata +262 -0
@@ -0,0 +1,121 @@
1
+ #
2
+ # Author:: Nuo Yan (<nuo@opscode.com>)
3
+ # Copyright:: Copyright (c) 2009 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ require 'ftools'
19
+ require 'fileutils'
20
+ require 'tempfile'
21
+
22
+ class FileEdit
23
+
24
+ private
25
+
26
+ attr_accessor :original_pathname, :contents, :file_edited
27
+
28
+ public
29
+
30
+ def initialize(filepath)
31
+ @original_pathname = filepath
32
+ @file_edited = false
33
+
34
+ raise ArgumentError, "File doesn't exist" unless File.exist? @original_pathname
35
+ raise ArgumentError, "File is blank" unless (@contents = File.new(@original_pathname).readlines).length > 0
36
+ end
37
+
38
+ #search the file line by line and match each line with the given regex
39
+ #if matched, replace the whole line with newline.
40
+ def search_file_replace_line(regex, newline)
41
+ search_match(regex, newline, 'r', 1)
42
+ end
43
+
44
+ #search the file line by line and match each line with the given regex
45
+ #if matched, replace the match (all occurances) with the replace parameter
46
+ def search_file_replace(regex, replace)
47
+ search_match(regex, replace, 'r', 2)
48
+ end
49
+
50
+ #search the file line by line and match each line with the given regex
51
+ #if matched, delete the line
52
+ def search_file_delete_line(regex)
53
+ search_match(regex, " ", 'd', 1)
54
+ end
55
+
56
+ #search the file line by line and match each line with the given regex
57
+ #if matched, delete the match (all occurances) from the line
58
+ def search_file_delete(regex)
59
+ search_match(regex, " ", 'd', 2)
60
+ end
61
+
62
+ #search the file line by line and match each line with the given regex
63
+ #if matched, insert newline after each matching line
64
+ def insert_line_after_match(regex, newline)
65
+ search_match(regex, newline, 'i', 0)
66
+ end
67
+
68
+ #Make a copy of old_file and write new file out (only if file changed)
69
+ def write_file
70
+
71
+ # file_edited is false when there was no match in the whole file and thus no contents have changed.
72
+ if file_edited
73
+ backup_pathname = original_pathname + ".old"
74
+ File.copy(original_pathname, backup_pathname)
75
+ Tempfile.open("w") do |newfile|
76
+ contents.each do |line|
77
+ newfile.puts(line)
78
+ end
79
+ newfile.flush
80
+ FileUtils.mv(newfile.path, original_pathname)
81
+ end
82
+ end
83
+ self.file_edited = false
84
+
85
+ end
86
+
87
+ private
88
+
89
+ #helper method to do the match, replace, delete, and insert operations
90
+ #command is the switch of delete, replace, and insert ('d', 'r', 'i')
91
+ #method is to control operation on whole line or only the match (1 for line, 2 for match)
92
+ def search_match(regex, replace, command, method)
93
+
94
+ #convert regex to a Regexp object (if not already is one) and store it in exp.
95
+ exp = Regexp.new(regex)
96
+
97
+ #loop through contents and do the appropriate operation depending on 'command' and 'method'
98
+ new_contents = []
99
+
100
+ contents.each do |line|
101
+ if line.match(exp)
102
+ self.file_edited = true
103
+ case
104
+ when command == 'r'
105
+ new_contents << ((method == 1) ? replace : line.gsub!(exp, replace))
106
+ when command == 'd'
107
+ if method == 2
108
+ new_contents << line.gsub!(exp, "")
109
+ end
110
+ when command == 'i'
111
+ new_contents << line
112
+ new_contents << replace
113
+ end
114
+ else
115
+ new_contents << line
116
+ end
117
+ end
118
+
119
+ self.contents = new_contents
120
+ end
121
+ end
metadata ADDED
@@ -0,0 +1,262 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chef
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.10
5
+ platform: ruby
6
+ authors:
7
+ - Adam Jacob
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-09-16 00:00:00 +12:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: mixlib-config
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.0.12
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: mixlib-cli
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: mixlib-log
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: ruby-openid
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: json
57
+ type: :runtime
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ version:
65
+ - !ruby/object:Gem::Dependency
66
+ name: erubis
67
+ type: :runtime
68
+ version_requirement:
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: "0"
74
+ version:
75
+ - !ruby/object:Gem::Dependency
76
+ name: extlib
77
+ type: :runtime
78
+ version_requirement:
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: "0"
84
+ version:
85
+ - !ruby/object:Gem::Dependency
86
+ name: stomp
87
+ type: :runtime
88
+ version_requirement:
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: "0"
94
+ version:
95
+ - !ruby/object:Gem::Dependency
96
+ name: ohai
97
+ type: :runtime
98
+ version_requirement:
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: "0"
104
+ version:
105
+ description: A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure.
106
+ email: adam@opscode.com
107
+ executables:
108
+ - chef-client
109
+ - chef-solo
110
+ extensions: []
111
+
112
+ extra_rdoc_files:
113
+ - README.rdoc
114
+ - LICENSE
115
+ files:
116
+ - LICENSE
117
+ - README.rdoc
118
+ - lib/chef/application/agent.rb
119
+ - lib/chef/application/client.rb
120
+ - lib/chef/application/indexer.rb
121
+ - lib/chef/application/server.rb
122
+ - lib/chef/application/solo.rb
123
+ - lib/chef/application.rb
124
+ - lib/chef/client.rb
125
+ - lib/chef/compile.rb
126
+ - lib/chef/config.rb
127
+ - lib/chef/cookbook/metadata/version.rb
128
+ - lib/chef/cookbook/metadata.rb
129
+ - lib/chef/cookbook.rb
130
+ - lib/chef/cookbook_loader.rb
131
+ - lib/chef/couchdb.rb
132
+ - lib/chef/daemon.rb
133
+ - lib/chef/exceptions.rb
134
+ - lib/chef/file_cache.rb
135
+ - lib/chef/log.rb
136
+ - lib/chef/mixin/check_helper.rb
137
+ - lib/chef/mixin/checksum.rb
138
+ - lib/chef/mixin/command.rb
139
+ - lib/chef/mixin/create_path.rb
140
+ - lib/chef/mixin/deep_merge.rb
141
+ - lib/chef/mixin/find_preferred_file.rb
142
+ - lib/chef/mixin/from_file.rb
143
+ - lib/chef/mixin/generate_url.rb
144
+ - lib/chef/mixin/language.rb
145
+ - lib/chef/mixin/params_validate.rb
146
+ - lib/chef/mixin/template.rb
147
+ - lib/chef/node/attribute.rb
148
+ - lib/chef/node.rb
149
+ - lib/chef/openid_registration.rb
150
+ - lib/chef/platform.rb
151
+ - lib/chef/provider/cron.rb
152
+ - lib/chef/provider/directory.rb
153
+ - lib/chef/provider/execute.rb
154
+ - lib/chef/provider/file.rb
155
+ - lib/chef/provider/group/groupadd.rb
156
+ - lib/chef/provider/group/pw.rb
157
+ - lib/chef/provider/group.rb
158
+ - lib/chef/provider/http_request.rb
159
+ - lib/chef/provider/ifconfig.rb
160
+ - lib/chef/provider/link.rb
161
+ - lib/chef/provider/mount/mount.rb
162
+ - lib/chef/provider/mount.rb
163
+ - lib/chef/provider/package/apt.rb
164
+ - lib/chef/provider/package/dpkg.rb
165
+ - lib/chef/provider/package/freebsd.rb
166
+ - lib/chef/provider/package/macports.rb
167
+ - lib/chef/provider/package/portage.rb
168
+ - lib/chef/provider/package/rpm.rb
169
+ - lib/chef/provider/package/rubygems.rb
170
+ - lib/chef/provider/package/yum-dump.py
171
+ - lib/chef/provider/package/yum.rb
172
+ - lib/chef/provider/package.rb
173
+ - lib/chef/provider/remote_directory.rb
174
+ - lib/chef/provider/remote_file.rb
175
+ - lib/chef/provider/route.rb
176
+ - lib/chef/provider/ruby_block.rb
177
+ - lib/chef/provider/script.rb
178
+ - lib/chef/provider/service/debian.rb
179
+ - lib/chef/provider/service/freebsd.rb
180
+ - lib/chef/provider/service/gentoo.rb
181
+ - lib/chef/provider/service/init.rb
182
+ - lib/chef/provider/service/redhat.rb
183
+ - lib/chef/provider/service.rb
184
+ - lib/chef/provider/template.rb
185
+ - lib/chef/provider/user/pw.rb
186
+ - lib/chef/provider/user/useradd.rb
187
+ - lib/chef/provider/user.rb
188
+ - lib/chef/provider.rb
189
+ - lib/chef/queue.rb
190
+ - lib/chef/recipe.rb
191
+ - lib/chef/resource/apt_package.rb
192
+ - lib/chef/resource/bash.rb
193
+ - lib/chef/resource/cron.rb
194
+ - lib/chef/resource/csh.rb
195
+ - lib/chef/resource/directory.rb
196
+ - lib/chef/resource/dpkg_package.rb
197
+ - lib/chef/resource/execute.rb
198
+ - lib/chef/resource/file.rb
199
+ - lib/chef/resource/gem_package.rb
200
+ - lib/chef/resource/group.rb
201
+ - lib/chef/resource/http_request.rb
202
+ - lib/chef/resource/ifconfig.rb
203
+ - lib/chef/resource/link.rb
204
+ - lib/chef/resource/macports_package.rb
205
+ - lib/chef/resource/mount.rb
206
+ - lib/chef/resource/package.rb
207
+ - lib/chef/resource/perl.rb
208
+ - lib/chef/resource/portage_package.rb
209
+ - lib/chef/resource/python.rb
210
+ - lib/chef/resource/remote_directory.rb
211
+ - lib/chef/resource/remote_file.rb
212
+ - lib/chef/resource/route.rb
213
+ - lib/chef/resource/ruby.rb
214
+ - lib/chef/resource/ruby_block.rb
215
+ - lib/chef/resource/script.rb
216
+ - lib/chef/resource/service.rb
217
+ - lib/chef/resource/template.rb
218
+ - lib/chef/resource/user.rb
219
+ - lib/chef/resource.rb
220
+ - lib/chef/resource_collection.rb
221
+ - lib/chef/resource_definition.rb
222
+ - lib/chef/rest.rb
223
+ - lib/chef/role.rb
224
+ - lib/chef/run_list.rb
225
+ - lib/chef/runner.rb
226
+ - lib/chef/search/result.rb
227
+ - lib/chef/search.rb
228
+ - lib/chef/search_index.rb
229
+ - lib/chef/tasks/chef_repo.rake
230
+ - lib/chef/util/file_edit.rb
231
+ - lib/chef/util/fileedit.rb
232
+ - lib/chef.rb
233
+ has_rdoc: true
234
+ homepage: http://wiki.opscode.com/display/chef
235
+ licenses: []
236
+
237
+ post_install_message:
238
+ rdoc_options: []
239
+
240
+ require_paths:
241
+ - lib
242
+ required_ruby_version: !ruby/object:Gem::Requirement
243
+ requirements:
244
+ - - ">="
245
+ - !ruby/object:Gem::Version
246
+ version: "0"
247
+ version:
248
+ required_rubygems_version: !ruby/object:Gem::Requirement
249
+ requirements:
250
+ - - ">="
251
+ - !ruby/object:Gem::Version
252
+ version: "0"
253
+ version:
254
+ requirements: []
255
+
256
+ rubyforge_project:
257
+ rubygems_version: 1.3.5
258
+ signing_key:
259
+ specification_version: 3
260
+ summary: A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure.
261
+ test_files: []
262
+