You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ch...@apache.org on 2015/05/18 20:02:32 UTC

[1/2] stratos git commit: PCA - Tested and fixed BAM log publishing related issues, Thrift publishing related issues

Repository: stratos
Updated Branches:
  refs/heads/master 3ca56bb50 -> a651a783f


PCA - Tested and fixed BAM log publishing related issues, Thrift publishing related issues


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/c0cf0d98
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/c0cf0d98
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/c0cf0d98

Branch: refs/heads/master
Commit: c0cf0d98e3a2a7fccf94166ef8ae3d1a49c37ce3
Parents: 3ca56bb
Author: Chamila de Alwis <ch...@apache.org>
Authored: Mon May 18 23:10:58 2015 +0530
Committer: Chamila de Alwis <ch...@apache.org>
Committed: Mon May 18 23:11:52 2015 +0530

----------------------------------------------------------------------
 .../cartridge.agent/cartridge.agent/agent.py    |  1 +
 .../cartridge.agent/cartridge.agent/config.py   |  1 +
 .../cartridge.agent/constants.py                |  2 +-
 .../cartridge.agent/modules/databridge/agent.py |  2 +-
 .../modules/databridge/thrift/publisher.py      | 30 +++----
 .../modules/datapublisher/logpublisher.py       | 88 ++++++++++++++------
 .../modules/healthstatspublisher/healthstats.py |  6 +-
 .../test/PythonCartridgeAgentTest.java          |  8 +-
 .../src/test/resources/agent.conf               | 28 ++-----
 9 files changed, 98 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/c0cf0d98/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/agent.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/agent.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/agent.py
index 4268269..39010db 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/agent.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/agent.py
@@ -110,6 +110,7 @@ class CartridgeAgent(threading.Thread):
             if log_file_paths is None:
                 self.__log.exception("No valid log file paths found, no logs will be published")
             else:
+                self.__log.debug("Starting Log Publisher Manager: [Log file paths] %s" % ", ".join(log_file_paths))
                 self.__log_publish_manager = LogPublisherManager(log_file_paths)
                 self.__log_publish_manager.start()
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/c0cf0d98/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/config.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/config.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/config.py
index 91503af..ea80ee8 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/config.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/config.py
@@ -261,6 +261,7 @@ class CartridgeAgentConfiguration:
             self.log.debug("export_metadata_keys: %r" % self.export_metadata_keys)
             self.log.debug("import_metadata_keys: %r" % self.import_metadata_keys)
             self.log.debug("artifact.update.interval: %r" % self.artifact_update_interval)
