在使用Python Fabri时消失文件

2024-05-19 10:27:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用fabric在远程服务器上构建一个项目(尽管现在我正在本地主机上测试。)s3和git repo中存储了几个文件依赖项。在我添加其他依赖项之前,git repo是正常的,现在其中一个文件夹/test_fab/smart-targeting-service/classification/在脚本末尾消失了

这是已知的织物行为吗

我已经评论了文件消失的地方

from fabric.api import *
from fabric.context_managers import cd

env.activate = 'source venv/bin/activate'

def stand_up_smart_targeting():

    sudo('rm -rf test_fab')

    home_directory = run('pwd')

    run('mkdir test_fab')

    sudo('pip3 install virtualenv')

    current_directory = home_directory + '/test_fab'

    files = ['https://s3.amazonaws.com/subnet/file1.tar.gz', 'https://s3.amazonaws.com/subnet/file1.tar.gz']

    with cd(current_directory):

        for file in files:
            run('wget {}'.format(file))
            run('tar -xvzf {}'.format(file.split('/')[len(file.split('/')) - 1]))

         run('git clone https://github.com/smart-targetting-service.git')

    with cd(current_directory + '/smart-targetting-service'):

        run('virtualenv -p python3 venv')

        run('ls')

    with cd(current_directory + '/smart-targetting-service/classification'):

        run('ls')# <-- this command shows the files correctly

        #They disappear here somehow

Tags: runhttpstestgitcoms3smartservice

热门问题