Project

General

Profile

Download (3.66 KB) Statistics
| Branch: | Tag: | Revision:
#!/usr/bin/ruby -Ku

#--
# CyborgHood, a distributed system management software.
# Copyright (c) 2009-2011 Marc Dequènes (Duck) <Duck@DuckCorp.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#++

# to allow in-place run for test
$: << File.join(File.dirname(__FILE__), "..", "lib")

require 'cyborghood'


module CyborgHood
module TestClientLand
add_translations 'testclient'

class TestClientClient < Cyborg
# load config before modules are included
Config.load

inject_deferred_translations

include BotNet

def start_work
task "compare stuff" do
#ask "MapMaker", :info1, "/_cyborg_"
#ask "Librarian", :info2, "/_cyborg_"
#ask "Librarian", :library, "/Records"
#ask "Librarian", :persons, "/Records/Persons"
#ask "Librarian", :dns_domains, "/Records/DnsDomains"
#ask "Librarian", :gorou, "/Records/Persons/gorou"
#ask "Librarian", :guihome_net, "/Records/DnsDomains/guihome.net"
#ask "Librarian", :person_search, "/Records/Persons/?", {:uid => "g*"}
#ask "Librarian", :person_search_null, "/Records/Persons/?"
#ask "MapMaker", :zones, "/Zones"
#ask "MapMaker", :wanted_failure, "/prout"
#ask "MapMaker", :dns, "/Services/DNS"
#ask "MapMaker", :dnssec, "/Services/DNSSEC"
#ask "MapMaker", :zone_mp, "/Zones/milkypond.org"
#ask "MapMaker", :dns_check, "/Services/DNS/check_config"
#ask "MapMaker", :search, "/Zones/?"
#ask "MapMaker", :search_master, "/Zones/?", {:is_master => true}
#ask "MapMaker", :search_slave, "/Zones/?", {:is_master => false}
#know? "MapMaker", :k1, "/Zones"
#know? "MapMaker", :k2, "/prout"
set_user "guihome"
set_preferred_locales "fr"
#ask "Clerk", :dns_info, "/Commands/DNS/INFO"
ask "Clerk", :super_batch, "/Batch", {
:commands => [
["DNS", "INFOZZZ"],
["DNS", "INFO"]
],
:references => {},
:options => {:stop_on_error => false}
}
on_error do
puts "PLOUF"
pp errors
pp results
stop_bot :quickly
end
on_success do
puts "OK"
pp errors
pp results
#puts "Tadam: " + (results[:info1][:api_version] == results[:info2][:api_version] ? "same" : "different")
#set_preferred_locales "fr;q=1,en-us,en"
meet "waiter", :zzz
STDOUT.flush
on_success do
puts "OK compare stuff"
end
on_error do
stop_bot :quickly
end
end
end

task "waiter" do
meet "compare stuff", :zzz
on_success do
puts "OK waiter"
stop_bot :when_finished
end
end
end
end
end
end

bot = CyborgHood::TestClientLand::TestClientClient.new

trap('INT') do
bot.stop(:quickly)
end
trap('TERM') do
bot.stop(:quickly)
end

bot.run
(8-8/8)