Skip to content

Commit

Permalink
Remove learning center cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cdelashmutt-pivotal committed Apr 8, 2024
1 parent 9d81ddd commit 4d91f54
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 31 deletions.
44 changes: 22 additions & 22 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
attrs==21.4.0
cachetools==5.2.0
certifi==2021.10.8
charset-normalizer==2.0.11
google-auth==2.7.0
idna==3.3
iniconfig==1.1.1
kubernetes==23.6.0
oauthlib==3.2.0
packaging==21.3
pluggy==1.0.0
attrs==23.2.0
cachetools==5.3.3
certifi==2024.2.2
charset-normalizer==3.3.2
google-auth==2.28.2
idna==3.6
iniconfig==2.0.0
kubernetes==29.0.0
oauthlib==3.2.2
packaging==24.0
pluggy==1.4.0
py==1.11.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pyparsing==3.0.9
pytest==7.1.2
python-dateutil==2.8.2
PyYAML==6.0
requests==2.27.1
requests-oauthlib==1.3.1
rsa==4.8
pyasn1==0.5.1
pyasn1-modules==0.3.0
pyparsing==3.1.2
pytest==8.1.1
python-dateutil==2.9.0.post0
PyYAML==6.0.1
requests==2.31.0
requests-oauthlib==1.4.0
rsa==4.9
six==1.16.0
tomli==2.0.1
urllib3==1.26.8
websocket-client==1.3.2
urllib3==2.2.1
websocket-client==1.7.0
20 changes: 11 additions & 9 deletions trainingportal_janitor/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,7 @@ def main(args=None):
api_client.ApiClient(configuration=get_in_cluster_with_fallback())
)

trainingportal_api = client.resources.get(
api_version="learningcenter.tanzu.vmware.com/v1beta1", kind="TrainingPortal"
)

logger.debug("Listing training portals")
trainingportals = trainingportal_api.get()
for trainingportal in trainingportals.items:
counter.update(handle_trainingportal_expiry(trainingportal_api,
trainingportal, args.dry_run))
sweep_objects(client, "training.educates.dev/v1beta1", counter, args.dry_run)

stats = ", ".join([f"{k}={v}" for k, v in counter.items()])
logger.info(f"Clean up run completed: {stats}")
Expand All @@ -57,6 +49,16 @@ def main(args=None):
with handler.safe_exit():
time.sleep(args.interval)

def sweep_objects(client, tp_api_version, counter, dry_run):
trainingportal_api = client.resources.get(
api_version=tp_api_version, kind="TrainingPortal"
)

logger.debug("Listing %s training portals" %(tp_api_version))
trainingportals = trainingportal_api.get()
for trainingportal in trainingportals.items:
counter.update(handle_trainingportal_expiry(trainingportal_api,
trainingportal, dry_run))

def get_in_cluster_with_fallback():
config_obj = None
Expand Down

0 comments on commit 4d91f54

Please sign in to comment.