4

我正在尝试使用 apip.installedvirtualenv.managedstate 使用位于 minion 上的需求文件(由早期git.latest状态安装)来设置 virtualenv。这是使用的版本pip.installed

mysite-env:
  virtualenv.managed:
    - name: /opt/django/mysite
    - cwd: /opt/django/mysite
    - user: mysite
    - runas: mysite
    - system_site_packages: True

mysite-reqs:
  pip.installed:
    - no_index: True
    - find_links: http://pypi.mysite.com/
    - requirements: /opt/django/mysite/requirements/production.txt
    - pip_exists_action: switch
    - cwd: /opt/django/mysite
    - pip_bin: /opt/django/mysite/bin/pip
    - bin_env: /opt/django/mysite
    - user: mysite
    - watch:
      - git: mysite-project

当我尝试运行此状态时,我收到此错误:

          ID: mysite-reqs
    Function: pip.installed
      Result: False
     Comment: Unable to process requirements file /opt/django/mysite/requirements/production.txt. Error: Ignoring indexes: https://pypi.python.org/simple/
              Could not open requirements file: [Errno 2] No such file or directory: '/tmp/requirements.txt'
              Storing debug log for failure in /home/mysite/.pip/pip.log

但这不是我传递给需求的路径。这看起来有点像一个错误,可能/tmp/requirements.txt是硬编码的,因为它希望我使用salt://URL 而不是本地文件路径。

难道我做错了什么?这是一个错误,有没有解决它的好方法?

4

1 回答 1

4

这是我使用 Saltstack 和 Python 的第一天,我在谷歌上搜索环境配置帮助,并在搜索结果中遇到了你的问题。

我单击的下一个搜索结果包含与您相同的错误,并表明这是由 SaltStack 将环境移动到 /tmp 以进行 chowning 引起的。

解决方案是将以下内容添加到您的盐状态:

no_chown: True

希望能帮助到你。

于 2014-04-14T16:14:19.000 回答