Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- # quit unless just 1 argument (hostname) is passed
- unless ARGV.length == 1
- puts "Invalid number of arguments!"
- puts "Usage: runonce.rb <hostname>"
- exit
- end
- def mco_retry
- rc = 0
- puts "Asking puppet to runonce multiple times ..."
- yield
- return rc
- end
- mco_retry {3.times { system("mco puppet runonce -F hostname=\"something\""); rc = $?.exitstatus; break if rc.zero?; sleep(30)}}
Advertisement
Add Comment
Please, Sign In to add comment