Puppet,cp:不能统计`/ tmp / kitchen / hiera / *':没有这样的文件或目录

时间:2017-06-26 21:32:24

标签: vagrant puppet test-kitchen

我正在尝试使用kitchen-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

问题可能在于我通过bundler(版本1.14.6)运行此版本,并且我还将我的puppet版本设置为与指南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

如何调试此问题?

1 个答案:

答案 0 :(得分:0)

所以问题是由于缺少hieradata文件结构引起的。这个例子是一个很大的帮助,并详细说明了一个完整的厨房 - 木偶文件结构:

https://github.com/neillturner/puppet_vagrant_repo

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

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

然后更改.kitchen.yml中的配置程序以指定此路径:

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