Set PGPASSWORD environment variable from the process executor before running

the external utility.
This commit is contained in:
Ashesh Vashi
2016-05-15 22:29:14 +05:30
parent 2da3a710a1
commit ca62825c90
4 changed files with 25 additions and 9 deletions

View File

@@ -174,7 +174,7 @@ class BackupMessage(IProcessDesc):
res += ' ' + arg
elif replace_next:
res += ' "' + cgi.escape(
os.path.join('<STORAGE_DIR>', self.bfile)
self.bfile
).encode('ascii', 'xmlcharrefreplace') + '"'
else:
if arg == '--file':
@@ -299,6 +299,7 @@ def create_backup_job(sid):
),
cmd=utility, args=args
)
manager.export_password_env(p.id)
p.start()
jid = p.id
except Exception as e:
@@ -443,6 +444,7 @@ def create_backup_objects_job(sid):
BACKUP.OBJECT, sid, data['file'], database=data['database']
),
cmd=utility, args=args)
manager.export_password_env(p.id)
p.start()
jid = p.id
except Exception as e:

View File

@@ -120,9 +120,9 @@ class RestoreMessage(IProcessDesc):
idx += 1
if no_args > 1:
res += ' "' + cgi.escape(
os.path.join('<STORAGE_DIR>', self.bfile) + '"'
).encode('ascii', 'xmlcharrefreplace')
res += ' "' + cgi.escape(self.bfile).encode(
'ascii', 'xmlcharrefreplace'
) + '"'
res += '</i></div>'
@@ -300,6 +300,7 @@ def create_restore_job(sid):
desc=RestoreMessage(sid, data['file']),
cmd=utility, args=args
)
manager.export_password_env(p.id)
p.start()
jid = p.id
except Exception as e: