From 788c4ac91ca30732a712c0e576cd42ed50291627 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Fri, 21 Sep 2012 01:04:41 +0000 Subject: [PATCH] add again with new execute permission git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13860 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/xCAT-wsapi/xcatrhevh.cgi | 50 ++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 xCAT-server/xCAT-wsapi/xcatrhevh.cgi diff --git a/xCAT-server/xCAT-wsapi/xcatrhevh.cgi b/xCAT-server/xCAT-wsapi/xcatrhevh.cgi new file mode 100755 index 000000000..d56811288 --- /dev/null +++ b/xCAT-server/xCAT-wsapi/xcatrhevh.cgi @@ -0,0 +1,50 @@ +#!/usr/bin/perl + +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html + +use strict; +use CGI qw/:standard/; +use Socket; +use IO::Socket::INET; +use IO::Socket::SSL; IO::Socket::SSL->import('inet4'); + + +my $q = CGI->new; +my $url = $q->url; +my $pathInfo = $q->path_info; +my $peerAdd = $q->remote_addr; + +my $iaddr = inet_aton($peerAdd); +my $peerhost = gethostbyaddr($iaddr, AF_INET); +$peerhost =~ s/\..*//; + +if ($pathInfo =~ /^\/rhevh_finish_install\/(.*)$/) { + if ($1 eq $peerhost) { + &rhevhupdateflag($peerhost); + my $cmd = "rhevhupdateflag"; + } +} +# check mapping of the IP and hostname + +sub rhevhupdateflag { + my $node = shift; + + + my $socket = IO::Socket::INET->new( + PeerAddr => "127.0.0.1", + PeerPort => '3001', + Timeout => 15,); + my $client; + if ($socket) { + $client = IO::Socket::SSL->start_SSL($socket, + Timeout => 0, + ); + } + + my $req1 = "rhevhupdateflag"; + my $req2 = ""; + my $req = $req1.$node.$req2; + + print $client $req; +} +