def rmdirs(path): if os.path.isdir(path): if len(path) < 20 and 'home' in path: LOG.error('Refusing to rm {!r} since it might be your homedir.'.format(path)) return cmd = 'rm -rf {}'.format(path) system(cmd)
def rmdirs(path): if os.path.isdir(path): if len(path) < 20 and 'home' in path: LOG.error( 'Refusing to rm {!r} since it might be your homedir.'.format( path)) return cmd = 'rm -rf {}'.format(path) system(cmd)
def system(self, cmd, ignore_error=False, frame=None): """ A convinience method for calling io.system(). Shell out to the given command and wait for it to finish. @see: L{io.system} @type cmd: list<str> @param cmd: The command to execute. @type ignore_error: boolean @param ignore_error: Ignore any L{OSError} or shell command failures. """ io.system(cmd, ignore_error, frame)
def main(argv): bind9.install() answer = False print "Run apt-get update? (y/N):" ans = sys.stdin.readline() if ans.startswith("y"): io.system("apt-get update") print "Run apt-get upgrade? (y/N):" ans = sys.stdin.readline() if ans.startswith("y"): io.system("apt-get upgrade -y") print "Install and configure bind9? (y/N):" ans = sys.stdin.readline() if ans.startswith("y"): bind9.install()
def run(script_fn): cwd, basename = os.path.split(script_fn) with cd(cwd): system('/bin/bash {}'.format(basename))
def system(self, cmd): system(cmd)