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 --no-warn-on-updates option #408

Open
wants to merge 2 commits 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
26 changes: 23 additions & 3 deletions check_yum.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def __init__(self):
self.all_updates = False
self.no_cache_update = False
self.no_warn_on_lock = False
self.no_warn_on_updates = False
self.enable_repo = ""
self.disable_repo = ""
self.disable_plugin = ""
Expand Down Expand Up @@ -570,7 +571,10 @@ def test_all_updates(self):
status = OK
message = "0 Updates Available"
else:
status = CRITICAL
if self.no_warn_on_updates:
status = OK
else:
status = CRITICAL
if num_updates == 1:
message = "1 Update Available"
else:
Expand All @@ -594,7 +598,10 @@ def test_security_updates(self):
status = OK
message = "0 Security Updates Available"
else:
status = CRITICAL
if self.no_warn_on_updates:
status = OK
else:
status = CRITICAL
if num_security_updates == 1:
message = "1 Security Update Available"
elif num_security_updates > 1:
Expand All @@ -603,7 +610,10 @@ def test_security_updates(self):

if num_other_updates != 0:
if self.warn_on_any_update and status != CRITICAL:
status = WARNING
if self.no_warn_on_updates:
status = OK
else:
status = WARNING
if num_other_updates == 1:
message += ". 1 Non-Security Update Available"
else:
Expand Down Expand Up @@ -684,6 +694,15 @@ def main():
+ "intermittently pop up when someone is running " \
+ "yum for package management")

parser.add_option("--no-warn-on-updates",
action="store_true",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

continuation line under-indented for visual indent
indentation contains mixed spaces and tabs
indentation contains tabs

dest="no_warn_on_updates",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

continuation line under-indented for visual indent
indentation contains mixed spaces and tabs
indentation contains tabs

help="Return OK instead of WARNING even when updates are" \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation contains mixed spaces and tabs
line too long (81 > 79 characters)
the backslash is redundant between brackets

+ "available. This is not recommended from the security" \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

continuation line under-indented for visual indent
indentation contains mixed spaces and tabs
indentation contains tabs
the backslash is redundant between brackets

+ "standpoint, but may be wanted to disable alerts while" \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

continuation line under-indented for visual indent
indentation contains mixed spaces and tabs
indentation contains tabs
the backslash is redundant between brackets

+ "the plugin output still shows the number of available" \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

continuation line under-indented for visual indent
indentation contains mixed spaces and tabs
indentation contains tabs
the backslash is redundant between brackets

+ "updates.")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

continuation line under-indented for visual indent
indentation contains mixed spaces and tabs
indentation contains tabs


parser.add_option("-e",
"--enablerepo",
dest="repository_to_enable",
Expand Down Expand Up @@ -738,6 +757,7 @@ def main():
tester.all_updates = options.all_updates
tester.no_cache_update = options.no_cache_update
tester.no_warn_on_lock = options.no_warn_on_lock
tester.no_warn_on_updates = options.no_warn_on_updates
tester.enable_repo = options.repository_to_enable
tester.disable_repo = options.repository_to_disable
tester.disable_plugin = options.plugin_to_disable
Expand Down