Puppet, cp: cannot stat `/tmp/kitchen/hiera/*': 没有那个文件或目录

Puppet, cp: cannot stat `/tmp/kitchen/hiera/*': No such file or directory

我正在尝试使用 kitchen-puppet 创建 Puppet 部署。

这是我的厨房文件的样子:

---
driver:
  name: vagrant

provisioner:
  name: puppet_apply
  manifests_path: /repository/puppet_repo/manifests
  modules_path: /repository/puppet_repo/modules-mycompany
  hiera_data_path: /repository/puppet_repo/hieradata

platforms:
- name: centos-6.8
- name: centos-7.2
- name: debian-7.8
- name: ubuntu-12.04
- name: ubuntu-14.04
- name: ubuntu-16.04

suites:
  - name: default

当我尝试使用它时,我收到以下错误消息:

$ bundle exec kitchen converge default-centos-68 
-----> Starting Kitchen (v1.16.0)
-----> Converging <default-centos-68>...
       Preparing files for transfer
       Preparing modules
       Nothing to do for modules
       Preparing manifests
       Preparing files
       nothing to do for files
       Preparing hiera data
       Finished Preparing files for transfer
       Installing puppet from yum on centos
       Install busser on centos
       Transferring files to <default-centos-68>
       cp: cannot stat `/tmp/kitchen/hiera/*': No such file or directory
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Converge failed on instance <default-centos-68>.  Please see .kitchen/logs/default-centos-68.log for more details
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

我在使用 the readme for kitchen-puppet.

上列出的指南时遇到了同样的问题

每当我尝试 运行 kitchen converge 时,我都会继续收到错误消息:

cp: cannot stat `/tmp/kitchen/hiera/*': No such file or directory

问题可能是我 运行 正在使用这个捆绑器(版本 1.14.6)并且我还将我的人偶版本设置为与指南 gem "puppet", "~> 4.10.4" 相同的版本以绕过图书管理员-木偶问题。这是我的收敛的完整输出:

$ bundle exec kitchen converge
-----> Starting Kitchen (v1.16.0)
-----> Converging <default-nocm-ubuntu-1204>...
       Preparing files for transfer
       Preparing modules
       Resolving module dependencies with Librarian-Puppet 2.2.3...
       Preparing manifests
       Preparing files
       nothing to do for files
       Preparing hiera data
       Finished Preparing files for transfer
       Installing puppet, will try to determine platform os
       Install busser on nocm_ubuntu
       Transferring files to <default-nocm-ubuntu-1204>
       cp: cannot stat `/tmp/kitchen/hiera/*': No such file or directory
-----> Converging <default-centos-65>...
       Preparing files for transfer
       Preparing modules
       Resolving module dependencies with Librarian-Puppet 2.2.3...
       Preparing manifests
       Preparing files
       nothing to do for files
       Preparing hiera data
       Finished Preparing files for transfer
       Installing puppet from yum on centos
       Install busser on centos
       Transferring files to <default-centos-65>
       cp: cannot stat `/tmp/kitchen/hiera/*': No such file or directory
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 2 actions failed.
>>>>>>     Converge failed on instance <default-nocm-ubuntu-1204>.  Please see .kitchen/logs/default-nocm-ubuntu-1204.log for more details
>>>>>>     Converge failed on instance <default-centos-65>.  Please see .kitchen/logs/default-centos-65.log for more details
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

如何调试这个问题?

所以问题是由缺少 hieradata 文件结构引起的。这个例子很有帮助,详细介绍了完整的 kitchen-puppet 文件结构:

https://github.com/neillturner/puppet_vagrant_repo

在我的项目的主目录中,我需要创建以下空文件:

hieradata/
├── common.yaml
└── roles
    └── default.yaml

然后在 .kitchen.yml 中更改 provisioner 以指定此路径:

provisioner:
  name: puppet_apply
  manifests_path: manifests
  modules_path: modules
  hiera_data_path: hieradata

最后我需要在我的所有平台上设置 driver_plugin: vagrant

这是我在 the guide I mentioned 中的示例的新 .kitchen.yml

---
driver:
  name: vagrant

provisioner:
  name: puppet_apply
  manifests_path: manifests
  modules_path: modules
  hiera_data_path: hieradata

platforms:
  - name: nocm_ubuntu-12.04
    driver_plugin: vagrant
    driver_config:
      box: nocm_ubuntu-12.04
      box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
  - name: centos-6.5
    driver_plugin: vagrant
    driver_config:
      box: nocm_centos-6.5
      box_url: http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box

suites:
  - name: default
    manifest: site.pp