- Suppress warning output

- Escape special character
This commit is contained in:
ssamson-tis 2015-10-30 10:53:38 +01:00
parent af9471e56b
commit dc53354ea2
2 changed files with 3 additions and 10 deletions

View File

@ -30,9 +30,6 @@ except ImportError,e:
sys.stderr = sys.__stderr__
import datetime
import base64
import os
from common import *
class backup_mysql(backup_generic):
@ -69,10 +66,11 @@ class backup_mysql(backup_generic):
self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.ssh.connect(self.server_name,username='root',pkey = mykey, port=self.ssh_port)
self.db_passwd=self.db_passwd.replace('$','\$')
if not self.db_name:
stats['log']= "Successfully backuping processed to the following databases :"
stats['status']='List'
cmd = 'mysql -N -B -p -e "SHOW DATABASES;" -u ' + self.db_user +' -p' + self.db_passwd
cmd = 'mysql -N -B -p -e "SHOW DATABASES;" -u ' + self.db_user +' -p' + self.db_passwd + ' 2> /dev/null'
self.logger.debug('[%s] List databases: %s',self.backup_name,cmd)
(error_code,output) = ssh_exec(cmd,ssh=self.ssh)
self.logger.debug("[%s] Output of %s :\n%s",self.backup_name,cmd,output)

View File

@ -27,11 +27,6 @@ except ImportError,e:
sys.stderr = sys.__stderr__
import datetime
import base64
import os
import logging
import re
from common import *
class backup_pgsql(backup_generic):
@ -70,7 +65,7 @@ class backup_pgsql(backup_generic):
else:
stats['log']= "Successfully backuping processed to the following databases :"
stats['status']='List'
cmd = """su - postgres -c 'psql -t -c "SELECT datname FROM pg_database WHERE datistemplate = false;"'"""
cmd = """su - postgres -c 'psql -t -c "SELECT datname FROM pg_database WHERE datistemplate = false;"' 2> /dev/null"""
self.logger.debug('[%s] List databases: %s',self.backup_name,cmd)
(error_code,output) = ssh_exec(cmd,ssh=self.ssh)
self.logger.debug("[%s] Output of %s :\n%s",self.backup_name,cmd,output)