]> arthur.barton.de Git - netdata.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Tue, 20 Sep 2016 18:43:29 +0000 (21:43 +0300)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Tue, 20 Sep 2016 18:43:29 +0000 (21:43 +0300)
Dockerfile
docker-build.sh
python.d/mysql.chart.py
python.d/python_modules/base.py

index 955befb54977971aa0c83f42e459c05e38d4fe2c..5a123fc8d7576b620928ffdad1528d1741178a27 100644 (file)
@@ -3,9 +3,9 @@
 
 FROM debian:jessie
 
-ADD docker-build.sh /docker-build.sh
+ADD . /netdata.git
 
-RUN chmod +x /docker-build.sh && sync && sleep 1 && /docker-build.sh
+RUN cd ./netdata.git && chmod +x ./docker-build.sh && sync && sleep 1 && ./docker-build.sh
 
 WORKDIR /
 
index 462276c32a2a4ddfb8a836b79aa54e42ca69e35c..1112ccb622b66accb815db497a1382344991590e 100644 (file)
@@ -17,11 +17,6 @@ apt-get -qq update
 apt-get -y install zlib1g-dev uuid-dev libmnl-dev gcc make curl git autoconf autogen automake pkg-config netcat-openbsd jq
 apt-get -y install autoconf-archive lm-sensors nodejs python python-mysqldb python-yaml
 
-# fetch netdata
-
-git clone https://github.com/firehol/netdata.git /netdata.git --depth=1
-cd /netdata.git
-
 # use the provided installer
 
 ./netdata-installer.sh --dont-wait --dont-start-it
index 7c3931acf75d1721fcba11fbf406a3dbb1e631ed..dab6fad3be5f548ae3f72c304db7904f9572b582 100644 (file)
@@ -317,40 +317,29 @@ class Service(SimpleService):
         :param configuration: dict
         :return: dict
         """
+        parameters = {}
         if self.name is None:
             self.name = 'local'
-        if 'user' not in configuration:
-            self.configuration['user'] = 'root'
-        if 'pass' not in configuration:
-            self.configuration['pass'] = ''
+        if 'user' in configuration:
+            parameters['user'] = self.configuration['user']
+        if 'pass' in configuration:
+            parameters['passwd'] = self.configuration['pass']
         if 'my.cnf' in configuration:
-            self.configuration['socket'] = ''
-            self.configuration['host'] = ''
-            self.configuration['port'] = 0
+            parameters['read_default_file'] = self.configuration['my.cnf']
         elif 'socket' in configuration:
-            self.configuration['my.cnf'] = ''
-            self.configuration['host'] = ''
-            self.configuration['port'] = 0
+            parameters['unix_socket'] = self.configuration['socket']
         elif 'host' in configuration:
-            self.configuration['my.cnf'] = ''
-            self.configuration['socket'] = ''
+            parameters['host'] = self.configuration['host']
             if 'port' in configuration:
-                self.configuration['port'] = int(configuration['port'])
-            else:
-                self.configuration['port'] = 3306
+                parameters['port'] = int(self.configuration['port'])
+        self.connection_parameters = parameters
 
     def _connect(self):
         """
         Try to connect to MySQL server
         """
         try:
-            self.connection = MySQLdb.connect(user=self.configuration['user'],
-                                              passwd=self.configuration['pass'],
-                                              read_default_file=self.configuration['my.cnf'],
-                                              unix_socket=self.configuration['socket'],
-                                              host=self.configuration['host'],
-                                              port=self.configuration['port'],
-                                              connect_timeout=self.update_every)
+            self.connection = MySQLdb.connect(connect_timeout=self.update_every, **self.connection_parameters)
         except MySQLdb.OperationalError as e:
             self.error("Cannot establish connection to MySQL.")
             self.debug(str(e))
index c2bbed2a572cc6011f0df1cc13ddef3339caa53a..1508e0965e58b8ca184400ebbc584b157c0d7c99 100644 (file)
@@ -658,6 +658,7 @@ class SocketService(SimpleService):
             self.unix_socket = str(self.configuration['socket'])
         except (KeyError, TypeError):
             self.debug("No unix socket specified. Trying TCP/IP socket.")
+            self.unix_socket = None
             try:
                 self.host = str(self.configuration['host'])
             except (KeyError, TypeError):
@@ -673,6 +674,7 @@ class SocketService(SimpleService):
         self.request = self.request.encode()
 
     def check(self):
+        self._parse_config()
         return SimpleService.check(self)