Exemplo n.º 1
0
 def doSet(self):
     if SharedFuncs.isSupportSystemOs():
         cmd = "/sbin/service crond start"
     else:
         cmd = "/sbin/service cron start"
     (status, output) = subprocess.getstatusoutput(cmd)
     if (status != 0):
         self.result.val = "Failed to started crond service. " \
                           "Error: %s\n" % output + "The cmd is %s " % cmd
     else:
         self.result.val = "Successfully started the crond service.\n"
    def doSet(self):
        if g_Platform.isPlatFormEulerOSOrRHEL7X():
            cmd = "systemctl stop firewalld.service"
        elif SharedFuncs.isSupportSystemOs():
            cmd = "service iptables stop"
        else:
            cmd = "SuSEfirewall2 stop"

        status, output = subprocess.getstatusoutput(cmd)
        if status:
            self.result.val = "Failed to stop firewall service. Error: %s\n" \
                              % output + "The cmd is %s " % cmd
        else:
            self.result.val = "Successfully stopped the firewall service.\n"
 def doCheck(self):
     self.result.rst = ResultStatus.OK
     checkItems = ["checksum", "mtu", "cgroup", "rx", "tx"]
     bootitem = []
     bootfile = ""
     if SharedFuncs.isSupportSystemOs():
         bootfile = "/etc/rc.d/rc.local"
     else:
         bootfile = "/etc/init.d/boot.local"
     for item in checkItems:
         cmd = "grep -i %s %s" % (item, bootfile)
         (status, output) = subprocess.getstatusoutput(cmd)
         if (output):
             bootitem.append(item)
             self.result.rst = ResultStatus.NG
     if (self.result.rst == ResultStatus.OK):
         self.result.val = "no boot item added"
     else:
         self.result.val = "boot items is added:\n%s" % "\n".join(bootitem)