summaryrefslogtreecommitdiffstats
path: root/abs/core/func/power.py
blob: 668965a82170cf08d6c8a88a67b8482815c4d810 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
##
# other modules
import sub_process

# our modules
import func_module

# =================================

class power(func_module.FuncModule):

    version = "0.0.1"
    api_version = "0.0.1"
    description = "Reboot the server"

    def reboot(self,flags="-q onecheck"):
        """
        Reboot the server
    """
        flags.replace(";","") # prevent stupidity
        cmd = sub_process.Popen("/sbin/reboot")
        data = cmd.communicate()[0]
        results = ['reboot']
        return (cmd.returncode, results)

    def poweroff (self,flags="-q onecheck"):
        """
        Reboot the server
        """
        flags.replace(";","") # prevent stupidity
        cmd = sub_process.Popen("/sbin/poweroff")
        data = cmd.communicate()[0]
        results = ['off']
        return (cmd.returncode, results)