# File lib/puppet/application/puppetrun.rb, line 116
116:     def run_for_host(host)
117:         if options[:ping]
118:             out = %x{ping -c 1 #{host}}
119:             unless $? == 0
120:                 $stderr.print "Could not contact %s\n" % host
121:                 next
122:             end
123:         end
124:         client = Puppet::Network::Client.runner.new(
125:             :Server => host,
126:             :Port => Puppet[:puppetport]
127:         )
128: 
129:         print "Triggering %s\n" % host
130:         begin
131:             result = client.run(@tags, options[:ignoreschedules] || false, options[:foreground] || false)
132:         rescue => detail
133:             puts detail.backtrace if Puppet[:trace]
134:             $stderr.puts "Host %s failed: %s\n" % [host, detail]
135:             exit(2)
136:         end
137: 
138:         case result
139:         when "success"; exit(0)
140:         when "running"
141:             $stderr.puts "Host %s is already running" % host
142:             exit(3)
143:         else
144:             $stderr.puts "Host %s returned unknown answer '%s'" % [host, result]
145:             exit(12)
146:         end
147:     end