+            self.log.debug("log_file_paths: %s" % self.log_file_paths)
 
         def __read_conf_file(self):
             """

http://git-wip-us.apache.org/repos/asf/stratos/blob/c0cf0d98/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/constants.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/constants.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/constants.py
index 9f1dcc0..1e4a851 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/constants.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/constants.py
@@ -48,7 +48,7 @@ CARTRIDGE_ALIAS = "CARTRIDGE_ALIAS"
 TOKEN = "TOKEN"
 
 # stratos.sh environment variables keys
-LOG_FILE_PATHS = "LOG_FILE_PATHS"
+LOG_FILE_PATHS = "log.file.paths"
 MEMORY_CONSUMPTION = "memory_consumption"
 LOAD_AVERAGE = "load_average"
 PORTS_NOT_OPEN = "ports_not_open"

http://git-wip-us.apache.org/repos/asf/stratos/blob/c0cf0d98/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/agent.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/agent.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/agent.py
index 8fdeec0..5ef794c 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/agent.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/agent.py
@@ -111,7 +111,7 @@ class ThriftEvent:
         self.correlationData = []
         """:type : list[str]"""
         self.payloadData = []
-        """:type : list[str]"""
+        """:type : list[T]"""
 
 
 class ThriftPublisher:

http://git-wip-us.apache.org/repos/asf/stratos/blob/c0cf0d98/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/publisher.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/publisher.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/publisher.py
index 3317404..ea87718 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/publisher.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/publisher.py
@@ -41,7 +41,7 @@ class Publisher:
         self.sessionId = None
         self.streamId = None
 
-        self.event_num = 0
+        # self.event_num = 0
 
     def connect(self, username, password):
         # Create a client to use the protocol encoder
@@ -59,8 +59,8 @@ class Publisher:
     def publish(self, event):
         # Build thrift event bundle
         event.setSessionId(self.sessionId)
-        event.setEventNum(self.event_num)
-        self.event_num += 1
+        event.setEventNum(1)
+        # self.event_num += 1
 
         # Publish
         Publisher.client.publish(event.getEventBundle())
@@ -73,14 +73,16 @@ class Publisher:
 
 
 class EventBundle:
-    __sessionId = ""
-    __eventNum = 0
-    __intAttributeList = []
-    __longAttributeList = []
-    __doubleAttributeList = []
-    __boolAttributeList = []
-    __stringAttributeList = []
-    __arbitraryDataMapMap = None
+
+    def __init__(self):
+        self.__sessionId = ""
+        self.__eventNum = 0
+        self.__intAttributeList = []
+        self.__longAttributeList = []
+        self.__doubleAttributeList = []
+        self.__boolAttributeList = []
+        self.__stringAttributeList = []
+        self.__arbitraryDataMapMap = None
 
     def setSessionId(self, sessionId):
         self.__sessionId = sessionId
@@ -105,6 +107,6 @@ class EventBundle:
 
     def getEventBundle(self):
         return ThriftEventBundle(self.__sessionId, self.__eventNum, self.__intAttributeList,
-                                             self.__longAttributeList, self.__doubleAttributeList,
-                                             self.__boolAttributeList, self.__stringAttributeList,
-                                             self.__arbitraryDataMapMap)
+                                 self.__longAttributeList, self.__doubleAttributeList,
+                                 self.__boolAttributeList, self.__stringAttributeList,
+                                 self.__arbitraryDataMapMap)

http://git-wip-us.apache.org/repos/asf/stratos/blob/c0cf0d98/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/datapublisher/logpublisher.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/datapublisher/logpublisher.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/datapublisher/logpublisher.py
index d664024..10c398f 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/datapublisher/logpublisher.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/datapublisher/logpublisher.py
@@ -35,21 +35,22 @@ class LogPublisher(Thread):
         self.file_path = file_path
         self.thrift_publisher = ThriftPublisher(
             DataPublisherConfiguration.get_instance().monitoring_server_ip,
-            DataPublisherConfiguration.get_instance().monitoring_server_port,
+            DataPublisherConfiguration.get_instance().monitoring_server_secure_port,
             DataPublisherConfiguration.get_instance().admin_username,
             DataPublisherConfiguration.get_instance().admin_password,
             stream_definition)
         self.tenant_id = tenant_id
         self.alias = alias
-        self.datetime = date_time
+        self.date_time = date_time
         self.member_id = member_id
 
         self.terminated = False
 
     def run(self):
         if os.path.isfile(self.file_path) and os.access(self.file_path, os.R_OK):
-            self.log.info("Starting log publisher for file: " + self.file_path + ", thread: " + current_thread())
+            self.log.info("Starting log publisher for file: " + self.file_path + ", thread: " + str(current_thread()))
             # open file and keep reading for new entries
+            # with open(self.file_path, "r") as read_file:
             read_file = open(self.file_path, "r")
             read_file.seek(os.stat(self.file_path)[6])  # go to the end of the file
 
@@ -58,16 +59,18 @@ class LogPublisher(Thread):
                 line = read_file.readline()   # read the current line
                 if not line:
                     # no new line entered
+                    self.log.debug("No new log entries detected to publish.")
                     time.sleep(1)
                     read_file.seek(where)  # set seeker
                 else:
                     # new line detected, create event object
+                    self.log.debug("Log entry/entries detected. Publishing to monitoring server.")
                     event = ThriftEvent()
                     event.metaData.append(self.member_id)
                     event.payloadData.append(self.tenant_id)
                     event.payloadData.append(self.alias)
                     event.payloadData.append("")
-                    event.payloadData.append(self.datetime)
+                    event.payloadData.append(self.date_time)
                     event.payloadData.append("")
                     event.payloadData.append(line)
                     event.payloadData.append("")
@@ -76,10 +79,12 @@ class LogPublisher(Thread):
                     event.payloadData.append("")
 
                     self.thrift_publisher.publish(event)
+                    self.log.debug("Log event published.")
 
-            self.thrift_publisher.disconnect()  # dicsonnect the publisher upon being terminated
+            self.thrift_publisher.disconnect()  # disconnect the publisher upon being terminated
+            self.log.debug("Log publisher for path \"%s\" terminated" % self.file_path)
         else:
-            raise DataPublisherException("Unable to read the file at path %r" % self.file_path)
+            raise DataPublisherException("Unable to read the file at path \"%s\"" % self.file_path)
 
     def terminate(self):
         """
