【问题标题】:Pip install of a specific git commit failing via Ansible Playbook通过 Ansible Playbook 安装特定 git 提交失败
【发布时间】:2017-05-29 08:46:39
【问题描述】:

在这个例子中,Django-cities 失败了。

- hosts: localhost
  tasks:
   - name: Install Django
     pip: name=Django
   - name: Install Userena
     pip: name=django-userena
   - name: Install Django Messages
     pip: name=https://github.com/arneb/django-messages/archive/master.zip
   - name: Install Django Cities
     pip: name=git+https://github.com/coderholic/django-cities.git@d0163f393e7557914b3f2c6882e740537ca63fd6

错误:

TASK [Install Django Cities] ***************************************************
fatal: [localhost]: FAILED! => {"changed": false, "cmd": "/usr/bin/pip2 install -e git+https://github.com/coderholic/django-cities.git@d0163f393e7557914b3f2c6882e740537ca63fd6", 
"failed": true, "msg": "\n:stderr: --editable=git+https://github.com/coderholic/django-cities.git@d0163f393e7557914b3f2c6882e740537ca63fd6 is not the right format; it must have #egg=Package\nYou are using pip version 8.1.2, however version 9.0.1 is available.\nYou should consider upgrading via the 'pip install --upgrade pip' command.\n"}
    to retry, use: --limit @/root/cannablr/ansible/playbooks/installdjango.retry

Ansible 中不允许通过 pip 安装 git 提交吗?

【问题讨论】:

    标签: git pip ansible


    【解决方案1】:

    如果你在命令行上运行,你会得到同样的错误:

    $ pip install -e git+https://github.com/coderholic/django-cities.git@d0163f393e7557914b3f2c6882e740537ca63fd6
    --editable=git+https://github.com/coderholic/django-cities.git@d0163f393e7557914b3f2c6882e740537ca63fd6 is not the right format; it must have #egg=Package
    

    您可以在其中添加#egg=packagename,它会起作用:

    $ pip install -e git+https://github.com/coderholic/django-cities.git@d0163f393e7557914b3f2c6882e740537ca63fd6#egg=django-cities
    Obtaining django-cities from git+https://github.com/coderholic/django-cities.git@d0163f393e7557914b3f2c6882e740537ca63fd6#egg=django-cities
      Cloning https://github.com/coderholic/django-cities.git (to d0163f393e7557914b3f2c6882e740537ca63fd6) to src/django-cities
    

    所以只需将#egg=django-cities 添加到 Ansible 中的 URL 即可。

    请注意,我建议您引用您的 git+https://....#egg=xyz yaml。里面有很多魔法人物。

    【讨论】:

      猜你喜欢
      • 2020-03-28
      • 2022-08-23
      • 1970-01-01
      • 1970-01-01
      • 2017-09-29
      • 2013-05-02
      • 2022-06-29
      • 2019-07-12
      • 1970-01-01
      相关资源
      最近更新 更多