instance.py

changeset 21
c36e549a7f12
parent 20
fdfbe5d7b677
child 23
86b42610d5a8
--- a/instance.py	Sat Jan 20 23:50:36 2018 +0000
+++ b/instance.py	Sun Jan 21 00:58:06 2018 +0000
@@ -36,19 +36,19 @@
 
         return cmd+arglistify(self.args)+[self.archive_or_repository]+self.argsl
 
-    def launch(self, password=None):
+    def launch(self, passphrase=None):
         cmd=self.construct_cmdline()
 
         logging.info('Launching ' + str(cmd))
 
         env=None
-        if password:
+        if passphrase:
             env=os.environ.copy()
-            env['BORG_PASSPHRASE']=password
+            env['BORG_PASSPHRASE']=passphrase
 
         self.proc=Popen(cmd, env=env, stdout=PIPE, stderr=PIPE, stdin=PIPE)
 
-        # We don't do password input etc.
+        # We don't do passphrase input etc.
         self.proc.stdin.close()
 
     def read_result(self):
@@ -71,7 +71,11 @@
         except err:
             logging.debug('Pipe read failed: %s' % str(err))
 
-            return {'type': 'exception', 'exception': err}
+            return {'type': 'log_message',
+                    'levelname': 'CRITICAL',
+                    'name': 'borgend.instance.BorgInstance',
+                    'msgid': 'Borgend.Exception',
+                    'message': err}
 
         if line==b'':
 
@@ -91,7 +95,11 @@
             for line in iter(stream.readline, b''):
                 errmsg=errmsg+line
 
-            return {'type': 'unparsed_error', 'message': str(errmsg)}
+            return {'type': 'log_message',
+                    'levelname': 'ERROR',
+                    'name': 'borgend.instance.BorgInstance',
+                    'msgid': 'Borgend.JSONFail',
+                    'message': str(errmsg)}
 
     def terminate(self):
         self.proc.terminate()

mercurial