summaryrefslogtreecommitdiffstats
path: root/tools/hostinfo.py
diff options
context:
space:
mode:
authorKen Raffenetti <raffenet@mcs.anl.gov>2006-10-10 15:06:52 +0000
committerKen Raffenetti <raffenet@mcs.anl.gov>2006-10-10 15:06:52 +0000
commit63c1fd4b9076538d77137e159a4c07460dd635e2 (patch)
treea5283e497e5f12370bc08d5578d7a0f3a262670d /tools/hostinfo.py
parent9c4c7093ffabcfc0f41c5da6f1d68ef134d5f747 (diff)
downloadbcfg2-63c1fd4b9076538d77137e159a4c07460dd635e2.tar.gz
bcfg2-63c1fd4b9076538d77137e159a4c07460dd635e2.tar.bz2
bcfg2-63c1fd4b9076538d77137e159a4c07460dd635e2.zip
added batch add script
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2424 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'tools/hostinfo.py')
-rwxr-xr-xtools/hostinfo.py43
1 files changed, 21 insertions, 22 deletions
diff --git a/tools/hostinfo.py b/tools/hostinfo.py
index d960354d9..3418f0c76 100755
--- a/tools/hostinfo.py
+++ b/tools/hostinfo.py
@@ -7,7 +7,6 @@ from django.db import connection
from os import system
import sys
-xmldirectory = "./xmldata/"
logic_ops = ["and", "or"]
host_attribs = ["hostname", "whatami", "netgroup", "security_class",
"support", "csi", "memory", "printq", "dhcp", "outbound_smtp",
@@ -102,13 +101,13 @@ try:
queryoptions += result[0]
if ('--summary', '') in opts:
fields = "h.hostname, h.whatami, h.location, h.primary_user"
- query = """SELECT DISTINCT %s FROM (((((dbconvert_host h
- INNER JOIN dbconvert_interface i ON h.id = i.host_id)
- INNER JOIN dbconvert_ip p ON i.id = p.interface_id)
- INNER JOIN dbconvert_name n ON p.id = n.ip_id)
- INNER JOIN dbconvert_name_mxs x ON x.name_id = n.id)
- INNER JOIN dbconvert_mx m ON m.id = x.mx_id)
- LEFT JOIN dbconvert_cname c ON n.id = c.name_id
+ query = """SELECT DISTINCT %s FROM (((((hostbase_host h
+ INNER JOIN hostbase_interface i ON h.id = i.host_id)
+ INNER JOIN hostbase_ip p ON i.id = p.interface_id)
+ INNER JOIN hostbase_name n ON p.id = n.ip_id)
+ INNER JOIN hostbase_name_mxs x ON x.name_id = n.id)
+ INNER JOIN hostbase_mx m ON m.id = x.mx_id)
+ LEFT JOIN hostbase_cname c ON n.id = c.name_id
WHERE %s ORDER BY h.hostname
""" % (fields, queryoptions)
cursor.execute(query)
@@ -128,13 +127,13 @@ try:
if not fields:
print "No valid fields were entered. exiting..."
sys.exit()
- query = """SELECT DISTINCT %s FROM (((((dbconvert_host h
- INNER JOIN dbconvert_interface i ON h.id = i.host_id)
- INNER JOIN dbconvert_ip p ON i.id = p.interface_id)
- INNER JOIN dbconvert_name n ON p.id = n.ip_id)
- INNER JOIN dbconvert_name_mxs x ON x.name_id = n.id)
- INNER JOIN dbconvert_mx m ON m.id = x.mx_id)
- LEFT JOIN dbconvert_cname c ON n.id = c.name_id
+ query = """SELECT DISTINCT %s FROM (((((hostbase_host h
+ INNER JOIN hostbase_interface i ON h.id = i.host_id)
+ INNER JOIN hostbase_ip p ON i.id = p.interface_id)
+ INNER JOIN hostbase_name n ON p.id = n.ip_id)
+ INNER JOIN hostbase_name_mxs x ON x.name_id = n.id)
+ INNER JOIN hostbase_mx m ON m.id = x.mx_id)
+ LEFT JOIN hostbase_cname c ON n.id = c.name_id
WHERE %s ORDER BY h.hostname
""" % (fields, queryoptions)
@@ -152,13 +151,13 @@ try:
last = host
print ''
else:
- basequery = """SELECT DISTINCT h.hostname FROM (((((dbconvert_host h
- INNER JOIN dbconvert_interface i ON h.id = i.host_id)
- INNER JOIN dbconvert_ip p ON i.id = p.interface_id)
- INNER JOIN dbconvert_name n ON p.id = n.ip_id)
- INNER JOIN dbconvert_name_mxs x ON x.name_id = n.id)
- INNER JOIN dbconvert_mx m ON m.id = x.mx_id)
- LEFT JOIN dbconvert_cname c ON n.id = c.name_id
+ basequery = """SELECT DISTINCT h.hostname FROM (((((hostbase_host h
+ INNER JOIN hostbase_interface i ON h.id = i.host_id)
+ INNER JOIN hostbase_ip p ON i.id = p.interface_id)
+ INNER JOIN hostbase_name n ON p.id = n.ip_id)
+ INNER JOIN hostbase_name_mxs x ON x.name_id = n.id)
+ INNER JOIN hostbase_mx m ON m.id = x.mx_id)
+ LEFT JOIN hostbase_cname c ON n.id = c.name_id
WHERE
"""
cursor.execute(basequery + queryoptions + " ORDER BY h.hostname")