@@ -96,7 +101,7 @@ class LogPublisherManager(Thread):
     """
 
     @staticmethod
-    def define_stream():
+    def define_stream(tenant_id, alias, date_time):
         """
         Creates a stream definition for Log Publishing
         :return: A StreamDefinition object with the required attributes added
@@ -104,15 +109,16 @@ class LogPublisherManager(Thread):
         """
         # stream definition
         stream_definition = StreamDefinition()
-        valid_tenant_id = LogPublisherManager.get_valid_tenant_id(CartridgeAgentConfiguration().tenant_id)
-        alias = LogPublisherManager.get_alias(CartridgeAgentConfiguration().cluster_id)
-        stream_name = "logs." + valid_tenant_id + "." \
-                      + alias + "." + LogPublisherManager.get_current_date()
+        stream_name = "logs." + tenant_id + "." \
+                      + alias + "." + date_time
         stream_version = "1.0.0"
+        stream_nickname = "log entries from instance"
+        stream_description = "Apache Stratos Instance Log Publisher"
 
         stream_definition.name = stream_name
         stream_definition.version = stream_version
-        stream_definition.description = "Apache Stratos Instance Log Publisher"
+        stream_definition.description = stream_description
+        stream_definition.nickname = stream_nickname
         stream_definition.add_metadata_attribute("memberId", StreamDefinition.STRING)
         stream_definition.add_payloaddata_attribute("tenantID", StreamDefinition.STRING)
         stream_definition.add_payloaddata_attribute("serverName", StreamDefinition.STRING)
@@ -129,6 +135,9 @@ class LogPublisherManager(Thread):
 
     def __init__(self, logfile_paths):
         Thread.__init__(self)
+
+        self.log = LogFactory().get_log(__name__)
+
         self.logfile_paths = logfile_paths
         self.publishers = {}
         self.ports = []
@@ -137,19 +146,23 @@ class LogPublisherManager(Thread):
 
         self.cartridge_agent_config = CartridgeAgentConfiguration()
 
-        cartridgeagentutils.wait_until_ports_active(
+        self.log.debug("Checking if Monitoring server is active.")
+        ports_active = cartridgeagentutils.wait_until_ports_active(
             DataPublisherConfiguration.get_instance().monitoring_server_ip,
             self.ports,
             int(self.cartridge_agent_config.read_property("port.check.timeout", critical=False)))
 
-        ports_active = cartridgeagentutils.check_ports_active(
-            DataPublisherConfiguration.get_instance().monitoring_server_ip,
-            self.ports)
-
         if not ports_active:
+            self.log.debug("Monitoring server is not active")
             raise DataPublisherException("Monitoring server not active, data publishing is aborted")
 
-        self.stream_definition = self.define_stream()
+        self.log.debug("Monitoring server is up and running. Log Publisher Manager started.")
+
+        self.tenant_id = LogPublisherManager.get_valid_tenant_id(CartridgeAgentConfiguration().tenant_id)
+        self.alias = LogPublisherManager.get_alias(CartridgeAgentConfiguration().cluster_id)
+        self.date_time = LogPublisherManager.get_current_date()
+
+        self.stream_definition = self.define_stream(self.tenant_id, self.alias, self.date_time)
 
     def run(self):
         if self.logfile_paths is not None and len(self.logfile_paths):
@@ -157,6 +170,7 @@ class LogPublisherManager(Thread):
                 # thread for each log file
                 publisher = self.get_publisher(log_path)
                 publisher.start()
+                self.log.debug("Log publisher for path \"%s\" started." % log_path)
 
     def get_publisher(self, log_path):
         """
