예제 #1
0
 def git_update(self,options):
     if options.nogit:
         return
     else:
         if options.verbose:
            print "- updating git"
     mytime = time.asctime()
     cwd = os.getcwd()
     os.chdir(options.tree)
     rc1 = sub_process.call(["/usr/bin/git", "add", "*" ], shell=False)
     rc2 = sub_process.call(["/usr/bin/git", "commit", "-a", "-m", "Func-inventory update: %s" % mytime], shell=False)
     # FIXME: check rc's
     os.chdir(cwd)
예제 #2
0
파일: check.py 프로젝트: wujcheng/func
 def check_service(self, which):
     if os.path.exists("/etc/rc.d/init.d/%s" % which):
         rc = sub_process.call(
             "/sbin/service %s status >/dev/null 2>/dev/null" % which,
             shell=True)
         if rc != 0:
             print "* service %s is not running" % which
예제 #3
0
파일: check.py 프로젝트: lmacken/func
    def check_iptables(self):
        if os.path.exists("/etc/rc.d/init.d/iptables"):
            rc = sub_process.call("/sbin/service iptables status >/dev/null 2>/dev/null", shell=True)

            if rc == 0:
                # FIXME: don't hardcode port
                print "* iptables may be running, ensure 51234 is unblocked"
예제 #4
0
파일: process.py 프로젝트: wujcheng/func
 def pkill(self, name, level=""):
     # example killall("thunderbird","-9")
     rc = sub_process.call(["/usr/bin/pkill", name, level],
                           executable="/usr/bin/pkill",
                           shell=False,
                           close_fds=True)
     return rc
예제 #5
0
파일: check.py 프로젝트: joerong666/myfunc
    def check_iptables(self):
        if os.path.exists("/etc/rc.d/init.d/iptables"):
            rc = sub_process.call("/sbin/service iptables status >/dev/null 2>/dev/null", shell=True)

            if rc == 0:
                # FIXME: don't hardcode port
                print "* iptables may be running"
                print "Insure that port %s is open for minions to connect to certmaster" % self.minion_config.certmaster_port
                print "Insure that port %s is open for overlord to connect to minions" % self.funcd_config.listen_port
예제 #6
0
    def check_iptables(self):
        if os.path.exists("/etc/rc.d/init.d/iptables"):
            rc = sub_process.call(
                "/sbin/service iptables status >/dev/null 2>/dev/null",
                shell=True)

            if rc == 0:
                # FIXME: don't hardcode port
                print "* iptables may be running, ensure 51234 is unblocked"
예제 #7
0
파일: check.py 프로젝트: wujcheng/func
    def check_iptables(self):
        if os.path.exists("/etc/rc.d/init.d/iptables"):
            rc = sub_process.call(
                "/sbin/service iptables status >/dev/null 2>/dev/null",
                shell=True)

            if rc == 0:
                # FIXME: don't hardcode port
                print "* iptables may be running"
                print "Insure that port %s is open for minions to connect to certmaster" % self.minion_config.certmaster_port
                print "Insure that port %s is open for overlord to connect to minions" % self.funcd_config.listen_port
예제 #8
0
파일: process.py 프로젝트: caglar10ur/func
 def kill(self,pid,signal="TERM"):
     if pid == "0":
         raise codes.FuncException("Killing pid group 0 not permitted")
     if signal == "":
         # this is default /bin/kill behaviour,
         # it claims, but enfore it anyway
         signal = "-TERM"
     if signal[0] != "-":
         signal = "-%s" % signal
     rc = sub_process.call(["/bin/kill",signal, pid],
                           executable="/bin/kill", shell=False,
                           close_fds=True)
     print rc
     return rc
예제 #9
0
파일: process.py 프로젝트: wujcheng/func
 def kill(self, pid, signal="TERM"):
     if pid == "0":
         raise codes.FuncException("Killing pid group 0 not permitted")
     if signal == "":
         # this is default /bin/kill behaviour,
         # it claims, but enfore it anyway
         signal = "-TERM"
     if signal[0] != "-":
         signal = "-%s" % signal
     rc = sub_process.call(["/bin/kill", signal, pid],
                           executable="/bin/kill",
                           shell=False,
                           close_fds=True)
     print rc
     return rc
예제 #10
0
 def git_setup(self,options):
     if options.nogit:
         return  
     if not os.path.exists("/usr/bin/git"):
         print "git-core is not installed, so no change tracking is available."
         print "use --no-git or, better, just install it."
         sys.exit(411) 
         
     if not os.path.exists(options.tree):
         os.makedirs(options.tree)
     dirname = os.path.join(options.tree, ".git")
     if not os.path.exists(dirname):
         if options.verbose:
             print "- initializing git repo: %s" % options.tree
         cwd = os.getcwd()
         os.chdir(options.tree)
         rc1 = sub_process.call(["/usr/bin/git", "init"], shell=False)
         # FIXME: check rc's
         os.chdir(cwd)
     else:
         if options.verbose:
             print "- git already initialized: %s" % options.tree
예제 #11
0
파일: common.py 프로젝트: caglar10ur/func
def call_iptables(args):
    return sub_process.call(["/sbin/iptables"] + args.split(),
                            executable="/sbin/iptables",
                            shell=False)
예제 #12
0
파일: check.py 프로젝트: lmacken/func
 def check_service(self, which):
     if os.path.exists("/etc/rc.d/init.d/%s" % which):
         rc = sub_process.call("/sbin/service %s status >/dev/null 2>/dev/null" % which, shell=True)
         if rc != 0:
             print "* service %s is not running" % which
예제 #13
0
파일: process.py 프로젝트: caglar10ur/func
 def pkill(self,name,level=""):
     # example killall("thunderbird","-9")
     rc = sub_process.call(["/usr/bin/pkill", name, level],
                           executable="/usr/bin/pkill", shell=False,
                           close_fds=True)
     return rc
예제 #14
0
파일: reboot.py 프로젝트: scibian/func
 def reboot(self, when='now', message=''):
     return sub_process.call(["/sbin/shutdown", '-r', when, message],
                             close_fds=True)
예제 #15
0
파일: common.py 프로젝트: scibian/func
def call_iptables(args):
    return sub_process.call(["/sbin/iptables"] + args.split(),
                            executable="/sbin/iptables",
                            shell=False)
예제 #16
0
파일: reboot.py 프로젝트: Lorquas/func
 def reboot(self, when='now', message=''):
     return sub_process.call(["/sbin/shutdown", '-r', when, message], close_fds=True)