##
# 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)