Ansible kitchen 测试无法在 debian 上执行 source 命令

Ansible kitchen test fails executing source command on debian

我为 python 编写了一个 ansible 剧本角色,并尝试使用 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 命令。我该如何缓解这个问题?

你能把电话号码从 source 改成 . 吗?这应该适用于 bashsh