5
# This library is free software; you can redistribute it and/or
6
# modify it under the terms of the GNU Lesser General Public
7
# License as published by the Free Software Foundation; either
8
# version 2.1 of the License, or (at your option) any later version.
10
# This library is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
# Lesser General Public License for more details.
15
# You should have received a copy of the GNU Lesser General Public
16
# License along with this library; if not, write to the Free Software
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
from time import sleep
30
host = argv[1].split('.')[0]+'-rm'
33
print "Not enough arguments"
37
login = [ '<RIBCL VERSION="1.2">',
38
'<LOGIN USER_LOGIN="Administrator" PASSWORD="********">' ]
41
logout = [ '</LOGIN>', '</RIBCL>' ]
44
status = [ '<SERVER_INFO MODE="read">', '<GET_HOST_POWER_STATUS/>',
48
reset = [ '<SERVER_INFO MODE="write">', '<RESET_SERVER/>', '</SERVER_INFO>' ]
51
off = [ '<SERVER_INFO MODE = "write">', '<SET_HOST_POWER HOST_POWER = "N"/>',
55
on = [ '<SERVER_INFO MODE = "write">', '<SET_HOST_POWER HOST_POWER = "Y"/>',
59
todo = { 'reset':reset, 'on':on, 'off':off, 'status':status }
64
if cmd == 'reset' and host.startswith('gfxcl'):
65
acmds.append(login + todo['off'] + logout)
66
acmds.append(login + todo['on'] + logout)
68
acmds.append(login + todo[cmd] + logout)
70
print "Invalid command: "+ cmd
78
c=HTTPSConnection(host)
79
c.send('<?xml version="1.0"?>\r\n')
92
except socket.gaierror, msg:
95
except socket.sslerror, msg:
98
except socket.error, msg: