From 871d813e8a7df8c1ea9596ff95771a1f61bee779 Mon Sep 17 00:00:00 2001 From: Chamila de Alwis Date: Mon, 2 Mar 2015 14:54:23 +0530 Subject: [PATCH] PCA - Fixed InstanceCleanupClusterEvent event serialization issue [STRATOS-1222] --- .../modules/event/application/signup/events.py | 18 +++++++++--------- .../modules/event/instance/notifier/events.py | 4 ++-- .../modules/event/topology/events.py | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/application/signup/events.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/application/signup/events.py index ad38227245..f44dd04f1a 100644 --- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/application/signup/events.py +++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/application/signup/events.py @@ -31,13 +31,13 @@ def __init__(self): @staticmethod def create_from_json(json_str): json_obj = json.loads(json_str) - applicationSignUp = ApplicationSignUpAddedEvent() + app_signup_added = ApplicationSignUpAddedEvent() - applicationSignUp.applicationId = json_obj["applicationId"] if "applicationId" in json_obj else None - applicationSignUp.tenantId = json_obj["tenantId"] if "tenantId" in json_obj else None - applicationSignUp.clusterIds = json_obj["clusterIds"] if "clusterIds" in json_obj else None + app_signup_added.applicationId = json_obj["applicationId"] if "applicationId" in json_obj else None + app_signup_added.tenantId = json_obj["tenantId"] if "tenantId" in json_obj else None + app_signup_added.clusterIds = json_obj["clusterIds"] if "clusterIds" in json_obj else None - return applicationSignUp + return app_signup_added class ApplicationSignUpRemovedEvent: @@ -53,10 +53,10 @@ def __init__(self): @staticmethod def create_from_json(json_str): json_obj = json.loads(json_str) - applicationSignUp = ApplicationSignUpRemovedEvent() + app_signup_removed = ApplicationSignUpRemovedEvent() - applicationSignUp.applicationId = json_obj["applicationId"] if "applicationId" in json_obj else None - applicationSignUp.tenantId = json_obj["tenantId"] if "tenantId" in json_obj else None + app_signup_removed.applicationId = json_obj["applicationId"] if "applicationId" in json_obj else None + app_signup_removed.tenantId = json_obj["tenantId"] if "tenantId" in json_obj else None - return applicationSignUp + return app_signup_removed diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/instance/notifier/events.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/instance/notifier/events.py index 8456854c58..800db98e90 100644 --- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/instance/notifier/events.py +++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/instance/notifier/events.py @@ -34,7 +34,7 @@ def __init__(self): """ :type : int """ self.commit_enabled = None """ :type : bool """ - self.instance_id=None + self.instance_id = None """ :type : str """ @staticmethod @@ -64,7 +64,7 @@ def __init__(self, cluster_id, cluster_instance_id): def create_from_json(json_str): json_obj = json.loads(json_str) cluster_id = json_obj["clusterId"] if "clusterId" in json_obj else None - instance_cluster_id = json_obj["instanceClusterId"] if "clusterId" in json_obj else None + instance_cluster_id = json_obj["instanceClusterId"] if "instanceClusterId" in json_obj else None return InstanceCleanupClusterEvent(cluster_id, instance_cluster_id) diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/topology/events.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/topology/events.py index ecc9739286..07151c2bef 100644 --- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/topology/events.py +++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/topology/events.py @@ -66,7 +66,7 @@ def create_from_json(json_str): instance.instance_id = json_obj["instanceId"] if "instanceId" in json_obj else None instance.network_partition_id = json_obj["networkPartitionId"] if "networkPartitionId" in json_obj else None instance.partition_id = json_obj["partitionId"] if "partitionId" in json_obj else None - #instance.port_map = json_obj["portMap"] if "portMap" in json_obj else {} + # instance.port_map = json_obj["portMap"] if "portMap" in json_obj else {} instance.member_private_ips = json_obj["memberPrivateIPs"] if "memberPrivateIPs" in json_obj else None instance.member_public_ips = json_obj["memberPublicIPs"] if "memberPublicIPs" in json_obj else None instance.member_default_public_ip = json_obj["defaultPublicIP"] if "defaultPublicIP" in json_obj else None @@ -168,7 +168,7 @@ def create_from_json(json_str): topology_obj.initialized = True if str(topology_str["initialized"]).lower == "true" else False topology_obj.json_str = topology_str - #add service map + # add service map for service_name in topology_str["serviceMap"]: service_str = topology_str["serviceMap"][service_name] @@ -180,7 +180,7 @@ def create_from_json(json_str): port_obj = Port(port_str["protocol"], port_str["value"], port_proxy) service_obj.add_port(port_obj) - #add cluster map + # add cluster map for cluster_id in service_str["clusterIdClusterMap"]: cluster_str = service_str["clusterIdClusterMap"][cluster_id] cl_service_name = cluster_str["serviceName"]