summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/Server/Plugins/Editor.py6
-rwxr-xr-xsrc/sbin/bcfg2-reports34
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: