Changeset 1251
- Timestamp:
- 02/22/08 15:04:44 (8 months ago)
- Files:
-
- honeyclient/trunk/bin/cleanup_broken_clients.pl (copied) (copied from honeyclient/trunk/bin/insert_queue_urls.pl) (2 diffs, 1 prop)
- honeyclient/trunk/bin/insert_queue_urls.pl (modified) (1 diff, 1 prop)
- honeyclient/trunk/lib/HoneyClient/Manager/Database.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
honeyclient/trunk/bin/cleanup_broken_clients.pl
- Property svn:keywords set to Id "$file"
r1212 r1251 1 1 #!/usr/bin/perl -w -Ilib 2 3 # $Id$ 2 4 3 5 use strict; … … 5 7 6 8 use Data::Dumper; 9 use HoneyClient::Util::Config qw(getVar); 7 10 use HoneyClient::Manager::Database; 11 use Sys::Hostname::Long; 12 use Log::Log4perl qw(:easy); 8 13 9 my $urls = { 10 'http://www.cpan.org/' => 20, 11 'http://www.craigslist.org/' => 100, 14 our $LOG = get_logger(); 15 16 my $args = { 17 hostname => Sys::Hostname::Long::hostname_long, 12 18 }; 13 19 14 my $output = HoneyClient::Manager::Database::insert_queue_urls($urls); 15 print Dumper($output) . " URL(s) inserted.\n"; 20 my $datastore_path = getVar(name => "datastore_path", namespace => "HoneyClient::Manager::VM"); 21 my $snapshot_path = getVar(name => "snapshot_path", namespace => "HoneyClient::Manager::VM"); 22 23 my $clients = HoneyClient::Manager::Database::get_broken_clients($args); 24 25 #my ($cid, $id); 26 while (my ($cid, $id) = each %{$clients}) { 27 28 $LOG->info("Deleting VM (" . $cid . ")"); 29 30 print "Executing: vmware-cmd -s unregister " . $datastore_path . "/" . $cid . "/*.vmx\n"; 31 system("vmware-cmd -s unregister " . $datastore_path . "/" . $cid . "/*.vmx"); 32 33 print "Executing: vmware-cmd -s unregister " . $datastore_path . "/" . $cid . "/*.cfg\n"; 34 system("vmware-cmd -s unregister " . $datastore_path . "/" . $cid . "/*.cfg"); 35 36 print "Executing: rm -rf " . $datastore_path . "/" . $cid . "\n"; 37 system("rm -rf " . $datastore_path . "/" . $cid); 38 39 print "Executing: rm -f " . $snapshot_path . "/" . $cid . "*\n"; 40 system("rm -f " . $snapshot_path . "/" . $cid . "*"); 41 42 HoneyClient::Manager::Database::set_client_deleted($id); 43 44 print "\n"; 45 } 46 honeyclient/trunk/bin/insert_queue_urls.pl
- Property svn:keywords set to Id "$file"
r1212 r1251 1 1 #!/usr/bin/perl -w -Ilib 2 3 # $Id$ 2 4 3 5 use strict; honeyclient/trunk/lib/HoneyClient/Manager/Database.pm
r1250 r1251 270 270 } 271 271 272 # XXX: Need to comment this further. 273 sub get_broken_clients { 274 $AUTOLOAD = "Database::get_broken_clients"; 275 my $obj = shift; 276 my $obj_yaml = YAML::XS::Dump(Data::Structure::Util::unbless($obj)); 277 # Results from this call are YAML-encoded; need to deserialize them. 278 return YAML::XS::Load(_AUTOLOAD($obj_yaml)); 279 } 280 272 281 ####################################################################### 273 282
