diff options
author | Radek Novacek <rnovacek@redhat.com> | 2012-07-23 14:33:48 +0200 |
---|---|---|
committer | Radek Novacek <rnovacek@redhat.com> | 2012-07-23 14:35:13 +0200 |
commit | 78357ae1f43f7bf84b3386f6cd97c166040319cd (patch) | |
tree | f32d88fef165cc9cf5ac88328713a7e5744ce0cc /src/power | |
parent | ce3f2520c5046c7b7703742dd5c7481b5f98c52e (diff) | |
download | openlmi-providers-78357ae1f43f7bf84b3386f6cd97c166040319cd.tar.gz openlmi-providers-78357ae1f43f7bf84b3386f6cd97c166040319cd.tar.xz openlmi-providers-78357ae1f43f7bf84b3386f6cd97c166040319cd.zip |
Move power example script to examples/ directory
Diffstat (limited to 'src/power')
-rwxr-xr-x | src/power/sblim_cmpi_power_test.py | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/src/power/sblim_cmpi_power_test.py b/src/power/sblim_cmpi_power_test.py deleted file mode 100755 index f67fd87..0000000 --- a/src/power/sblim_cmpi_power_test.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/python - -import sys -import pywbem - -if len(sys.argv) < 4: - print """Usage: %s <address> <state> [username] [password] - Connect to CIM server at address and change the power state of the machine. - -Available states: - 4 - sleep - 5 - force reboot - 7 - hibernate - 8 - force poweroff - 12 - poweroff - 15 - reboot - -Example: %s https://127.0.0.1"5989 4 root redhat""" % (sys.argv[0], sys.argv[0]) - sys.exit(1) - -url = sys.argv[1] -try: - state = int(sys.argv[2]) -except ValueError: - print >>sys.stderr, "Unknown state: %s" % sys.argv[2] - sys.exit(4) - -username = None -password = None -if len(sys.argv) > 3: - username = sys.argv[3] -if len(sys.argv) > 4: - password = sys.argv[4] - -cliconn = pywbem.WBEMConnection(url, (username, password)) - -computerSystems = cliconn.ExecQuery('WQL', 'select * from Linux_ComputerSystem') - -if len(computerSystems) == 0: - print >>sys.stderr, "No usable Linux_ComputerSystem instance found." - sys.exit(2) - -if len(computerSystems) > 1: - print >>sys.stderr, "More than one Linux_ComputerSystem instance found, don't know which to use." - sys.exit(3) - -print cliconn.InvokeMethod("RequestPowerStateChange", "Linux_PowerManagementService", - ManagedElement=computerSystems[0].path, - TimeoutPeriod=pywbem.datetime.now(), - PowerState=pywbem.Uint16(state), - Time=pywbem.datetime.now() - ) |