Exemplo n.º 1
0
def __off(service):
	if __isOn(service):
		with hide('everything'):
			execute('chkconfig %s off' % service)
		done("echo 'turn off        : %s'" % service)
	else:
		already("echo 'already off     : %s'" % service)
Exemplo n.º 2
0
def __stop(service):
	if __isRunning(service):
		with hide('everything'):
			execute('service %s stop' % service)
		done("echo 'stopped         : %s'" % service)
	else:
		already("echo 'already stopped : %s'" % service)
Exemplo n.º 3
0
def __addRepository(name, url):
	package = __repository(name)

	if __doesNotHasRepository(package):
		with hide('everything'):
			execute('rpm -iv %s' % url)
		done("echo 'install complete  : %s'" % __repository(name))
	else:
		already("echo 'already installed : %s'" % package)
Exemplo n.º 4
0
def __addRepository(name, url):
    package = __repository(name)

    if __doesNotHasRepository(package):
        with hide('everything'):
            execute('rpm -iv %s' % url)
        done("echo 'install complete  : %s'" % __repository(name))
    else:
        already("echo 'already installed : %s'" % package)
Exemplo n.º 5
0
def __on(service):
	if __isOn(service):
		already("echo 'already on      : %s'" % service)
	else:
		with hide('everything'):
			stdout = execute('chkconfig %s on; true' % service)
			if 'No such file or directory' in stdout:
				error("echo 'turn on error   : %s is unrecognized'" % service)
			else:
				done("echo 'turn on         : %s'" % service)
Exemplo n.º 6
0
def __start(service):
	if __isRunning(service):
		already("echo 'already started : %s'" % service)
	else:
		with hide('everything'):
			stdout = execute('service %s start; true' % service)
			if 'unrecognized' in stdout:
				error("echo 'start error     : %s is unrecognized'" % service)
			else:
				done("echo 'started         : %s'" % service)
Exemplo n.º 7
0
def __install(package, repositories):
	if __isNotInstalled(package):
		with hide('stdout'):
			stdout = execute('yum install -y %s%s; true' % (__enablerepos(repositories), package))
			if 'Error: Nothing to do' in stdout:
				error("echo 'install error     : No package %s available.'" % package)
			else:
				done("echo 'install complete  : %s'" % __version(package))
	else:
		already("echo 'already installed : %s'" % __version(package))
Exemplo n.º 8
0
def generate():
    from result import done, already

    dst = '%s/my_configure.py' % os.getcwd()
    src = os.path.join(os.path.dirname(__file__), 'default_configure.py')

    if os.path.exists(dst):
        already('echo already exists  : %s' % dst)
    else:
        with hide('everything'):
            local('cp %s %s' % (src, dst))
        done('echo cteate complete : %s' % dst)
Exemplo n.º 9
0
def generate():
	from result import done, already

	dst = '%s/my_configure.py' % os.getcwd()
	src = os.path.join(os.path.dirname(__file__), 'default_configure.py')

	if os.path.exists(dst):
		already('echo already exists  : %s' % dst)
	else:
		with hide('everything'):
			local('cp %s %s' % (src, dst))
		done('echo cteate complete : %s' % dst)
Exemplo n.º 10
0
def __install(package, repositories):
    if __isNotInstalled(package):
        with hide('stdout'):
            stdout = execute('yum install -y %s%s; true' %
                             (__enablerepos(repositories), package))
            if 'Error: Nothing to do' in stdout:
                error("echo 'install error     : No package %s available.'" %
                      package)
            else:
                done("echo 'install complete  : %s'" % __version(package))
    else:
        already("echo 'already installed : %s'" % __version(package))
Exemplo n.º 11
0
def __backup(path):
	if __hasNoBackup(path):
		if not isExists(path):
			error('echo not exists : %s' % path)
			return False
		else:
			with hide('everything'):
				execute('cp -p %s %s.origin' % (path, path))
			done('echo create backup : %s.origin' % path)
			return True
	else:
		already('echo already exists : %s' % path)
		return True
Exemplo n.º 12
0
def __backup(path):
    if __hasNoBackup(path):
        if not isExists(path):
            error('echo not exists : %s' % path)
            return False
        else:
            with hide('everything'):
                execute('cp -p %s %s.origin' % (path, path))
            done('echo create backup : %s.origin' % path)
            return True
    else:
        already('echo already exists : %s' % path)
        return True