X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FPOD.py;h=a5eddfd38b246649d625486640ec269f3b628fc7;hb=1d3540bd2ece27d91a2ec5843628c5fa38a25024;hp=ed71236c286fa3380b42f32a5f2045a5f05c4896;hpb=f5cd72e35593c96b9996ab4e49674cccc7525c48;p=plcapi.git diff --git a/PLC/POD.py b/PLC/POD.py index ed71236..a5eddfd 100644 --- a/PLC/POD.py +++ b/PLC/POD.py @@ -1,5 +1,3 @@ -# $Id$ -# $URL$ # Marc E. Fiuczynski # Copyright (C) 2004 The Trustees of Princeton University # @@ -68,14 +66,14 @@ def _construct(id, data): def icmp_pod(host,key): uid = os.getuid() - if uid <> 0: - print "must be root to send icmp pod" + if uid != 0: + print("must be root to send icmp pod") return - + s = socket(AF_INET, SOCK_RAW, getprotobyname("icmp")) packet = _construct(0, key) # make a ping packet addr = (host,1) - print 'pod sending icmp-based reboot request to %s' % host + print('pod sending icmp-based reboot request to %s' % host) for i in range(1,10): s.sendto(packet, addr) @@ -84,7 +82,7 @@ def udp_pod(host,key,fromaddr=('', 0)): s = socket(AF_INET, SOCK_DGRAM) s.bind(fromaddr) packet = key - print 'pod sending udp-based reboot request to %s' % host + print('pod sending udp-based reboot request to %s' % host) for i in range(1,10): s.sendto(packet, addr)