summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPreston Cody <codeman@gentoo.org>2007-12-31 23:27:40 +0000
committerPreston Cody <codeman@gentoo.org>2007-12-31 23:27:40 +0000
commit64bbe29ab8cc4e6dbd9e950e2666d27c707310ea (patch)
tree58faaeba540c9cb1b8b68ed045b73222fc6ed9b1
parentremove dead code (diff)
downloadscire-64bbe29ab8cc4e6dbd9e950e2666d27c707310ea.tar.gz
scire-64bbe29ab8cc4e6dbd9e950e2666d27c707310ea.tar.bz2
scire-64bbe29ab8cc4e6dbd9e950e2666d27c707310ea.zip
fixing up registering and identifying code.
svn path=/branches/new-fu/; revision=299
-rwxr-xr-xclient/scireclient.pl24
1 files changed, 13 insertions, 11 deletions
diff --git a/client/scireclient.pl b/client/scireclient.pl
index bab1ced..490a85b 100755
--- a/client/scireclient.pl
+++ b/client/scireclient.pl
@@ -9,6 +9,7 @@ use IPC::Open2;
use Getopt::Long;
use Data::Dumper;
use File::Path;
+use Sys::Hostname;
my $SCIRE_CONFIG_FILE = '../etc/scire.conf'; #will be /etc/scire.conf when released.
my %conf;
@@ -160,21 +161,22 @@ sub register_client {
# my $mac = "00:11:22:33:44:55";
# my $ip = "192.168.2.3";
my ($mac, $ip) = get_interface_info(defined $conf{interface} && $conf{interface} ? $conf{interface} : "eth0");
- my ($status, $message) = parse_response(send_command("REGISTER", $mac, $ip));
- die "Could not register client $mac w/ ip $ip. Got: $message" if (! defined $status or $status ne "OK");
- debug("Client registered. Status is pending.");
+ my $hostname = hostname();
+ my ($status, $message) = parse_response(send_command("REGISTER", $mac, $ip, $hostname));
+ die "Could not register client $mac w/ ip $ip and hostname $hostname. Got: $message" if (! defined $status or $status ne "OK");
+ debug("Client registered. Status is pending. digest is $message");
+ open(FILE, ">$conf{key_file}") or die("Couldn't open key file $conf{key_file} for writing: $!");
+ print FILE "$message\n";
+ close(FILE);
}
sub identify_client {
- open(FILE, $conf{key_file}) or die "Couldn't open client_key $conf{key_file}: $!";
- my $client_key = join("", <FILE>);
+ open(FILE, $conf{key_file}) or die("Couldn't open client_key $conf{key_file}: $!");
+ my $digest = join("", <FILE>);
close(FILE);
- $conf{key_type} ||= "DSA";
-# my $key_obj = Net::SSH::Perl::Key->new($conf{key_type}, $client_key);
-# my $fingerprint = $key_obj->fingerprint();
- my $fingerprint = "124567890";
- my ($status, $message) = parse_response(send_command("IDENTIFY", $fingerprint));
+ #my $digest = "124567890";
+ my ($status, $message) = parse_response(send_command("IDENTIFY", $digest));
unless (defined $status && $status eq "OK") {
print "Could not identify to server: $message\n";
return 0;
@@ -186,7 +188,7 @@ sub identify_client {
sub get_jobs {
my ($status, $jobs) = parse_response(send_command("GET_JOBS"));
unless (defined $status && $status eq "OK") {
- print "Could not get jobs list from server: $message\n";
+ print "Could not get jobs list from server: $jobs\n";
return 0;
}
$jobs =~ s/\s//g; #Remove all whitespace