- Suppress warning output
- Escape special character
This commit is contained in:
parent
af9471e56b
commit
dc53354ea2
@ -30,9 +30,6 @@ except ImportError,e:
|
|||||||
|
|
||||||
sys.stderr = sys.__stderr__
|
sys.stderr = sys.__stderr__
|
||||||
|
|
||||||
import datetime
|
|
||||||
import base64
|
|
||||||
import os
|
|
||||||
from common import *
|
from common import *
|
||||||
|
|
||||||
class backup_mysql(backup_generic):
|
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.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||||
self.ssh.connect(self.server_name,username='root',pkey = mykey, port=self.ssh_port)
|
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:
|
if not self.db_name:
|
||||||
stats['log']= "Successfully backuping processed to the following databases :"
|
stats['log']= "Successfully backuping processed to the following databases :"
|
||||||
stats['status']='List'
|
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)
|
self.logger.debug('[%s] List databases: %s',self.backup_name,cmd)
|
||||||
(error_code,output) = ssh_exec(cmd,ssh=self.ssh)
|
(error_code,output) = ssh_exec(cmd,ssh=self.ssh)
|
||||||
self.logger.debug("[%s] Output of %s :\n%s",self.backup_name,cmd,output)
|
self.logger.debug("[%s] Output of %s :\n%s",self.backup_name,cmd,output)
|
||||||
|
@ -27,11 +27,6 @@ except ImportError,e:
|
|||||||
|
|
||||||
sys.stderr = sys.__stderr__
|
sys.stderr = sys.__stderr__
|
||||||
|
|
||||||
import datetime
|
|
||||||
import base64
|
|
||||||
import os
|
|
||||||
import logging
|
|
||||||
import re
|
|
||||||
from common import *
|
from common import *
|
||||||
|
|
||||||
class backup_pgsql(backup_generic):
|
class backup_pgsql(backup_generic):
|
||||||
@ -70,7 +65,7 @@ class backup_pgsql(backup_generic):
|
|||||||
else:
|
else:
|
||||||
stats['log']= "Successfully backuping processed to the following databases :"
|
stats['log']= "Successfully backuping processed to the following databases :"
|
||||||
stats['status']='List'
|
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)
|
self.logger.debug('[%s] List databases: %s',self.backup_name,cmd)
|
||||||
(error_code,output) = ssh_exec(cmd,ssh=self.ssh)
|
(error_code,output) = ssh_exec(cmd,ssh=self.ssh)
|
||||||
self.logger.debug("[%s] Output of %s :\n%s",self.backup_name,cmd,output)
|
self.logger.debug("[%s] Output of %s :\n%s",self.backup_name,cmd,output)
|
||||||
|
Loading…
Reference in New Issue
Block a user