lib/cronicle/client.rb in cronicle-0.2.0 vs lib/cronicle/client.rb in cronicle-0.2.1

- old
+ new

@@ -13,10 +13,14 @@ def apply(file) walk(file) end + def cleanup + walk(nil, :cleanup => true) + end + def exec(file, name) name = name.to_s jobs = load_file(file) jobs_by_host = select_host(jobs, name) @@ -37,12 +41,21 @@ end end private - def walk(file) - jobs = load_file(file) - jobs_by_host = select_host(jobs) + def walk(file, opts = {}) + if opts[:cleanup] + jobs_by_host = {} + + @host_list.all.each do |host| + jobs_by_host[host] = {} + end + else + jobs = load_file(file) + jobs_by_host = select_host(jobs) + end + exported = export_cron(jobs_by_host.keys) walk_hosts(jobs_by_host, exported) end def export_cron(host_list)