Skip to content

Commit

Permalink
Add --state-check flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Zürker Aguilar, Fabian committed Nov 13, 2023
1 parent e6c76bb commit 3474b25
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions check_katello_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@ def check_product(product):
:param product: Product dictionary
:type product: dict
"""
if options.state_check:
sync_state = product.get("sync_state")
if not sync_state or "complete" not in sync_state.lower():
LOGGER.debug("Product '%s' (%s) has unsynced state!",
product["label"], (product["description"] or '')
)
PROD_CRIT.append(product["label"])
set_code(2)
return

# check if product unsynced
if product["last_sync"] is None:
LOGGER.debug(
Expand Down Expand Up @@ -332,6 +342,10 @@ def parse_options(args=None):
prod_opts.add_argument("-c", "--outdated-critical", dest="outdated_crit", \
default=5, metavar="DAYS", type=int, help="defines outdated products" \
" critical threshold in days (default: 5)")
# --state-check
prod_opts.add_argument("--state-check", dest="state_check", \
default=False, action="store_true", \
help="Check for unsynced status using sync_state field")

# PRODUCT FILTER ARGUMENTS
# -o / --organization
Expand Down

0 comments on commit 3474b25

Please sign in to comment.