added the --show-hosts option for the distcc module
git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@198 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
@@ -80,6 +80,7 @@ def print_help():
|
||||
entropyTools.print_info(" \t\t "+entropyTools.red("--remove-host")+"\t\t remove a hostname/ip")
|
||||
entropyTools.print_info(" \t\t "+entropyTools.red("--enable")+"\t\t enable the DistCC funcionality")
|
||||
entropyTools.print_info(" \t\t "+entropyTools.red("--disable")+"\t\t disable the DistCC funcionality")
|
||||
entropyTools.print_info(" \t\t "+entropyTools.red("--show-hosts")+"\t\t show the currently enabled hosts")
|
||||
entropyTools.print_info(" \t"+entropyTools.green(entropyTools.bold("cleanup"))+entropyTools.yellow("\t\t to clean temporary files"))
|
||||
|
||||
options = sys.argv[1:]
|
||||
|
||||
@@ -1262,6 +1262,12 @@ def removeDistCCHosts(hosts):
|
||||
def getDistCCStatus():
|
||||
return etpConst['distcc-status']
|
||||
|
||||
def isIPAvailable(ip):
|
||||
rc = os.system("ping -c 1 "+ip+" &> /dev/null")
|
||||
if (rc):
|
||||
return False
|
||||
return True
|
||||
|
||||
def getFileUnixMtime(path):
|
||||
return os.path.getmtime(path)
|
||||
|
||||
|
||||
@@ -936,6 +936,7 @@ def distcc(options):
|
||||
addDistCCHosts(myhosts)
|
||||
myhosts = string.join(myhosts," ")
|
||||
print_info(green(" * ")+red("Hosts: ")+blue(myhosts)+red(" added."))
|
||||
|
||||
elif (options[0] == "--remove-host"):
|
||||
if (not getDistCCStatus()):
|
||||
print_warning(yellow(" * ")+red("Attention: distcc is not enabled."))
|
||||
@@ -948,3 +949,18 @@ def distcc(options):
|
||||
myhosts = string.join(myhosts," ")
|
||||
print_info(green(" * ")+red("Hosts: ")+blue(myhosts)+red(" removed."))
|
||||
|
||||
elif (options[0] == "--show-hosts"):
|
||||
if (not getDistCCStatus()):
|
||||
print_warning(yellow(" * ")+red("Attention: distcc is not enabled."))
|
||||
hosts = getDistCCHosts()
|
||||
if len(hosts) == 0:
|
||||
print_warning(yellow(" * ")+red("Attention: no hosts selected."))
|
||||
sys.exit(205)
|
||||
print_info(green(" * ")+red("Showing DistCC hosts table:"))
|
||||
for host in hosts:
|
||||
availability = isIPAvailable(host)
|
||||
if (availability):
|
||||
availability = green("running")
|
||||
else:
|
||||
availability = green("not running")
|
||||
print_info(green(" * ")+yellow("\tHost:\t")+blue(host)+red(" :: ")+availability)
|
||||
Reference in New Issue
Block a user