tools/cpee in cpee-2.1.51 vs tools/cpee in cpee-2.1.52
- old
+ new
@@ -38,10 +38,12 @@
opt.on("")
opt.on(wrap("[abandon! URL] running processes are stopped; ready or stopped processes are abandoned. Examples:\ncpee abandon! http://localhost:9298/1/\ncpee abandon http://localhost:9298/1-200\ncpee abandon http://localhost:9298/*"))
opt.on("")
opt.on(wrap("[abandon URL] ready or stopped processes are abandoned. Examples:\ncpee abandon http://localhost:9298/1/\ncpee abandon http://localhost:9298/1-200\ncpee abandon http://localhost:9298/*"))
opt.on("")
+ opt.on(wrap("[stopping URL] print all stopping proccess ids"))
+ opt.on("")
opt.on(wrap("[a_by_name URL STRING] ready or stopped processes are abandoned by regex on attributes/info. Examples:\ncpee abandon http://localhost:9298/1/ \"aa.a\"\ncpee abandon http://localhost:9298/1-200 aaa"))
opt.on("")
opt.on(wrap("[start URL] stopped processes are started; all others are not touched. Examples:\ncpee start http://localhost:9298/1\ncpee start http://localhost:9298/1-200\ncpee start http://localhost:9298/*"))
opt.on("")
opt.on(wrap("[delete! URL] DANGER ZONE. Vanishes forever. Not in archive. Examples:\ncpee delete! http://localhost:9298/1/"))
@@ -55,11 +57,11 @@
opt.on(wrap("[convert] converts all testsets in the current directory to the newest format"))
opt.parse!
}
if (ARGV.length == 0) ||
(ARGV.length == 1 && !(%w(ui convert).include?(ARGV[0]))) ||
- (ARGV.length == 2 && !(%w(abandon abandon! start delete! cpui new).include?(ARGV[0]))) ||
+ (ARGV.length == 2 && !(%w(abandon abandon! stopping start delete! cpui new).include?(ARGV[0]))) ||
(ARGV.length == 3 && !(%w(archive a_by_name).include?(ARGV[0]))) ||
(ARGV.length > 3)
puts ARGV.options
exit
end
@@ -279,9 +281,38 @@
Typhoeus.put(File.join(base,name.to_s,'properties','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=stopping")
elsif res1.response_body == 'stopping'
Typhoeus.put(File.join(base,name.to_s,'properties','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=stopping")
elsif res1.response_body == 'ready' || res1.response_body == 'stopped'
Typhoeus.put(File.join(base,name.to_s,'properties','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=abandoned")
+ end
+ end
+ end
+elsif command == 'stopping'
+ p1 = File.join(p1,'*') if p1 =~ /([a-zA-Z]|\/)$/
+ base = File.dirname(p1)
+ names = []
+ if File.basename(p1) =~ /(\d+)-(\d+)/
+ names = ($1.to_i..$2.to_i).to_a
+ elsif File.basename(p1) == '*'
+ res = Typhoeus.get(File.join(base,'/'), headers: { 'see-instances' => 'true' })
+ if res.success?
+ XML::Smart.string(res.response_body) do |doc|
+ doc.find('//instance/@id').each do |ele|
+ names << ele.value
+ end
+ end
+ names.reverse!
+ else
+ exit
+ end
+ else
+ names << File.basename(p1).to_i
+ end
+ names.each do |name|
+ res1 = Typhoeus.get(File.join(base,name.to_s,'properties','state','/'))
+ if res1.success?
+ if res1.response_body == 'stopping'
+ puts name
end
end
end
elsif command == 'abandon'
p1 = File.join(p1,'*') if p1 =~ /([a-zA-Z]|\/)$/