在我的新MacBook上部署throw pip结构时遇到一些问题。谷歌有一些问题,但他们推荐的不起作用......同样的配置也适用于另一台Mac上的High Sierra,所以我觉得我很误解了。有我的pip包:
Package Version
------------ -------
asn1crypto 0.24.0
bcrypt 3.1.4
cffi 1.11.5
cryptography 2.3.1
fabric 2.3.1
idna 2.7
invoke 1.1.1
paramiko 2.4.1
pip 18.1
pyasn1 0.4.4
pycparser 2.18
PyNaCl 1.2.1
setuptools 40.6.3
six 1.11.0
wheel 0.32.3
这是我的fab文件:
from fabric import Connection
from invoke import task
@task
def deploy(c, branch='master', directory='*secret*', compile='true'):
with Connection('*secret*') as c:
deploy_process(c, branch, directory, compile)
def deploy_process(c, branch, directory, compile):
code_dir = '/var/www/' + directory
service = directory + ".service"
if not c.run("cd {} && git fetch origin".format(code_dir), warn=True):
c.run("git clone *also secret repo* {}".format(code_dir))
c.run("cd {} && git fetch origin".format(code_dir))
c.run("cd {} && git checkout -f {}".format(code_dir, branch))
c.run("cd {} && git pull origin {}".format(code_dir, branch))
if not c.run("test -d {}/tmp/pids".format(code_dir), warn=True):
c.run("cd {} && mkdir -p tmp/pids".format(code_dir))
c.run("cd {} && bundle install --without development test".format(code_dir))
c.run("cd {} && rails tmp:cache:clear db:migrate RAILS_ENV=production".format(code_dir))
if (compile == 'true'):
c.run("cd {} && rails assets:precompile RAILS_ENV=production".format(code_dir))
c.run("cd {} && rails assets:clean RAILS_ENV=production".format(code_dir))
c.run("systemctl restart {}".format(service))
并且有一个错误:
Traceback (most recent call last):
File "/usr/local/bin/fab", line 11, in <module>
sys.exit(program.run())
File "/usr/local/lib/python3.7/site-packages/invoke/program.py", line 335, in run
self.execute()
File "/usr/local/lib/python3.7/site-packages/invoke/program.py", line 491, in execute
executor.execute(*self.tasks)
File "/usr/local/lib/python3.7/site-packages/invoke/executor.py", line 129, in execute
result = call.task(*args, **call.kwargs)
File "/usr/local/lib/python3.7/site-packages/invoke/tasks.py", line 128, in __call__
result = self.body(*args, **kwargs)
File "/Users/vassa/Projects/pochtagram/fabfile.py", line 11, in deploy
if not c.run("cd {} && git fetch origin".format(code_dir), warn=True):
File "<decorator-gen-3>", line 2, in run
File "/usr/local/lib/python3.7/site-packages/fabric/connection.py", line 29, in opens
self.open()
File "/usr/local/lib/python3.7/site-packages/fabric/connection.py", line 541, in open
self.client.connect(**kwargs)
File "/usr/local/lib/python3.7/site-packages/paramiko/client.py", line 424, in connect
passphrase,
File "/usr/local/lib/python3.7/site-packages/paramiko/client.py", line 714, in _auth
raise saved_exception
File "/usr/local/lib/python3.7/site-packages/paramiko/client.py", line 686, in _auth
filename, pkey_class, passphrase,
File "/usr/local/lib/python3.7/site-packages/paramiko/client.py", line 551, in _key_from_filepath
key = klass.from_private_key_file(key_path, password)
File "/usr/local/lib/python3.7/site-packages/paramiko/pkey.py", line 206, in from_private_key_file
key = cls(filename=filename, password=password)
File "/usr/local/lib/python3.7/site-packages/paramiko/rsakey.py", line 48, in __init__
self._from_private_key_file(filename, password)
File "/usr/local/lib/python3.7/site-packages/paramiko/rsakey.py", line 169, in _from_private_key_file
data = self._read_private_key_file('RSA', filename, password)
File "/usr/local/lib/python3.7/site-packages/paramiko/pkey.py", line 279, in _read_private_key_file
data = self._read_private_key(tag, f, password)
File "/usr/local/lib/python3.7/site-packages/paramiko/pkey.py", line 289, in _read_private_key
raise SSHException('not a valid ' + tag + ' private key file')
paramiko.ssh_exception.SSHException: not a valid RSA private key file
希望smb可以帮助我......