diff options
author | James Yang <jjyang@mcs.anl.gov> | 2008-07-29 16:27:59 +0000 |
---|---|---|
committer | James Yang <jjyang@mcs.anl.gov> | 2008-07-29 16:27:59 +0000 |
commit | d674cf5b4d64de4f8aac82b6ffb1f57c52e0be9f (patch) | |
tree | eb214111e687226deeccafae0ba2890a38cd4e08 /src | |
parent | 71668ac5fd26304a4aa124f182e03187303a0e46 (diff) | |
download | bcfg2-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')
-rw-r--r-- | src/lib/Server/Plugins/Editor.py | 6 | ||||
-rwxr-xr-x | src/sbin/bcfg2-reports | 34 |
2 files changed, 39 insertions, 1 deletions
diff --git a/src/lib/Server/Plugins/Editor.py b/src/lib/Server/Plugins/Editor.py index b19df2bce..f638e1496 100644 --- a/src/lib/Server/Plugins/Editor.py +++ b/src/lib/Server/Plugins/Editor.py @@ -35,6 +35,12 @@ class EditEntrySet(Bcfg2.Server.Plugin.EntrySet): entry.text = self.entries['edits'].ProcessDirectives(self.get_client_data(client)) if not entry.text: entry.set('empty', 'true') + try: + f = open(self.path + filename + '.H_' + client, 'w') + f.write(entry.text) + f.close() + except: + pass def get_client_data(self, client): return self.inputs[client] 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: |