Skip to content

Instantly share code, notes, and snippets.

@kytruong
Created March 22, 2011 03:34
Show Gist options
  • Save kytruong/880721 to your computer and use it in GitHub Desktop.
Save kytruong/880721 to your computer and use it in GitHub Desktop.
def cmd_cp(files)
path = fjoin(admin_share, workdir)
cmd_mkdir([path])
files.each do |file|
if File.directory?(file)
FileUtils.cp_r(file, path, {:verbose => true})
else
FileUtils.cp(file, fjoin(path, File.basename(file)), {:verbose => true})
end
end
end
def cmd_solo(args)
cmd = ruby_bin('chef-solo')
%w{-c solo.rb -j node.json}.each do |opt,val|
if File.exists?(fjoin(admin_share, workdir, val))
cmd << opt << val
end
end
cmd_exec(cmd << args)
end
def cmd_setup(args)
vbscript = "chef-client-setup.vbs"
# haven't known why it won't work when there is only 1 item!
#cmd_cp(fjoin(File.dirname(__FILE__), vbscript))
files = []
files << fjoin(File.dirname(__FILE__), vbscript)
files << fjoin(File.dirname(__FILE__), vbscript)
cmd_cp(files)
cmd = CSCRIPT.clone << vbscript
if config.has_key?(:proxy)
cmd << config[:proxy]
end
cmd_exec(cmd)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment