From 5ab6c7a56e1cb16fee6b04a2b74e615f8f4c557e Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Sun, 21 Dec 2008 22:52:34 +0000 Subject: Add option to view stale hosts in bcfg2-reports git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4998 ce84e21b-d406-0410-9b95-82705330c041 --- src/sbin/bcfg2-reports | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/sbin/bcfg2-reports b/src/sbin/bcfg2-reports index af3cf96fb..16b9cd11e 100755 --- a/src/sbin/bcfg2-reports +++ b/src/sbin/bcfg2-reports @@ -112,7 +112,7 @@ entrydict = dict() args = sys.argv[1:] opts, pargs = getopt(args, 'ab:cde:hs:x:', - ['sort=', 'fields=', 'badentry=', 'extraentry=']) + ['stale', 'sort=', 'fields=', 'badentry=', 'extraentry=']) for option in opts: if len(option) > 0: @@ -141,7 +141,8 @@ if expire != "": c_inst.save() elif '-h' in args: - print '''usage: python bcfg2-reports [option] ... + print """Usage: python bcfg2-reports [option] ... + Options and arguments (and corresponding environment variables): -a : shows all hosts, including expired hosts -b NAME : single-host mode - shows bad entries from the @@ -164,7 +165,9 @@ Options and arguments (and corresponding environment variables): 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)''' +--sort=ARG1,ARG2,... : sorts output on ARG1,ARG2,... (name,time,state) +--stale : shows hosts which haven't run in the last 24 hours +""" elif singlehost != "": for c_inst in c_list: if singlehost == c_inst.name: @@ -202,12 +205,18 @@ else: if extraentry != "": extraentry = extraentry.split(',') - - if '-c' in args: + + # stale hosts + if '--stale' in args: + for c_inst in c_list: + if c_inst.current_interaction.isstale(): + result.append(c_inst) + # clean hosts + elif '-c' in args: for c_inst in c_list: if c_inst.current_interaction.isclean(): result.append(c_inst) - + # dirty hosts elif '-d' in args: for c_inst in c_list: if not c_inst.current_interaction.isclean(): -- cgit v1.2.3-1-g7c22