Changeset 1528

Show
Ignore:
Timestamp:
04/16/08 17:14:15 (4 weeks ago)
Author:
kindlund
Message:

Added utility code.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeyclient/trunk/bin/identify_clients.pl

    r1343 r1528  
    1515 
    1616my $args = { 
    17     hostname => Sys::Hostname::Long::hostname_long, 
     17    client_id => $ARGV[0],  
    1818}; 
    1919 
     
    2121my $snapshot_path = getVar(name => "snapshot_path", namespace => "HoneyClient::Manager::VM"); 
    2222 
    23 my $clients = HoneyClient::Manager::Database::get_broken_clients($args); 
    24  
    25 while (my ($cid, $id) = each %{$clients}) { 
    26  
    27     $LOG->info("Deleting VM (" . $cid . ")"); 
    28  
    29     $LOG->info("Executing: vmware-cmd " . $datastore_path . "/" . $cid . "/*.vmx stop hard"); 
    30     system("vmware-cmd " . $datastore_path . "/" . $cid . "/*.vmx stop hard"); 
    31  
    32     $LOG->info("Executing: vmware-cmd " . $datastore_path . "/" . $cid . "/*.cfg stop hard"); 
    33     system("vmware-cmd " . $datastore_path . "/" . $cid . "/*.cfg stop hard"); 
    34  
    35     $LOG->info("Executing: vmware-cmd -s unregister " . $datastore_path . "/" . $cid . "/*.vmx"); 
    36     system("vmware-cmd -s unregister " . $datastore_path . "/" . $cid . "/*.vmx"); 
    37  
    38     $LOG->info("Executing: vmware-cmd -s unregister " . $datastore_path . "/" . $cid . "/*.cfg"); 
    39     system("vmware-cmd -s unregister " . $datastore_path . "/" . $cid . "/*.cfg"); 
    40      
    41     $LOG->info("Executing: rm -rf " . $datastore_path . "/" . $cid); 
    42     system("rm -rf " . $datastore_path . "/" . $cid); 
    43  
    44     $LOG->info("Executing: rm -f " . $snapshot_path . "/" . $cid . "*"); 
    45     system("rm -f " . $snapshot_path . "/" . $cid . "*"); 
    46  
    47     HoneyClient::Manager::Database::set_client_deleted($id); 
    48  
    49     print "\n"; 
    50 
    51  
     23exit HoneyClient::Manager::Database::client_exists($args);