Merge lp:~avishai-ish-shalom/cloud-init/chef-refactor into lp:~cloud-init-dev/cloud-init/trunk
- chef-refactor
- Merge into trunk
Status: | Rejected |
---|---|
Rejected by: | Scott Moser |
Proposed branch: | lp:~avishai-ish-shalom/cloud-init/chef-refactor |
Merge into: | lp:~cloud-init-dev/cloud-init/trunk |
Diff against target: |
359 lines (+212/-45) 3 files modified
cloudinit/config/cc_chef.py (+189/-42) doc/examples/cloud-config-chef.txt (+17/-2) templates/chef_client.rb.tmpl (+6/-1) |
To merge this branch: | bzr merge lp:~avishai-ish-shalom/cloud-init/chef-refactor |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Scott Moser | Needs Fixing | ||
Review via email: mp+164009@code.launchpad.net |
Commit message
Description of the change
Refactored cc_chef, added omnibus and chef-solo support
Avishai Ish-Shalom (avishai-ish-shalom) wrote : | # |
i'll review my patch and get back to you.
On Wed, Jul 17, 2013 at 11:09 PM, Scott Moser <email address hidden> wrote:
> Review: Needs Fixing
>
> Avishai,
> Some comments. Sorry for taking so long to see this.
> * BIN_PATHS: I would really prefer that we just use PATH to look for
> executables. If the system is not set up to have PATH set correctly, the
> user should just use a full path. ie, the right way to get your executable
> found is to put it in PATH.
> * repo_path': '/var/lib/
> doesn't this fit better somewhere else ? I"m not entirely opposed to
> it, but it just seems like there is likely somewhere else to look. Also,
> if you're using /var/lib/cloud, please get it through 'cloud_dir' in the
> Paths object (cloud.paths).
> * some tests would be nice.
>
> Thanks for the submission, sorry its taken so long to get around to it.
>
> --
>
> https:/
> You are the owner of lp:~avishai-ish-shalom/cloud-init/chef-refactor.
>
Scott Moser (smoser) wrote : | # |
Hello,
Thank you for taking the time to contribute to cloud-init. Cloud-init has moved its revision control system to git. As a result, we are marking all bzr merge proposals as 'rejected'. If you would like to re-submit this proposal for review, please do so by following the current HACKING documentation at http://
Unmerged revisions
- 818. By Avishai Ish-Shalom
-
cc_chef: gem install method should install build-essential
- 817. By Avishai Ish-Shalom
-
cc_chef: get_cookbooks from tarball or git
- 816. By Avishai Ish-Shalom
-
cc_chef: refactored, implemented omnibus, initial chef-solo support
TODO: Add chef-solo get_cookbooks variants
Preview Diff
1 | === modified file 'cloudinit/config/cc_chef.py' | |||
2 | --- cloudinit/config/cc_chef.py 2012-12-12 15:39:43 +0000 | |||
3 | +++ cloudinit/config/cc_chef.py 2013-05-15 17:20:33 +0000 | |||
4 | @@ -20,10 +20,15 @@ | |||
5 | 20 | 20 | ||
6 | 21 | import json | 21 | import json |
7 | 22 | import os | 22 | import os |
8 | 23 | import urllib | ||
9 | 23 | 24 | ||
10 | 24 | from cloudinit import templater | 25 | from cloudinit import templater |
11 | 25 | from cloudinit import url_helper | 26 | from cloudinit import url_helper |
12 | 26 | from cloudinit import util | 27 | from cloudinit import util |
13 | 28 | from cloudinit.settings import PER_INSTANCE | ||
14 | 29 | from urlparse import urlparse | ||
15 | 30 | |||
16 | 31 | frequency = PER_INSTANCE | ||
17 | 27 | 32 | ||
18 | 28 | RUBY_VERSION_DEFAULT = "1.8" | 33 | RUBY_VERSION_DEFAULT = "1.8" |
19 | 29 | 34 | ||
20 | @@ -38,20 +43,51 @@ | |||
21 | 38 | 43 | ||
22 | 39 | OMNIBUS_URL = "https://www.opscode.com/chef/install.sh" | 44 | OMNIBUS_URL = "https://www.opscode.com/chef/install.sh" |
23 | 40 | 45 | ||
24 | 46 | BIN_PATHS = ( | ||
25 | 47 | "/usr/bin", "/usr/local/bin", | ||
26 | 48 | "/var/lib/gems/2.0.0/bin", | ||
27 | 49 | "/var/lib/gems/1.9.1/bin", | ||
28 | 50 | "/var/lib/gems/1.9/bin", | ||
29 | 51 | "/var/lib/gems/1.8/bin" | ||
30 | 52 | ) | ||
31 | 53 | DEFAULT_ARGS = { | ||
32 | 54 | 'interval': ('-i', 1800), | ||
33 | 55 | 'splay': ('-s', 300), | ||
34 | 56 | 'daemonize': ('-d', True), | ||
35 | 57 | 'fork': ('-f', True) | ||
36 | 58 | } | ||
37 | 59 | DEFAULT_CFG = { | ||
38 | 60 | 'repo_path': '/var/lib/cloud/chef_repo', | ||
39 | 61 | 'repo_source_type': 'tarball' | ||
40 | 62 | } | ||
41 | 63 | JSON_ATTRIB_FILE = '/etc/chef/firstboot.json' | ||
42 | 64 | |||
43 | 41 | 65 | ||
44 | 42 | def handle(name, cfg, cloud, log, _args): | 66 | def handle(name, cfg, cloud, log, _args): |
46 | 43 | 67 | log.info("Starting cc_chef") | |
47 | 44 | # If there isn't a chef key in the configuration don't do anything | 68 | # If there isn't a chef key in the configuration don't do anything |
48 | 45 | if 'chef' not in cfg: | 69 | if 'chef' not in cfg: |
49 | 46 | log.debug(("Skipping module named %s," | 70 | log.debug(("Skipping module named %s," |
50 | 47 | " no 'chef' key in configuration"), name) | 71 | " no 'chef' key in configuration"), name) |
51 | 48 | return | 72 | return |
52 | 49 | chef_cfg = cfg['chef'] | ||
53 | 50 | 73 | ||
54 | 74 | chef_cfg = dict(DEFAULT_CFG.items() + cfg['chef'].items()) | ||
55 | 75 | log.debug("Chef config: %r", chef_cfg) | ||
56 | 51 | # Ensure the chef directories we use exist | 76 | # Ensure the chef directories we use exist |
57 | 52 | for d in CHEF_DIRS: | 77 | for d in CHEF_DIRS: |
58 | 53 | util.ensure_dir(d) | 78 | util.ensure_dir(d) |
59 | 54 | 79 | ||
60 | 80 | if 'mode' in chef_cfg: | ||
61 | 81 | chef_mode = chef_cfg['mode'] | ||
62 | 82 | else: | ||
63 | 83 | if 'server_url' in chef_cfg and \ | ||
64 | 84 | ('validation_key' in chef_cfg or 'validation_cert' in chef_cfg): | ||
65 | 85 | chef_mode = "client" | ||
66 | 86 | else: | ||
67 | 87 | chef_mode = "solo" | ||
68 | 88 | |||
69 | 89 | log.debug("Chef mode is %s", chef_mode) | ||
70 | 90 | |||
71 | 55 | # Set the validation key based on the presence of either 'validation_key' | 91 | # Set the validation key based on the presence of either 'validation_key' |
72 | 56 | # or 'validation_cert'. In the case where both exist, 'validation_key' | 92 | # or 'validation_cert'. In the case where both exist, 'validation_key' |
73 | 57 | # takes precedence | 93 | # takes precedence |
74 | @@ -61,80 +97,191 @@ | |||
75 | 61 | break | 97 | break |
76 | 62 | 98 | ||
77 | 63 | # Create the chef config from template | 99 | # Create the chef config from template |
91 | 64 | template_fn = cloud.get_template_filename('chef_client.rb') | 100 | if not write_chef_config(chef_cfg, cloud, chef_mode, log): |
92 | 65 | if template_fn: | 101 | return False |
80 | 66 | iid = str(cloud.datasource.get_instance_id()) | ||
81 | 67 | params = { | ||
82 | 68 | 'server_url': chef_cfg['server_url'], | ||
83 | 69 | 'node_name': util.get_cfg_option_str(chef_cfg, 'node_name', iid), | ||
84 | 70 | 'environment': util.get_cfg_option_str(chef_cfg, 'environment', | ||
85 | 71 | '_default'), | ||
86 | 72 | 'validation_name': chef_cfg['validation_name'] | ||
87 | 73 | } | ||
88 | 74 | templater.render_to_file(template_fn, '/etc/chef/client.rb', params) | ||
89 | 75 | else: | ||
90 | 76 | log.warn("No template found, not rendering to /etc/chef/client.rb") | ||
93 | 77 | 102 | ||
94 | 78 | # set the firstboot json | 103 | # set the firstboot json |
103 | 79 | initial_json = {} | 104 | write_json_attrib_file(chef_cfg) |
96 | 80 | if 'run_list' in chef_cfg: | ||
97 | 81 | initial_json['run_list'] = chef_cfg['run_list'] | ||
98 | 82 | if 'initial_attributes' in chef_cfg: | ||
99 | 83 | initial_attributes = chef_cfg['initial_attributes'] | ||
100 | 84 | for k in list(initial_attributes.keys()): | ||
101 | 85 | initial_json[k] = initial_attributes[k] | ||
102 | 86 | util.write_file('/etc/chef/firstboot.json', json.dumps(initial_json)) | ||
104 | 87 | 105 | ||
105 | 88 | # If chef is not installed, we install chef based on 'install_type' | 106 | # If chef is not installed, we install chef based on 'install_type' |
106 | 107 | install_chef(chef_cfg, cloud) | ||
107 | 108 | |||
108 | 109 | if chef_mode == 'solo': | ||
109 | 110 | get_cookbooks(chef_cfg, cloud) | ||
110 | 111 | |||
111 | 112 | chef_args = chef_args_from_cfg(chef_cfg, ['-j', JSON_ATTRIB_FILE]) | ||
112 | 113 | if util.get_cfg_option_bool(chef_cfg, 'autostart', default=True): | ||
113 | 114 | run_chef(log, chef_mode, chef_args) | ||
114 | 115 | |||
115 | 116 | |||
116 | 117 | def install_chef(chef_cfg, cloud): | ||
117 | 89 | if (not os.path.isfile('/usr/bin/chef-client') or | 118 | if (not os.path.isfile('/usr/bin/chef-client') or |
119 | 90 | util.get_cfg_option_bool(chef_cfg, 'force_install', default=False)): | 119 | util.get_cfg_option_bool(chef_cfg, 'force_install', default=False)): |
120 | 91 | 120 | ||
121 | 92 | install_type = util.get_cfg_option_str(chef_cfg, 'install_type', | 121 | install_type = util.get_cfg_option_str(chef_cfg, 'install_type', |
122 | 93 | 'packages') | 122 | 'packages') |
123 | 123 | chef_version = util.get_cfg_option_str(chef_cfg, 'version', None) | ||
124 | 124 | |||
125 | 94 | if install_type == "gems": | 125 | if install_type == "gems": |
126 | 95 | # this will install and run the chef-client from gems | 126 | # this will install and run the chef-client from gems |
127 | 96 | chef_version = util.get_cfg_option_str(chef_cfg, 'version', None) | ||
128 | 97 | ruby_version = util.get_cfg_option_str(chef_cfg, 'ruby_version', | 127 | ruby_version = util.get_cfg_option_str(chef_cfg, 'ruby_version', |
129 | 98 | RUBY_VERSION_DEFAULT) | 128 | RUBY_VERSION_DEFAULT) |
135 | 99 | install_chef_from_gems(cloud.distro, ruby_version, chef_version) | 129 | ohai_version = util.get_cfg_option_str(chef_cfg, 'ohai_version', None) |
136 | 100 | # and finally, run chef-client | 130 | install_chef_from_gems(cloud.distro, ruby_version, chef_version, ohai_version) |
132 | 101 | log.debug('Running chef-client') | ||
133 | 102 | util.subp(['/usr/bin/chef-client', | ||
134 | 103 | '-d', '-i', '1800', '-s', '20'], capture=False) | ||
137 | 104 | elif install_type == 'packages': | 131 | elif install_type == 'packages': |
138 | 105 | # this will install and run the chef-client from packages | 132 | # this will install and run the chef-client from packages |
139 | 106 | cloud.distro.install_packages(('chef',)) | 133 | cloud.distro.install_packages(('chef',)) |
140 | 107 | elif install_type == 'omnibus': | 134 | elif install_type == 'omnibus': |
141 | 108 | url = util.get_cfg_option_str(chef_cfg, "omnibus_url", OMNIBUS_URL) | 135 | url = util.get_cfg_option_str(chef_cfg, "omnibus_url", OMNIBUS_URL) |
143 | 109 | content = url_helper.readurl(url=url, retries=5) | 136 | content = url_helper.readurl(url=url, retries=5).contents |
144 | 110 | with util.tempdir() as tmpd: | 137 | with util.tempdir() as tmpd: |
145 | 111 | # use tmpd over tmpfile to avoid 'Text file busy' on execute | 138 | # use tmpd over tmpfile to avoid 'Text file busy' on execute |
146 | 112 | tmpf = "%s/chef-omnibus-install" % tmpd | 139 | tmpf = "%s/chef-omnibus-install" % tmpd |
147 | 113 | util.write_file(tmpf, content, mode=0700) | 140 | util.write_file(tmpf, content, mode=0700) |
149 | 114 | util.subp([tmpf], capture=False) | 141 | args = [] |
150 | 142 | if chef_version: | ||
151 | 143 | args.append("-v") | ||
152 | 144 | args.append(chef_version) | ||
153 | 145 | util.subp([tmpf] + args, capture=False) | ||
154 | 115 | else: | 146 | else: |
156 | 116 | log.warn("Unknown chef install type %s", install_type) | 147 | raise RuntimeError("Unknown chef install type %s" % install_type) |
157 | 148 | |||
158 | 149 | |||
159 | 150 | def write_chef_config(chef_cfg, cloud, chef_mode, log): | ||
160 | 151 | "Write chef config file from template" | ||
161 | 152 | template_fn = cloud.get_template_filename('chef_client.rb') | ||
162 | 153 | cfg_filename = "/etc/chef/" + ("client.rb" if chef_mode == "client" else "solo.rb") | ||
163 | 154 | if template_fn: | ||
164 | 155 | iid = str(cloud.datasource.get_instance_id()) | ||
165 | 156 | params = { | ||
166 | 157 | 'node_name': util.get_cfg_option_str(chef_cfg, 'node_name', iid), | ||
167 | 158 | 'environment': util.get_cfg_option_str(chef_cfg, 'environment', | ||
168 | 159 | '_default'), | ||
169 | 160 | 'mode': chef_mode | ||
170 | 161 | } | ||
171 | 162 | |||
172 | 163 | if chef_mode == "client": | ||
173 | 164 | # server_url is required | ||
174 | 165 | params['server_url'] = chef_cfg['server_url'] | ||
175 | 166 | params['validation_name'] = chef_cfg.get('validation_name', None) | ||
176 | 167 | elif chef_mode == "solo": | ||
177 | 168 | params['repo_path'] = chef_cfg['repo_path'] | ||
178 | 169 | |||
179 | 170 | templater.render_to_file(template_fn, cfg_filename, params) | ||
180 | 171 | return True | ||
181 | 172 | else: | ||
182 | 173 | log.warn("No template found, not rendering to %s", cfg_filename) | ||
183 | 174 | return False | ||
184 | 175 | |||
185 | 176 | |||
186 | 177 | def write_json_attrib_file(chef_cfg): | ||
187 | 178 | initial_json = {} | ||
188 | 179 | if 'run_list' in chef_cfg: | ||
189 | 180 | initial_json['run_list'] = chef_cfg['run_list'] | ||
190 | 181 | if 'initial_attributes' in chef_cfg: | ||
191 | 182 | initial_attributes = chef_cfg['initial_attributes'] | ||
192 | 183 | for k in list(initial_attributes.keys()): | ||
193 | 184 | initial_json[k] = initial_attributes[k] | ||
194 | 185 | util.write_file(JSON_ATTRIB_FILE, json.dumps(initial_json)) | ||
195 | 186 | |||
196 | 187 | |||
197 | 188 | def run_chef(log, chef_type, chef_args): | ||
198 | 189 | chef_bin = "chef-%s" % chef_type | ||
199 | 190 | chef_exec = None | ||
200 | 191 | for path in BIN_PATHS: | ||
201 | 192 | f = os.path.join(path, chef_bin) | ||
202 | 193 | if os.path.isfile(f) and os.access(f, os.X_OK): | ||
203 | 194 | chef_exec = f | ||
204 | 195 | break | ||
205 | 196 | if chef_exec is None: | ||
206 | 197 | raise RuntimeError("Couldn't find chef executable for %s" % chef_bin) | ||
207 | 198 | log.debug("Running %s", chef_exec) | ||
208 | 199 | util.subp([chef_exec] + chef_args, capture=False) | ||
209 | 117 | 200 | ||
210 | 118 | 201 | ||
211 | 119 | def get_ruby_packages(version): | 202 | def get_ruby_packages(version): |
212 | 120 | # return a list of packages needed to install ruby at version | 203 | # return a list of packages needed to install ruby at version |
214 | 121 | pkgs = ['ruby%s' % version, 'ruby%s-dev' % version] | 204 | pkgs = ['ruby%s' % version, 'ruby%s-dev' % version, 'build-essential'] |
215 | 122 | if version == "1.8": | 205 | if version == "1.8": |
216 | 123 | pkgs.extend(('libopenssl-ruby1.8', 'rubygems1.8')) | 206 | pkgs.extend(('libopenssl-ruby1.8', 'rubygems1.8')) |
217 | 124 | return pkgs | 207 | return pkgs |
218 | 125 | 208 | ||
219 | 126 | 209 | ||
221 | 127 | def install_chef_from_gems(ruby_version, chef_version, distro): | 210 | def install_chef_from_gems(distro, ruby_version, chef_version, ohai_version=None): |
222 | 128 | distro.install_packages(get_ruby_packages(ruby_version)) | 211 | distro.install_packages(get_ruby_packages(ruby_version)) |
223 | 212 | |||
224 | 213 | def gem_install(gem, version=None): | ||
225 | 214 | cmd_args = ['/usr/bin/gem', 'install', gem] | ||
226 | 215 | if version is not None: | ||
227 | 216 | cmd_args.append('-v') | ||
228 | 217 | cmd_args.append(version) | ||
229 | 218 | |||
230 | 219 | cmd_args += ['--no-rdoc', '--bindir', '/usr/bin', '-q'] | ||
231 | 220 | |||
232 | 221 | return util.subp(cmd_args, capture=False) | ||
233 | 222 | |||
234 | 129 | if not os.path.exists('/usr/bin/gem'): | 223 | if not os.path.exists('/usr/bin/gem'): |
235 | 130 | util.sym_link('/usr/bin/gem%s' % ruby_version, '/usr/bin/gem') | 224 | util.sym_link('/usr/bin/gem%s' % ruby_version, '/usr/bin/gem') |
236 | 131 | if not os.path.exists('/usr/bin/ruby'): | 225 | if not os.path.exists('/usr/bin/ruby'): |
237 | 132 | util.sym_link('/usr/bin/ruby%s' % ruby_version, '/usr/bin/ruby') | 226 | util.sym_link('/usr/bin/ruby%s' % ruby_version, '/usr/bin/ruby') |
242 | 133 | if chef_version: | 227 | if ohai_version: |
243 | 134 | util.subp(['/usr/bin/gem', 'install', 'chef', | 228 | gem_install('ohai', ohai_version) |
244 | 135 | '-v %s' % chef_version, '--no-ri', | 229 | gem_install('chef', chef_version) |
245 | 136 | '--no-rdoc', '--bindir', '/usr/bin', '-q'], capture=False) | 230 | |
246 | 231 | |||
247 | 232 | def chef_args_from_cfg(cfg, extra_args=[]): | ||
248 | 233 | merged_args = {} | ||
249 | 234 | for (k, v) in DEFAULT_ARGS.iteritems(): | ||
250 | 235 | merged_args[k] = (v[0], cfg.get(k, v[1])) | ||
251 | 236 | |||
252 | 237 | if merged_args['daemonize'][1] is False: | ||
253 | 238 | del merged_args['interval'] | ||
254 | 239 | del merged_args['splay'] | ||
255 | 240 | |||
256 | 241 | args = [] | ||
257 | 242 | for (k, (arg, v)) in merged_args.iteritems(): | ||
258 | 243 | if type(v) == bool: | ||
259 | 244 | if util.get_cfg_option_bool(cfg, k, v): | ||
260 | 245 | args.append(arg) | ||
261 | 246 | else: | ||
262 | 247 | args.append(arg) | ||
263 | 248 | args.append(str(cfg.get(k, v))) | ||
264 | 249 | |||
265 | 250 | return args + extra_args | ||
266 | 251 | |||
267 | 252 | |||
268 | 253 | def get_cookbooks(cfg, cloud): | ||
269 | 254 | repo_source_type = util.get_cfg_option_str( | ||
270 | 255 | cfg, 'repo_source_type', default='tarball') | ||
271 | 256 | if repo_source_type == 'git': | ||
272 | 257 | get_cookbooks_from_git(cfg, cloud) | ||
273 | 258 | elif repo_source_type == 'tarball': | ||
274 | 259 | get_cookbooks_from_tarball(cfg) | ||
275 | 137 | else: | 260 | else: |
279 | 138 | util.subp(['/usr/bin/gem', 'install', 'chef', | 261 | raise RuntimeError("Unknown cookbooks source type %s" % repo_source_type) |
280 | 139 | '--no-ri', '--no-rdoc', '--bindir', | 262 | |
281 | 140 | '/usr/bin', '-q'], capture=False) | 263 | |
282 | 264 | def get_cookbooks_from_git(cfg, cloud): | ||
283 | 265 | cloud.distro.install_packages('git') | ||
284 | 266 | enclosing_dir = os.path.dirname(cfg['repo_path']) | ||
285 | 267 | if not os.path.isdir(enclosing_dir): | ||
286 | 268 | os.makedirs(enclosing_dir) | ||
287 | 269 | util.subp(['git', 'clone', '--recurse-submodules', cfg['repo_source'], cfg['repo_path']]) | ||
288 | 270 | |||
289 | 271 | |||
290 | 272 | def get_cookbooks_from_tarball(cfg): | ||
291 | 273 | with util.tempdir() as tmpd: | ||
292 | 274 | filename = os.path.basename(urlparse(cfg['repo_source']).path) | ||
293 | 275 | tmpfile = os.path.join(tmpd, filename) | ||
294 | 276 | urllib.urlretrieve(cfg['repo_source'], tmpfile) | ||
295 | 277 | if not os.path.isdir(cfg['repo_path']): | ||
296 | 278 | os.makedirs(cfg['repo_path']) | ||
297 | 279 | util.subp(['tar', '-xf', tmpfile, '-C', cfg['repo_path']]) | ||
298 | 280 | |||
299 | 281 | |||
300 | 282 | def get_cookbooks_from_berkshelf(cfg): | ||
301 | 283 | raise NotImplementedError() | ||
302 | 284 | |||
303 | 285 | |||
304 | 286 | def get_cookbooks_from_librarian(cfg): | ||
305 | 287 | raise NotImplementedError() | ||
306 | 141 | 288 | ||
307 | === modified file 'doc/examples/cloud-config-chef.txt' | |||
308 | --- doc/examples/cloud-config-chef.txt 2012-12-12 15:39:43 +0000 | |||
309 | +++ doc/examples/cloud-config-chef.txt 2013-05-15 17:20:33 +0000 | |||
310 | @@ -84,8 +84,23 @@ | |||
311 | 84 | maxclients: 100 | 84 | maxclients: 100 |
312 | 85 | keepalive: "off" | 85 | keepalive: "off" |
313 | 86 | 86 | ||
316 | 87 | # if install_type is 'omnibus', change the url to download | 87 | # For chef-solo, we want to download cookbooks. Currently git and tarball can be used |
317 | 88 | omnibus_url: "https://www.opscode.com/chef/install.sh" | 88 | # tarball/git should contain cookbooks, roles and data_bags folders |
318 | 89 | #repo_source_type: git | ||
319 | 90 | #repo_source: https://github.com/some-org/cookbooks-repo.git | ||
320 | 91 | #repo_path: /var/lib/cloud/chef_repo | ||
321 | 92 | |||
322 | 93 | # if install_type is 'omnibus', change the url to the download script | ||
323 | 94 | #omnibus_url: "https://www.opscode.com/chef/install.sh" | ||
324 | 95 | |||
325 | 96 | # Daemonize and run every 'interval' | ||
326 | 97 | #daemonize: true | ||
327 | 98 | #interval: 1800 | ||
328 | 99 | # Random wait before starting the run | ||
329 | 100 | #splay: 300 | ||
330 | 101 | |||
331 | 102 | # fork off a worker for every chef run, effective against memory leaks | ||
332 | 103 | fork: true | ||
333 | 89 | 104 | ||
334 | 90 | 105 | ||
335 | 91 | # Capture all subprocess output into a logfile | 106 | # Capture all subprocess output into a logfile |
336 | 92 | 107 | ||
337 | === modified file 'templates/chef_client.rb.tmpl' | |||
338 | --- templates/chef_client.rb.tmpl 2012-07-09 20:45:26 +0000 | |||
339 | +++ templates/chef_client.rb.tmpl 2013-05-15 17:20:33 +0000 | |||
340 | @@ -11,13 +11,18 @@ | |||
341 | 11 | log_level :info | 11 | log_level :info |
342 | 12 | log_location "/var/log/chef/client.log" | 12 | log_location "/var/log/chef/client.log" |
343 | 13 | ssl_verify_mode :verify_none | 13 | ssl_verify_mode :verify_none |
344 | 14 | #if $mode == 'client' | ||
345 | 14 | validation_client_name "$validation_name" | 15 | validation_client_name "$validation_name" |
346 | 15 | validation_key "/etc/chef/validation.pem" | 16 | validation_key "/etc/chef/validation.pem" |
347 | 16 | client_key "/etc/chef/client.pem" | 17 | client_key "/etc/chef/client.pem" |
348 | 17 | chef_server_url "$server_url" | 18 | chef_server_url "$server_url" |
349 | 18 | environment "$environment" | 19 | environment "$environment" |
350 | 20 | #else if $mode == 'solo' | ||
351 | 21 | cookbook_path "$repo_path/cookbooks" | ||
352 | 22 | data_bag_path "$repo_path/data_bags" | ||
353 | 23 | role_path "$repo_path/roles" | ||
354 | 24 | #end if | ||
355 | 19 | node_name "$node_name" | 25 | node_name "$node_name" |
356 | 20 | json_attribs "/etc/chef/firstboot.json" | ||
357 | 21 | file_cache_path "/var/cache/chef" | 26 | file_cache_path "/var/cache/chef" |
358 | 22 | file_backup_path "/var/backups/chef" | 27 | file_backup_path "/var/backups/chef" |
359 | 23 | pid_file "/var/run/chef/client.pid" | 28 | pid_file "/var/run/chef/client.pid" |
Avishai, cloud/chef_ repo'
Some comments. Sorry for taking so long to see this.
* BIN_PATHS: I would really prefer that we just use PATH to look for executables. If the system is not set up to have PATH set correctly, the user should just use a full path. ie, the right way to get your executable found is to put it in PATH.
* repo_path': '/var/lib/
doesn't this fit better somewhere else ? I"m not entirely opposed to it, but it just seems like there is likely somewhere else to look. Also, if you're using /var/lib/cloud, please get it through 'cloud_dir' in the Paths object (cloud.paths).
* some tests would be nice.
Thanks for the submission, sorry its taken so long to get around to it.