diff options
author | James Yang <jjyang@mcs.anl.gov> | 2008-07-15 15:52:08 +0000 |
---|---|---|
committer | James Yang <jjyang@mcs.anl.gov> | 2008-07-15 15:52:08 +0000 |
commit | dd36afc992b78d4b03b8a2c8a0ba50cfbacc5662 (patch) | |
tree | 42bc7a454cbb82330135eec2c3468fd3562b1d4e | |
parent | f4a05ad2a7bc36a8fa2fa88bcd65e733a1b4725f (diff) | |
download | bcfg2-dd36afc992b78d4b03b8a2c8a0ba50cfbacc5662.tar.gz bcfg2-dd36afc992b78d4b03b8a2c8a0ba50cfbacc5662.tar.bz2 bcfg2-dd36afc992b78d4b03b8a2c8a0ba50cfbacc5662.zip |
bcfg2-reports now has the option to read bad entry queries from a file
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4790 ce84e21b-d406-0410-9b95-82705330c041
-rwxr-xr-x | src/sbin/bcfg2-reports | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/sbin/bcfg2-reports b/src/sbin/bcfg2-reports index e8ad20832..98ba85247 100755 --- a/src/sbin/bcfg2-reports +++ b/src/sbin/bcfg2-reports @@ -20,6 +20,7 @@ os.environ['DJANGO_SETTINGS_MODULE'] = '%s.settings' % project_name from Bcfg2.Server.Reports.reports.models import Client from getopt import getopt import datetime +import fileinput def timecompare(client1, client2): '''compares two clients by their timestamps''' @@ -131,7 +132,9 @@ Options and arguments (and corresponding environment variables): the current interaction of NAME -x NAME : toggles expired/unexpired state of NAME --badentry=KIND,NAME : shows only hosts whose current interaction has bad - entries in of KIND kind and NAME name + 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)''' @@ -181,12 +184,23 @@ else: result.append(c_inst) elif badentry != "": - for c_inst in c_list: - baditems = c_inst.current_interaction.bad_items.all() - for item in baditems: - if item.name == badentry[1] and item.kind == badentry[0]: - result.append(c_inst) - break + if len(badentry) == 1: + fileread =fileinput.input(badentry[0]) + for line in fileread: + badentry = line.strip().split(',') + for c_inst in c_list: + baditems = c_inst.current_interaction.bad_items.all() + for item in baditems: + if item.name == badentry[1] and item.kind == badentry[0]: + result.append(c_inst) + break + else: + for c_inst in c_list: + baditems = c_inst.current_interaction.bad_items.all() + for item in baditems: + if item.name == badentry[1] and item.kind == badentry[0]: + result.append(c_inst) + break else: for c_inst in c_list: |