summaryrefslogtreecommitdiffstats
path: root/src/sbin/bcfg2-reports
diff options
context:
space:
mode:
authorJames Yang <jjyang@mcs.anl.gov>2008-07-29 16:27:59 +0000
committerJames Yang <jjyang@mcs.anl.gov>2008-07-29 16:27:59 +0000
commitd674cf5b4d64de4f8aac82b6ffb1f57c52e0be9f (patch)
treeeb214111e687226deeccafae0ba2890a38cd4e08 /src/sbin/bcfg2-reports
parent71668ac5fd26304a4aa124f182e03187303a0e46 (diff)
downloadbcfg2-d674cf5b4d64de4f8aac82b6ffb1f57c52e0be9f.tar.gz
bcfg2-d674cf5b4d64de4f8aac82b6ffb1f57c52e0be9f.tar.bz2
bcfg2-d674cf5b4d64de4f8aac82b6ffb1f57c52e0be9f.zip
added extra entry options for bcfg2-reports
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4836 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/sbin/bcfg2-reports')
-rwxr-xr-xsrc/sbin/bcfg2-reports34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/sbin/bcfg2-reports b/src/sbin/bcfg2-reports
index 67de76e7f..bbaf9a723 100755
--- a/src/sbin/bcfg2-reports
+++ b/src/sbin/bcfg2-reports
@@ -96,6 +96,7 @@ def print_entry(item, max_name):
fields = ""
sort = ""
badentry = ""
+extraentry = ""
expire = ""
singlehost = ""
@@ -105,7 +106,7 @@ result = list()
entrydict = dict()
args = sys.argv[1:]
-opts, pargs = getopt(args, 'abcdehs:x:', ['sort=', 'fields=', 'badentry='])
+opts, pargs = getopt(args, 'abcdehs:x:', ['sort=', 'fields=', 'badentry=','extraentry='])
for option in opts:
if len(option) > 0:
@@ -115,6 +116,8 @@ for option in opts:
sort = option[1]
if option[0] == '--badentry':
badentry = option[1]
+ if option[0] == '--extraentry':
+ extraentry = option[1]
if option[0] == '-x':
expire = option[1]
if option[0] == '-s':
@@ -149,6 +152,10 @@ Options and arguments (and corresponding environment variables):
entries in of KIND kind and NAME name; if a single
argument ARG1 is given, then KIND,NAME pairs will be
read from a file of name ARG1
+--extraentry=KIND,NAME : shows only hosts whose current interaction has extra
+ entries in of KIND kind and NAME name; if a single
+ argument ARG1 is given, then KIND,NAME pairs will be
+ read from a file of name ARG1
--fields=ARG1,ARG2,... : only displays the fields ARG1,ARG2,...
(name,time,state)
--sort=ARG1,ARG2,... : sorts output on ARG1,ARG2,... (name,time,state)'''
@@ -187,6 +194,9 @@ else:
if badentry != "":
badentry = badentry.split(',')
+ if extraentry != "":
+ extraentry = extraentry.split(',')
+
if '-c' in args:
for c_inst in c_list:
if c_inst.current_interaction.isclean():
@@ -219,6 +229,28 @@ else:
if item.name == badentry[1] and item.kind == badentry[0]:
result.append(c_inst)
break
+ elif extraentry != "":
+ if len(extraentry) == 1:
+ fileread =fileinput.input(extraentry[0])
+ for line in fileread:
+ extraentry = line.strip().split(',')
+ for c_inst in c_list:
+ extraitems = c_inst.current_interaction.extra_items.all()
+ for item in extraitems:
+ if item.name == extraentry[1] and item.kind == extraentry[0]:
+ result.append(c_inst)
+ if entrydict.has_key(c_inst):
+ entrydict.get(c_inst).append(extraentry[1])
+ else:
+ entrydict[c_inst] = [extraentry[1]]
+ break
+ else:
+ for c_inst in c_list:
+ extraitems = c_inst.current_interaction.extra_items.all()
+ for item in extraitems:
+ if item.name == extraentry[1] and item.kind == extraentry[0]:
+ result.append(c_inst)
+ break
else:
for c_inst in c_list: