Ansible厨房测试无法在debian上执行源命令

时间:2015-10-12 21:25:35

标签: python rspec ansible ansible-playbook test-kitchen

我为python编写了一个ansible playbook角色,并尝试使用Serverspec / RSpec进行厨房测试。以下测试确保我是否能够激活virtualenv。这在CentOS上运行正常,但在Debian-Ubuntu上测试失败并出现错误(检查代码块下方)

  describe command("source #{jenkins_home}/virtualenv/#{version}/bin/activate") do
    its(:exit_status) { should eq 0 }
  end

错误:

 6) Command "source /home/jenkins/virtualenv/pypy3/bin/activate" exit_status should eq 0
    Failure/Error: its(:exit_status) { should eq 0 }

      expected: 0
           got: 127

      (compared using ==)
      /bin/sh -c source\ /home/jenkins/virtualenv/pypy3/bin/activate

    # /tmp/verifier/suites/serverspec/python_spec.rb:22:in `block (3 levels) in <top (required)>'

我的假设

它试图从 / bin / sh 运行,它基本上无法运行 source 命令。我该如何缓解这个问题?

1 个答案:

答案 0 :(得分:2)

您可以将来电从source更改为.吗?这应该适用于bashsh