Duplicity在上传到Google Cloud Storage时会给出TypeError



我有一个运行良好的备份脚本。我最近更新了我的操作系统(到 Ubuntu 19.10(并尝试安装所有依赖项,但我收到错误。

我的脚本是这样的:

export PASSPHRASE="passphrase"
PATH=$PATH:/home/jeremy/.boto
export HOME='/home/jeremy/'
DATE=`date +%Y-%m-%d:%H:%M:%S`
echo "Running backup at $DATE" >> /home/jeremy/.backup/log
duplicity --full-if-older-than 1M 
--archive-dir /home/jeremy/.cache/duplicity/ 
/home/jeremy 
gs://x1_carbon_backup >> /home/jeremy/.backup/log

我用gsutil创建了.boto文件,我可以成功地使用gsutil,因此身份验证似乎正在工作。

回溯看起来像一个编码/解码问题,但我无法判断这是我做事方式的问题还是botoduplicity中的错误

Traceback (innermost last):
File "/usr/bin/duplicity", line 107, in <module>
with_tempdir(main)
File "/usr/bin/duplicity", line 93, in with_tempdir
fn()
File "/usr/lib/python3/dist-packages/duplicity/dup_main.py", line 1522, in main
action = commandline.ProcessCommandLine(sys.argv[1:])
File "/usr/lib/python3/dist-packages/duplicity/commandline.py", line 1200, in ProcessCommandLine
globals.backend = backend.get_backend(args[0])
File "/usr/lib/python3/dist-packages/duplicity/backend.py", line 225, in get_backend
obj = get_backend_object(url_string)
File "/usr/lib/python3/dist-packages/duplicity/backend.py", line 211, in get_backend_object
return factory(pu)
File "/usr/lib/python3/dist-packages/duplicity/backends/_boto_single.py", line 173, in __init__
self.resetConnection()
File "/usr/lib/python3/dist-packages/duplicity/backends/_boto_single.py", line 199, in resetConnection
location=self.my_location)
File "/home/jeremy/.local/lib/python3.7/site-packages/boto/gs/connection.py", line 95, in create_bucket
data=get_utf8_value(data))
File "/home/jeremy/.local/lib/python3.7/site-packages/boto/s3/connection.py", line 659, in make_request
auth_path = self.calling_format.build_auth_path(bucket, key)
File "/home/jeremy/.local/lib/python3.7/site-packages/boto/s3/connection.py", line 94, in build_auth_path
path = '/' + bucket
TypeError: can only concatenate str (not "bytes") to str

我尝试按照此处的建议解码存储桶变量。

现在我得到了一个SSLCertVerificationError,下面:

Traceback (most recent call last):
File "/usr/bin/duplicity", line 163, in <module>
if u"Forced assertion for testing" in util.uexc(e):
File "/usr/lib/python3/dist-packages/duplicity/util.py", line 120, in uexc
return fsdecode(m)
File "/usr/lib/python3.7/os.py", line 822, in fsdecode
filename = fspath(filename)  # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not int
Backup complete. Checking for old backups to remove
Traceback (most recent call last):
File "/usr/bin/duplicity", line 107, in <module>
with_tempdir(main)
File "/usr/bin/duplicity", line 93, in with_tempdir
fn()
File "/usr/lib/python3/dist-packages/duplicity/dup_main.py", line 1522, in main
action = commandline.ProcessCommandLine(sys.argv[1:])
File "/usr/lib/python3/dist-packages/duplicity/commandline.py", line 1200, in ProcessCommandLine
globals.backend = backend.get_backend(args[0])
File "/usr/lib/python3/dist-packages/duplicity/backend.py", line 225, in get_backend
obj = get_backend_object(url_string)
File "/usr/lib/python3/dist-packages/duplicity/backend.py", line 211, in get_backend_object
return factory(pu)
File "/usr/lib/python3/dist-packages/duplicity/backends/_boto_single.py", line 173, in __init__
self.resetConnection()
File "/usr/lib/python3/dist-packages/duplicity/backends/_boto_single.py", line 199, in resetConnection
location=self.my_location)
File "/home/jeremy/.local/lib/python3.7/site-packages/boto/gs/connection.py", line 95, in create_bucket
data=get_utf8_value(data))
File "/home/jeremy/.local/lib/python3.7/site-packages/boto/s3/connection.py", line 671, in make_request
retry_handler=retry_handler
File "/home/jeremy/.local/lib/python3.7/site-packages/boto/connection.py", line 1071, in make_request
retry_handler=retry_handler)
File "/home/jeremy/.local/lib/python3.7/site-packages/boto/connection.py", line 1030, in _mexe
raise ex
File "/home/jeremy/.local/lib/python3.7/site-packages/boto/connection.py", line 943, in _mexe
request.body, request.headers)
File "/usr/lib/python3.7/http/client.py", line 1252, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1298, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1247, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/lib/python3.7/http/client.py", line 966, in send
self.connect()
File "/home/jeremy/.local/lib/python3.7/site-packages/boto/https_connection.py", line 131, in connect
ca_certs=self.ca_certs)
File "/usr/lib/python3.7/ssl.py", line 1238, in wrap_socket
suppress_ragged_eofs=suppress_ragged_eofs
File "/usr/lib/python3.7/ssl.py", line 423, in wrap_socket
session=session
File "/usr/lib/python3.7/ssl.py", line 870, in _create
self.do_handshake()
File "/usr/lib/python3.7/ssl.py", line 1139, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1076)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/duplicity", line 163, in <module>
if u"Forced assertion for testing" in util.uexc(e):
File "/usr/lib/python3/dist-packages/duplicity/util.py", line 120, in uexc
return fsdecode(m)
File "/usr/lib/python3.7/os.py", line 822, in fsdecode
filename = fspath(filename)  # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not int

使用--s3-use-new-style作为标志。从 Duplicity 手册页:

--s3-use-new-style
When operating on Amazon S3 buckets, use new-style subdomain bucket addressing. This is now the preferred method to access Amazon S3, but is not backwards
compatible if your bucket name contains upper-case characters or other characters that are not valid in a hostname.
This option has no effect when using the newer boto3 backend, which will always use new style subdomain bucket naming.

相关内容

  • 没有找到相关文章