lib/chef/knife/cook.rb in knife-solo-0.0.6 vs lib/chef/knife/cook.rb in knife-solo-0.0.7
- old
+ new
@@ -16,30 +16,20 @@
banner "knife cook [user@]hostname [json] (options)"
def run
super
-
check_syntax
-
Chef::Config.from_file('solo.rb')
-
+ check_chef_version
rsync_kitchen
-
add_patches
-
- check_chef_version
-
- logging_arg = "-l debug" if config[:verbosity] > 0
- stream_command <<-BASH
- #{sudo} chef-solo -c #{chef_path}/solo.rb \
- -j #{chef_path}/#{node_config} \
- #{logging_arg}
- BASH
+ cook
end
def check_syntax
+ ui.msg('Checking cookbook syntax...')
Dir["**/*.rb"].each do |recipe|
ok = system "ruby -c #{recipe} >/dev/null 2>&1"
raise "Syntax error in #{recipe}" if not ok
end
@@ -81,9 +71,18 @@
constraint = "~>0.10.4"
result = run_command <<-BASH
ruby -rubygems -e "gem 'chef', '#{constraint}'"
BASH
raise "The chef gem on #{host} is out of date. Please run `#{$0} prepare #{ssh_args}` to upgrade Chef to #{constraint}." unless result.success?
+ end
+
+ def cook
+ logging_arg = "-l debug" if config[:verbosity] > 0
+ stream_command <<-BASH
+ sudo chef-solo -c #{chef_path}/solo.rb \
+ -j #{chef_path}/#{node_config} \
+ #{logging_arg}
+ BASH
end
end
end
end