Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a -P argument, to look for updates when processing pending reports #128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions sbin/patchman
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,13 @@ def dns_checks(host=None):
host.check_rdns()


def process_reports(host=None, force=False):
def process_reports(host=None, force=False, updates=False):
""" Process all pending reports, specify host to process only a single host
The --force option forces even processed reports to be reprocessed
No reports are skipped in case some reports contain repo information
and others only contain package information.
The updates argument is passed to find_updates, to cause the report processing
to find all updates for the host.
"""
reports = []
if host:
Expand All @@ -429,7 +431,7 @@ def process_reports(host=None, force=False):
info_message.send(sender=None, text=text)

for report in reports:
report.process(find_updates=False)
report.process(find_updates=updates)


def clean_updates():
Expand Down Expand Up @@ -504,6 +506,9 @@ def collect_args():
parser.add_argument(
'-p', '--process-reports', action='store_true',
help='Process pending Reports')
parser.add_argument(
'-P', '--process-reports-updates', action='store_true',
help='Process pending Reports and find updates for hosts with reports')
parser.add_argument(
'-c', '--clean-reports', action='store_true',
help='Remove all but the last three Reports')
Expand Down Expand Up @@ -554,7 +559,10 @@ def process_args(args):
clean_reports(args.host)
showhelp = False
if args.process_reports:
process_reports(args.host, args.force)
process_reports(args.host, args.force, False)
showhelp = False
if args.process_reports_updates:
process_reports(args.host, args.force, True)
showhelp = False
if args.dbcheck:
dbcheck()
Expand Down