Skip to content

Commit 9a35218

Browse files
authored
Merge pull request #411 from SUSE/drop_list_clusters
Remove unused cleanup flow
2 parents eee9ee0 + d346477 commit 9a35218

File tree

3 files changed

+1
-27
lines changed

3 files changed

+1
-27
lines changed

ocw/lib/cleanup.py

+1-15
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
from ocw.lib.azure import Azure
55
from ocw.lib.ec2 import EC2
66
from ocw.lib.gce import GCE
7-
from ocw.lib.eks import EKS
8-
from ocw.lib.emailnotify import send_mail, send_cluster_notification
7+
from ocw.lib.emailnotify import send_mail
98
from ocw.enums import ProviderChoice
109

1110
logger = logging.getLogger(__name__)
@@ -28,16 +27,3 @@ def cleanup_run():
2827
except Exception as ex:
2928
logger.exception("[%s] Cleanup failed!", namespace)
3029
send_mail(f'{type(ex).__name__} on Cleanup in [{namespace}]', traceback.format_exc())
31-
32-
33-
def list_clusters():
34-
for namespace in PCWConfig.get_namespaces_for('clusters'):
35-
try:
36-
clusters = EKS(namespace).all_clusters()
37-
quantity = sum(len(clusters[c1]) for c1 in clusters)
38-
logger.info("%d cluster(s) found", quantity)
39-
if quantity > 0:
40-
send_cluster_notification(namespace, clusters)
41-
except Exception as ex:
42-
logger.exception("[%s] List clusters failed!", namespace)
43-
send_mail(f'{type(ex).__name__} on List clusters in [{namespace}]', traceback.format_exc())

ocw/lib/emailnotify.py

-11
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,6 @@ def draw_instance_table(objects):
2929
return table.draw()
3030

3131

32-
def send_cluster_notification(namespace, clusters):
33-
if len(clusters) and PCWConfig.has('notify'):
34-
clusters_str = ''
35-
for region in clusters:
36-
clusters_list = ' '.join([str(cluster) for cluster in clusters[region]])
37-
clusters_str = f'{clusters_str}\n{region} : {clusters_list}'
38-
logger.debug("Full clusters list - %s", clusters_str)
39-
send_mail(f"[{namespace}] EC2 clusters found", clusters_str,
40-
receiver_email=PCWConfig.get_feature_property('notify', 'to', namespace))
41-
42-
4332
def send_mail(subject, message, receiver_email=None):
4433
if PCWConfig.has('notify'):
4534
smtp_server = PCWConfig.get_feature_property('notify', 'smtp')

webui/PCWConfig.py

-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ def get_feature_property(feature: str, feature_property: str, namespace: str | N
6464
'updaterun/default_ttl': {'default': 44400, 'return_type': int},
6565
'notify/to': {'default': None, 'return_type': str},
6666
'notify/age-hours': {'default': 12, 'return_type': int},
67-
'cluster.notify/to': {'default': None, 'return_type': str},
6867
'notify/smtp': {'default': None, 'return_type': str},
6968
'notify/smtp-port': {'default': 25, 'return_type': int},
7069
'notify/from': {'default': '[email protected]', 'return_type': str},

0 commit comments

Comments
 (0)