Skip to content

Commit

Permalink
Merge pull request #397 from motusllc/sync_improvements
Browse files Browse the repository at this point in the history
Support disabling prompt for deleting missing jobs
  • Loading branch information
brndnmtthws committed Mar 20, 2015
2 parents 05b26fc + bd0ad57 commit a55d2cc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bin/chronos-sync.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
options.http_auth_user = cred_split[0].strip
options.http_auth_pass = cred_split[1].strip
end
o.on("--delete-missing", "Prompt to delete missing jobs") do
o.on("--delete-missing", "Delete missing jobs from chronos. Prompts for confirmation unless --force is also passed.") do
options.delete_missing = true
end
o.on("--skip-sync", "Skip syncing local jobs") do
Expand Down Expand Up @@ -459,8 +459,9 @@ def delete_job(options, job_name)
def check_if_defined(jobs, name, options)
if !jobs.include?(name)
if options.delete_missing
$stdout.print "The job #{name} exists in chronos, but is not defined! Delete [yN]? "
delete_job(options, name) if $stdin.gets.chomp.downcase == "y"
$stdout.print "The job #{name} exists in chronos, but is not defined! "
$stdout.print "Delete [yN]? " unless options.force
delete_job(options, name) if (options.force || $stdin.gets.chomp.downcase == "y")
else
$stderr.puts "The job #{name} exists in chronos, but is not defined!"
end
Expand Down

0 comments on commit a55d2cc

Please sign in to comment.