deal with inactive apps as well

This commit is contained in:
kjeld Schouten-Lebbing 2022-01-19 20:41:43 +01:00
parent 75c6fe0199
commit 6c07e75459
No known key found for this signature in database
GPG Key ID: 4CDAD4A532BC1EDB

View File

@ -51,10 +51,16 @@ def check_semver(current: str, latest: str):
def execute_upgrades():
if ACTIVE:
if CATALOG == "ALL":
filtered = filter(lambda a: a.update_available and a.status == "active", INSTALLED_CHARTS)
else:
filtered = filter(lambda a: a.update_available and a.status == "active" and a.catalog == CATALOG, INSTALLED_CHARTS)
else:
if CATALOG == "ALL":
filtered = filter(lambda a: a.update_available, INSTALLED_CHARTS)
else:
filtered = filter(lambda a: a.update_available and a.catalog == CATALOG, INSTALLED_CHARTS)
for chart in filtered:
pre_update_ver = chart.human_version
post_update_ver = chart.human_latest_version
@ -82,11 +88,13 @@ def process_args():
global VERSIONING
global SYNC
global PRUNE
global ACTIVE
parser = argparse.ArgumentParser(description='Update TrueNAS SCALE Apps')
parser.add_argument('--catalog', nargs='?', default='ALL', help='name of the catalog you want to process in caps. Or "ALL" to render all catalogs.')
parser.add_argument('--versioning', nargs='?', default='minor', help='Name of the versioning scheme you want to update. Options: major, minor or patch. Defaults to minor')
parser.add_argument('-s', '--sync', action="store_true", help='sync catalogs before trying to update')
parser.add_argument('-p', '--prune', action="store_true", help='prune old docker images after update')
parser.add_argument('-a', '--active', action="store_true", help='update "active" apps only and ignore "stopped" or "stuck" apps')
args = parser.parse_args()
CATALOG = args.catalog
VERSIONING = args.versioning
@ -98,6 +106,10 @@ def process_args():
PRUNE = True
else:
PRUNE = False
if args.active:
ACTIVE = True
else:
ACTIVE = False
def sync_catalog():
if SYNC: