Add 'full' option to fuel_logs
* Print the entire log without any filters Change-Id: I7b6f25044c4f271d679c9f13f8eecda8f7debb9a
This commit is contained in:
parent
7c22dc8fce
commit
1c937ba920
|
@ -94,6 +94,8 @@ class IO(object):
|
||||||
if cls.args.astute:
|
if cls.args.astute:
|
||||||
fuel_snapshot.parse_astute_log(
|
fuel_snapshot.parse_astute_log(
|
||||||
show_mcagent=cls.args.mcagent,
|
show_mcagent=cls.args.mcagent,
|
||||||
|
show_full=cls.args.full,
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.separator()
|
cls.separator()
|
||||||
|
@ -102,6 +104,7 @@ class IO(object):
|
||||||
fuel_snapshot.parse_puppet_logs(
|
fuel_snapshot.parse_puppet_logs(
|
||||||
enable_sort=cls.args.sort,
|
enable_sort=cls.args.sort,
|
||||||
show_evals=cls.args.evals,
|
show_evals=cls.args.evals,
|
||||||
|
show_full=cls.args.full,
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -117,6 +120,7 @@ class IO(object):
|
||||||
else:
|
else:
|
||||||
fuel_logs.parse_astute_logs(
|
fuel_logs.parse_astute_logs(
|
||||||
show_mcagent=cls.args.mcagent,
|
show_mcagent=cls.args.mcagent,
|
||||||
|
show_full=cls.args.full,
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.separator()
|
cls.separator()
|
||||||
|
@ -128,6 +132,7 @@ class IO(object):
|
||||||
fuel_logs.parse_puppet_logs(
|
fuel_logs.parse_puppet_logs(
|
||||||
enable_sort=cls.args.sort,
|
enable_sort=cls.args.sort,
|
||||||
show_evals=cls.args.evals,
|
show_evals=cls.args.evals,
|
||||||
|
show_full=cls.args.full,
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -218,6 +223,10 @@ class IO(object):
|
||||||
action="store_true",
|
action="store_true",
|
||||||
default=False,
|
default=False,
|
||||||
help='Redirect data to the "less" pager')
|
help='Redirect data to the "less" pager')
|
||||||
|
parser.add_argument("--full", "-f",
|
||||||
|
action="store_true",
|
||||||
|
default=False,
|
||||||
|
help='Full output without filters')
|
||||||
parser.add_argument('snapshots',
|
parser.add_argument('snapshots',
|
||||||
metavar='SNAPSHOT',
|
metavar='SNAPSHOT',
|
||||||
type=str,
|
type=str,
|
||||||
|
@ -340,6 +349,7 @@ class AstuteLog(AbstractLog):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.show_mcagent = False
|
self.show_mcagent = False
|
||||||
|
self.show_full = False
|
||||||
super(AstuteLog, self).__init__()
|
super(AstuteLog, self).__init__()
|
||||||
|
|
||||||
def parse(self, content):
|
def parse(self, content):
|
||||||
|
@ -351,6 +361,9 @@ class AstuteLog(AbstractLog):
|
||||||
"""
|
"""
|
||||||
self.content = content.splitlines()
|
self.content = content.splitlines()
|
||||||
for record in self.each_record():
|
for record in self.each_record():
|
||||||
|
if self.show_full:
|
||||||
|
self.add_record(record)
|
||||||
|
else:
|
||||||
self.rpc_call(record)
|
self.rpc_call(record)
|
||||||
self.rpc_cast(record)
|
self.rpc_cast(record)
|
||||||
self.task_status(record)
|
self.task_status(record)
|
||||||
|
@ -463,6 +476,7 @@ class PuppetLog(AbstractLog):
|
||||||
self.log_name = None
|
self.log_name = None
|
||||||
self.show_evals = False
|
self.show_evals = False
|
||||||
self.enable_sort = False
|
self.enable_sort = False
|
||||||
|
self.show_full = False
|
||||||
super(PuppetLog, self).__init__()
|
super(PuppetLog, self).__init__()
|
||||||
|
|
||||||
def parse(self, content):
|
def parse(self, content):
|
||||||
|
@ -474,6 +488,9 @@ class PuppetLog(AbstractLog):
|
||||||
"""
|
"""
|
||||||
self.content = content.splitlines()
|
self.content = content.splitlines()
|
||||||
for record in self.each_record():
|
for record in self.each_record():
|
||||||
|
if self.show_full:
|
||||||
|
self.add_record(record)
|
||||||
|
else:
|
||||||
self.err_line(record)
|
self.err_line(record)
|
||||||
self.catalog_start(record)
|
self.catalog_start(record)
|
||||||
self.catalog_end(record)
|
self.catalog_end(record)
|
||||||
|
@ -684,7 +701,9 @@ class FuelSnapshot(object):
|
||||||
content = log.read()
|
content = log.read()
|
||||||
parser.parse(content)
|
parser.parse(content)
|
||||||
|
|
||||||
def parse_astute_log(self, show_mcagent=False):
|
def parse_astute_log(self,
|
||||||
|
show_mcagent=False,
|
||||||
|
show_full=False):
|
||||||
"""
|
"""
|
||||||
Parse the Astute log from the archive
|
Parse the Astute log from the archive
|
||||||
:param show_mcagent: show or hide MCAgent debug
|
:param show_mcagent: show or hide MCAgent debug
|
||||||
|
@ -693,12 +712,16 @@ class FuelSnapshot(object):
|
||||||
"""
|
"""
|
||||||
astute_logs = AstuteLog()
|
astute_logs = AstuteLog()
|
||||||
astute_logs.show_mcagent = show_mcagent
|
astute_logs.show_mcagent = show_mcagent
|
||||||
|
astute_logs.show_full = show_full
|
||||||
for astute_log in self.astute_logs():
|
for astute_log in self.astute_logs():
|
||||||
self.parse_log(astute_log, astute_logs)
|
self.parse_log(astute_log, astute_logs)
|
||||||
astute_logs.output()
|
astute_logs.output()
|
||||||
astute_logs.clear()
|
astute_logs.clear()
|
||||||
|
|
||||||
def parse_puppet_logs(self, enable_sort=False, show_evals=False):
|
def parse_puppet_logs(self,
|
||||||
|
enable_sort=False,
|
||||||
|
show_evals=False,
|
||||||
|
show_full=False):
|
||||||
"""
|
"""
|
||||||
Parse the Puppet logs found inside the archive
|
Parse the Puppet logs found inside the archive
|
||||||
:param enable_sort: enable sorting of logs by date
|
:param enable_sort: enable sorting of logs by date
|
||||||
|
@ -710,6 +733,7 @@ class FuelSnapshot(object):
|
||||||
puppet_logs = PuppetLog()
|
puppet_logs = PuppetLog()
|
||||||
puppet_logs.show_evals = show_evals
|
puppet_logs.show_evals = show_evals
|
||||||
puppet_logs.enable_sort = enable_sort
|
puppet_logs.enable_sort = enable_sort
|
||||||
|
puppet_logs.show_full = show_full
|
||||||
for puppet_log in self.puppet_logs():
|
for puppet_log in self.puppet_logs():
|
||||||
puppet_logs.log_name = puppet_log.name
|
puppet_logs.log_name = puppet_log.name
|
||||||
self.parse_log(puppet_log, puppet_logs)
|
self.parse_log(puppet_log, puppet_logs)
|
||||||
|
@ -780,7 +804,9 @@ class FuelLogs(object):
|
||||||
content = log_file.read()
|
content = log_file.read()
|
||||||
parser.parse(content)
|
parser.parse(content)
|
||||||
|
|
||||||
def parse_astute_logs(self, show_mcagent=False):
|
def parse_astute_logs(self,
|
||||||
|
show_mcagent=False,
|
||||||
|
show_full=False):
|
||||||
"""
|
"""
|
||||||
Parse Astute log on the Fuel Master system
|
Parse Astute log on the Fuel Master system
|
||||||
:param show_mcagent: show MCAgent call debug
|
:param show_mcagent: show MCAgent call debug
|
||||||
|
@ -789,13 +815,17 @@ class FuelLogs(object):
|
||||||
"""
|
"""
|
||||||
astute_logs = AstuteLog()
|
astute_logs = AstuteLog()
|
||||||
astute_logs.show_mcagent = show_mcagent
|
astute_logs.show_mcagent = show_mcagent
|
||||||
|
astute_logs.show_full = show_full
|
||||||
for astute_log in self.astute_logs():
|
for astute_log in self.astute_logs():
|
||||||
with open(astute_log, 'r') as log:
|
with open(astute_log, 'r') as log:
|
||||||
self.parse_log(log, astute_logs)
|
self.parse_log(log, astute_logs)
|
||||||
astute_logs.output()
|
astute_logs.output()
|
||||||
astute_logs.clear()
|
astute_logs.clear()
|
||||||
|
|
||||||
def parse_puppet_logs(self, enable_sort=False, show_evals=False):
|
def parse_puppet_logs(self,
|
||||||
|
enable_sort=False,
|
||||||
|
show_evals=False,
|
||||||
|
show_full=False):
|
||||||
"""
|
"""
|
||||||
Parse Puppet logs on the Fuel Master system
|
Parse Puppet logs on the Fuel Master system
|
||||||
:param enable_sort: sort log files by date
|
:param enable_sort: sort log files by date
|
||||||
|
@ -807,6 +837,7 @@ class FuelLogs(object):
|
||||||
puppet_logs = PuppetLog()
|
puppet_logs = PuppetLog()
|
||||||
puppet_logs.show_evals = show_evals
|
puppet_logs.show_evals = show_evals
|
||||||
puppet_logs.enable_sort = enable_sort
|
puppet_logs.enable_sort = enable_sort
|
||||||
|
puppet_logs.show_full = show_full
|
||||||
for puppet_log in self.puppet_logs():
|
for puppet_log in self.puppet_logs():
|
||||||
with open(puppet_log, 'r') as log:
|
with open(puppet_log, 'r') as log:
|
||||||
puppet_logs.log_name = puppet_log
|
puppet_logs.log_name = puppet_log
|
||||||
|
|
Loading…
Reference in New Issue