Chef :: Исключения :: FileNotFound: template [/ var / www/html/index.html] - PullRequest
0 голосов
/ 25 апреля 2020

Я новичок в шеф-поваре, я не мог понять, в чем проблема. Ниже приведен мой скрипт по умолчанию

apt_update 'Update the apt cache daily' do
  frequency 86_400
  action :periodic
end

package 'apache2'

service 'apache2' do
  supports status: true
  action [:enable, :start]
end

template '/var/www/html/index.html' do
  source 'index.html.erb'
end

Это ошибка, которую я получаю

[2020-04-25T12:57:00+00:00] FATAL: Stacktrace dumped to /home/vagrant/.chef/local-mode-cache/cache/chef-stacktrace.out
[2020-04-25T12:57:00+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2020-04-25T12:57:00+00:00] FATAL: Chef::Exceptions::FileNotFound: template[/var/www/html/index.html] (learn_chef_apache2::default line 18) had an error: Chef::Exceptions::FileNotFound: Cookbook 'learn_chef_apache2' (0.1.0) does not contain a file at any of these locations:
  templates/host-vagrant.vm/index.html.erb
  templates/ubuntu-18.04/index.html.erb
  templates/ubuntu/index.html.erb
  templates/default/index.html.erb
  templates/index.html.erb

и это мое дерево поваренных книг

cookbooks
├── learn_chef_apache2
│   ├── Berksfile
│   ├── CHANGELOG.md
│   ├── chefignore
│   ├── LICENSE
│   ├── metadata.rb
│   ├── README.md
│   ├── recipes
│   │   └── default.rb
│   ├── spec
│   │   ├── spec_helper.rb
│   │   └── unit
│   │       └── recipes
│   │           └── default_spec.rb
│   └── test
│       └── integration
│           └── default
│               └── default_test.rb
├── learn_chef_appache2
│   └── templates
│       ├── default
│       └── index.html.erb
└── templates
    └── index.html.erb

Может кто-нибудь, пожалуйста, помогите мне, что я делаю неправильно, и было бы здорово, если вы можете поделиться ссылкой или объяснить это для моего понимания.

1 Ответ

0 голосов
/ 25 апреля 2020

что я сделал неправильно, так это то, что мой шаблон был создан вне learn_chef_apache2, тогда как он должен быть внутри, как показано ниже

cookbooks
└── learn_chef_apache2
    ├── Berksfile
    ├── CHANGELOG.md
    ├── chefignore
    ├── index.html.erb
    ├── LICENSE
    ├── metadata.rb
    ├── README.md
    ├── recipes
    │   └── default.rb
    ├── spec
    │   ├── spec_helper.rb
    │   └── unit
    │       └── recipes
    │           └── default_spec.rb
    ├── templates
    │   └── index.html.erb
    └── test
        └── integration
            └── default
                └── default_test.rb
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...