【问题标题】:Puppet, cp: cannot stat `/tmp/kitchen/hiera/*': No such file or directoryPuppet,cp:无法统计`/tmp/kitchen/hiera/*':没有这样的文件或目录
【发布时间】:2017-11-29 20:12:39
【问题描述】:

我正在尝试使用 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)运行它,并且我还将我的 puppet 版本设置为与指南 gem "puppet", "~&gt; 4.10.4" 相同的版本,以解决图书馆员-puppet 问题。这是我的收敛的完整输出:

$ 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

如何调试这个问题?

【问题讨论】:

  • 删除 Chef 标签,因为这似乎不涉及 Chef。
  • 你必须提供更多信息,至少.kitchen.yml
  • 添加了关于使用 puppet-kitchen 的基本指南的信息(列出了我采取的所有步骤),这导致了同样的问题。

标签: vagrant puppet test-kitchen


【解决方案1】:

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

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

这是我的新.kitchen.ymlthe guide I mentioned 中的示例:

---
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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-07-06
    • 2021-12-27
    • 2016-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-09-30
    • 2018-02-10
    相关资源
    最近更新 更多