@@ -165,7 +179,14 @@ class LogPublisherManager(Thread):
         :rtype : LogPublisher
         """
         if log_path not in self.publishers:
-            self.publishers[log_path] = LogPublisher(log_path, self.stream_definition)
+            self.log.debug("Creating a Log publisher for path \"%s\"" % log_path)
+            self.publishers[log_path] = LogPublisher(
+                log_path,
+                self.stream_definition,
+                self.tenant_id,
+                self.alias,
+                self.date_time,
+                self.cartridge_agent_config.member_id)
 
         return self.publishers[log_path]
 
@@ -185,8 +206,7 @@ class LogPublisherManager(Thread):
 
     @staticmethod
     def get_valid_tenant_id(tenant_id):
-        if tenant_id == constants.INVALID_TENANT_ID \
-                or tenant_id == constants.SUPER_TENANT_ID:
+        if tenant_id == constants.INVALID_TENANT_ID or tenant_id == constants.SUPER_TENANT_ID:
             return "0"
 
         return tenant_id
@@ -243,7 +263,11 @@ class DataPublisherConfiguration:
         self.read_config()
 
     def read_config(self):
-        self.enabled = True if self.cartridge_agent_config.read_property(constants.MONITORING_PUBLISHER_ENABLED, False).strip().lower() == "true" else False
+        self.enabled = True if \
+            self.cartridge_agent_config.read_property(constants.MONITORING_PUBLISHER_ENABLED, False).strip().lower() \
+            == "true" \
+            else False
+
         if not self.enabled:
             DataPublisherConfiguration.log.info("Data Publisher disabled")
             return
@@ -254,19 +278,31 @@ class DataPublisherConfiguration:
         if self.monitoring_server_ip is None or self.monitoring_server_ip.strip() == "":
             raise RuntimeError("System property not found: " + constants.MONITORING_RECEIVER_IP)
 
-        self.monitoring_server_port = self.cartridge_agent_config.read_property(constants.MONITORING_RECEIVER_PORT, False)
+        self.monitoring_server_port = self.cartridge_agent_config.read_property(
+            constants.MONITORING_RECEIVER_PORT,
+            False)
+
         if self.monitoring_server_port is None or self.monitoring_server_port.strip() == "":
             raise RuntimeError("System property not found: " + constants.MONITORING_RECEIVER_PORT)
 
-        self.monitoring_server_secure_port = self.cartridge_agent_config.read_property("monitoring.server.secure.port", False)
+        self.monitoring_server_secure_port = self.cartridge_agent_config.read_property(
+            "monitoring.server.secure.port",
+            False)
+
         if self.monitoring_server_secure_port is None or self.monitoring_server_secure_port.strip() == "":
             raise RuntimeError("System property not found: monitoring.server.secure.port")
 
-        self.admin_username = self.cartridge_agent_config.read_property(constants.MONITORING_SERVER_ADMIN_USERNAME, False)
+        self.admin_username = self.cartridge_agent_config.read_property(
+            constants.MONITORING_SERVER_ADMIN_USERNAME,
+            False)
+
         if self.admin_username is None or self.admin_username.strip() == "":
             raise RuntimeError("System property not found: " + constants.MONITORING_SERVER_ADMIN_USERNAME)
 
-        self.admin_password = self.cartridge_agent_config.read_property(constants.MONITORING_SERVER_ADMIN_PASSWORD, False)
+        self.admin_password = self.cartridge_agent_config.read_property(
+            constants.MONITORING_SERVER_ADMIN_PASSWORD,
+            False)
+
         if self.admin_password is None or self.admin_password.strip() == "":
             raise RuntimeError("System property not found: " + constants.MONITORING_SERVER_ADMIN_PASSWORD)
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/c0cf0d98/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/healthstatspublisher/healthstats.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/healthstatspublisher/healthstats.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/healthstatspublisher/healthstats.py
index 8b4e877..9753c3e 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/healthstatspublisher/healthstats.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/healthstatspublisher/healthstats.py
@@ -123,7 +123,7 @@ class HealthStatisticsPublisher:
         stream_def.nickname = HealthStatisticsPublisherManager.STREAM_NICKNAME
         stream_def.description = HealthStatisticsPublisherManager.STREAM_DESCRIPTION
 
-
+        # stream_def.add_payloaddata_attribute()
         stream_def.add_payloaddata_attribute("cluster_id", StreamDefinition.STRING)
         stream_def.add_payloaddata_attribute("cluster_instance_id", StreamDefinition.STRING)
         stream_def.add_payloaddata_attribute("network_partition_id", StreamDefinition.STRING)
@@ -147,7 +147,7 @@ class HealthStatisticsPublisher:
         event.payloadData.append(self.cartridge_agent_config.member_id)
         event.payloadData.append(self.cartridge_agent_config.partition_id)
         event.payloadData.append(constants.MEMORY_CONSUMPTION)
-        event.payloadData.append(memory_usage)
+        event.payloadData.append(float(memory_usage))
 
         HealthStatisticsPublisher.log.debug("Publishing cep event: [stream] %r [payload_data} %r [version] %r" % (self.stream_definition.name,event.payloadData, self.stream_definition.version))
         self.publisher.publish(event)
@@ -165,7 +165,7 @@ class HealthStatisticsPublisher:
         event.payloadData.append(self.cartridge_agent_config.member_id)
         event.payloadData.append(self.cartridge_agent_config.partition_id)
         event.payloadData.append(constants.LOAD_AVERAGE)
-        event.payloadData.append(load_avg)
+        event.payloadData.append(float(load_avg))
 
         HealthStatisticsPublisher.log.debug("Publishing cep event: [stream] %r [version] %r" % (self.stream_definition.name, self.stream_definition.version))
         self.publisher.publish(event)

http://git-wip-us.apache.org/repos/asf/stratos/blob/c0cf0d98/components/org.apache.stratos.python.cartridge.agent/src/test/java/org/apache/stratos/python.cartridge.agent/test/PythonCartridgeAgentTest.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/test/java/org/apache/stratos/python.cartridge.agent/test/PythonCartridgeAgentTest.java b/components/org.apache.stratos.python.cartridge.agent/src/test/java/org/apache/stratos/python.cartridge.agent/test/PythonCartridgeAgentTest.java
index 6783b9c..7fe9845 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/test/java/org/apache/stratos/python.cartridge.agent/test/PythonCartridgeAgentTest.java
+++ b/components/org.apache.stratos.python.cartridge.agent/src/test/java/org/apache/stratos/python.cartridge.agent/test/PythonCartridgeAgentTest.java
@@ -57,6 +57,7 @@ public class PythonCartridgeAgentTest {
     private static final Log log = LogFactory.getLog(PythonCartridgeAgentTest.class);
 
     private static final String NEW_LINE = System.getProperty("line.separator");
+//    private static final long TIMEOUT = 1440000;
     private static final long TIMEOUT = 120000;
     private static final String CLUSTER_ID = "php.php.domain";
     private static final String DEPLOYMENT_POLICY_NAME = "deployment-policy-1";
@@ -80,6 +81,7 @@ public class PythonCartridgeAgentTest {
     private boolean eventReceiverInitiated = false;
     private TopologyEventReceiver topologyEventReceiver;
     private InstanceStatusEventReceiver instanceStatusEventReceiver;
+    private int cepPort = 7711;
 
     public PythonCartridgeAgentTest(ArtifactUpdatedEvent artifactUpdatedEvent, Boolean expectedResult) {
         this.artifactUpdatedEvent = artifactUpdatedEvent;
@@ -139,7 +141,7 @@ public class PythonCartridgeAgentTest {
         this.outputStream = executeCommand("python " + agentPath + "/agent.py");
 
         // Simulate CEP server socket
-        startServerSocket(7711);
+        startServerSocket(cepPort);
     }
 
     /**
@@ -212,6 +214,10 @@ public class PythonCartridgeAgentTest {
                 {privateRepoEvent2, true}
         });
 
+//        return Arrays.asList(new Object[][]{
+//                {publicRepoEvent, true}
+//        });
+
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/stratos/blob/c0cf0d98/components/org.apache.stratos.python.cartridge.agent/src/test/resources/agent.conf
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/test/resources/agent.conf b/components/org.apache.stratos.python.cartridge.agent/src/test/resources/agent.conf
index e4719d1..8beaf7c 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/test/resources/agent.conf
+++ b/components/org.apache.stratos.python.cartridge.agent/src/test/resources/agent.conf
@@ -32,29 +32,13 @@ auto.checkout                         =true
 artifact.update.interval              =15
 port.check.timeout                    =600000
 enable.data.publisher                 =false
-monitoring.server.ip                  =192.168.1.4
-monitoring.server.port                =7611
-monitoring.server.secure.port         =7711
+monitoring.server.ip                  =localhost
+monitoring.server.port                =7612
+monitoring.server.secure.port         =7712
 monitoring.server.admin.username      =admin
 monitoring.server.admin.password      =admin
-log.file.paths                        =
+#log.file.paths                        =/home/chamilad/dev/wso2esb-4.8.1/repository/logs/wso2carbon.log
+log.file.paths                        =/tmp/agent.screen.log
 metadata.service.url                  =https://localhost:9443
 super.tenant.repository.path          =/repository/deployment/server/
-tenant.repository.path                =/repository/tenants/
-extension.instance.started            =instance-started.sh
-extension.start.servers               =start-servers.sh
-extension.instance.activated          =instance-activated.sh
-extension.artifacts.updated           =artifacts-updated.sh
-extension.clean                       =clean.sh
-extension.mount.volumes               =mount_volumes.sh
-extension.member.started              =member-started.sh
-extension.member.activated            =member-activated.sh
-extension.member.suspended            =member-suspended.sh
-extension.member.terminated           =member-terminated.sh
-extension.complete.topology           =complete-topology.sh
-extension.complete.tenant             =complete-tenant.sh
-extension.domain.mapping.added        =domain-mapping-added.sh
-extension.domain.mapping.removed      =domain-mapping-removed.sh
-extension.artifacts.copy              =artifacts-copy.sh
-extension.tenant.subscribed           =tenant-subscribed.sh
-extension.tenant.unsubscribed         =tenant-unsubscribed.sh
\ No newline at end of file
+tenant.repository.path                =/repository/tenants/
\ No newline at end of file


[2/2] stratos git commit: PCA - Event handler now throws GitRepositorySynchronizationException if APPLICATION_PATH is null

Posted by ch...@apache.org.
PCA - Event handler now throws GitRepositorySynchronizationException if APPLICATION_PATH is null


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/a651a783
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/a651a783
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/a651a783

Branch: refs/heads/master
Commit: a651a783f29f60b0da650eba7542cde369fca90d
Parents: c0cf0d9
Author: Chamila de Alwis <ch...@apache.org>
Authored: Mon May 18 23:21:07 2015 +0530
Committer: Chamila de Alwis <ch...@apache.org>
Committed: Mon May 18 23:21:07 2015 +0530

----------------------------------------------------------------------
 .../cartridge.agent/cartridge.agent/modules/event/eventhandler.py | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/a651a783/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/eventhandler.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/eventhandler.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/eventhandler.py
index 5ce9b4a..1061fbd 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/eventhandler.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/eventhandler.py
@@ -88,6 +88,9 @@ class EventHandler:
 
             self.__log.info("Executing git checkout")
 
+            if local_repo_path is None:
+                raise GitRepositorySynchronizationException("Repository path is empty. Cannot perform Git operations.")
+
             # create repo object
             local_repo_path = self.get_repo_path_for_tenant(tenant_id, local_repo_path, is_multitenant)
             repo_info = Repository(repo_url, repo_username, repo_password, local_repo_path, tenant_id, commit_enabled)