无法加载此类文件 - chef / mixin / command

时间:2017-11-30 06:25:12

标签: chef

您好我正在尝试使用chef daemontool cookbook重新启动Web服务器。但是当我尝试在我的本地或码头工具中部署它时,我收到以下错误。

无法加载此类文件 - chef / mixin / command

我确实尝试过在开源社区搜索相同但到目前为止没有运气。下面是堆栈跟踪。 堆栈跟踪:

Chef: 13.5.3
root@xyz:~/chef-repo/cookbooks/app# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04 LTS
Release:    16.04
Codename:   xenial

root@xyz:~/chef-repo/cookbooks/app# docker build -t app .
Sending build context to Docker daemon 115.2kB
Step 1/4 : FROM zuazo/chef-local:debian-7
---> 8f87bff9cf1b
Step 2/4 : COPY . /tmp/app
---> Using cache
---> 6c12ba0aa8da
Step 3/4 : RUN berks vendor -b /tmp/app/Berksfile $COOKBOOK_PATH
---> Using cache
---> 0eeeb94403e6

Step 4/4 : RUN chef-client -r "recipe[apt],recipe[app::steup.rb],recipe[daemontools],recipe[app::deploy.rb]"
---> Running in 5e3de78d56db
Starting Chef Client, version 13.4.19
resolving cookbooks for run list: ["apt", "app::steup.rb", "daemontools", "app::deploy.rb"]
Synchronizing Cookbooks:

- apt (6.1.4)
- app (0.1.0)
- daemontools (1.5.0)
- application (5.2.0)
- poise-python (1.6.0)
- build-essential (8.0.3)
- pacman (1.1.1)
- poise (2.8.1)
- poise-service (1.5.2)
- poise-languages (2.1.1)
- seven_zip (2.0.2)
- mingw (2.0.1)
- poise-archive (1.5.0)
- windows (3.2.0)
- ohai (5.2.0)
Installing Cookbook Gems:
Compiling Cookbooks...

================================================================================

Recipe Compile Error in /etc/chef/local-mode-cache/cache/cookbooks/daemontools/providers/service.rb

================================================================================

LoadError
---------
cannot load such file -- chef/mixin/command
Cookbook Trace:
---------------
/etc/chef/local-mode-cache/cache/cookbooks/daemontools/providers/service.rb:20:in `class_from_file'
Relevant File Content:
----------------------
/etc/chef/local-mode-cache/cache/cookbooks/daemontools/providers/service.rb:
13: # Unless required by applicable law or agreed to in writing, software
14: # distributed under the License is distributed on an "AS IS" BASIS,
15: # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16: # See the License for the specific language governing permissions and
17: # limitations under the License.
18: #
19:
20>> require 'chef/mixin/command'
21: require 'chef/mixin/language'
22: include Chef::Mixin::Command
23:
24: def load_current_resource
25: @svc = Chef::Resource::DaemontoolsService.new(new_resource.name)
26: @svc.service_name(new_resource.service_name)
27:
28: Chef::Log.debug("Checking status of service #{new_resource.service_name}")
29:
System Info:
------------
chef_version=13.4.19
platform=debian
platform_version=7.11
ruby=ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
program_name=chef-client worker: ppid=7;start=06:05:22;
executable=/opt/chefdk/bin/chef-client
Running handlers:
[2017-11-30T06:05:24+00:00] ERROR: Running exception handlers
Running handlers complete
[2017-11-30T06:05:24+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 02 seconds
[2017-11-30T06:05:24+00:00] FATAL: Stacktrace dumped to /etc/chef/local-mode-cache/cache/chef-stacktrace.out
[2017-11-30T06:05:24+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-11-30T06:05:24+00:00] ERROR: cannot load such file -- chef/mixin/command
[2017-11-30T06:05:24+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
The command '/bin/sh -c chef-client -r "recipe[apt],recipe[app::steup.rb],recipe[daemontools],recipe[app::deploy.rb]"' returned a non-zero code: 1

1 个答案:

答案 0 :(得分:1)

这在评论中得到了回答,但重复回答:菜谱与您正在使用的Chef版本不兼容。经过多年的弃用后,mixin被删除,转而使用Chef :: Mixin :: ShellOut。

不相关:如果你想使用Chef来构建docker镜像(并且实际上可能没有,它会产生非常低效的图像),请使用Packer而不是docker build