我想使用CHEF在AIX系统上解压缩/取消tar文件。 我做的步骤: 1.我使用Winscp在AIX系统上上传了一个zip文件Test.zip。 2.使用以下命令编辑default.rb: 执行" extract_Test_tar"做 命令" tar -xvf Test.zip" cwd" / var / chef / cookbooks" 结束 3.上传我的食谱时,它给了我以下错误:
配方:Infy_Patrol :: default *执行[extract_Test_tar]动作运行
================================================================================
Error executing action `run` on resource 'execute[extract_Test_tar]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of tar -xvf Test.zip ----
STDOUT:
STDERR: tar: tape blocksize error
---- End output of tar -xvf Test.zip ----
Ran tar -xvf Test.zip returned 1
Resource Declaration:
---------------------
# In /.chef/local-mode-cache/cache/cookbooks/Infy_Patrol/recipes/default.rb
10: execute "extract_Test_tar" do
11: command "tar -xvf Test.zip"
12: cwd "/var/chef/cookbooks"
13: end
Compiled Resource:
------------------
# Declared in /.chef/local-mode-cache/cache/cookbooks/Infy_Patrol/recipes/default.rb:10:in `from_file'
execute("extract_Test_tar") do
action [:run]
retries 0
retry_delay 2
default_guard_interpreter :execute
command "tar -xvf Test.zip"
backup 5
cwd "/var/chef/cookbooks"
returns 0
declared_type :execute
cookbook_name "Infy_Patrol"
recipe_name "default"
end
运行处理程序: [2016-01-29T06:27:47-06:00]错误:运行异常处理程序 运行处理程序完成 [2016-01-29T06:27:47-06:00]错误:异常处理程序完成 厨师客户失败了。 0资源在05秒内更新 [2016-01-29T06:27:47-06:00]致命:Stacktrace转储到/.chef/local-mode-cache/cache/chef-stacktrace.out [2016-01-29T06:27:47-06:00]致命:如果您提交错误报告,请提供stacktrace.out文件的内容 [2016-01-29T06:27:47-06:00]错误:执行[extract_Test_tar](Infy_Patrol ::默认行10)有错误:Mixlib :: ShellOut :: ShellCommandFailed:用[0]退出的预期进程,但收到了' 1'
答案 0 :(得分:-1)
回复我的问题。
以下是我遵循的步骤: 1.登录到我的AIX机器.2。登录到Winscp。 3.使用:烹饪书创建测试 4.使用winscp我去了我的食谱保存的路径: / var / chef / cookbooks / Test 5.Opened recipes文件夹:并编辑default.rb给出:
#
# Cookbook Name:: Infy_Patrol
# Recipe:: default
#
# Copyright 2016, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
tar_extract '/var/chef/cookbooks/Test.zip' do
action :extract_local
target_dir '/var/chef/cookbooks'
creates '/var/chef/cookbooks/new'
end
#Also tried the following piece of code
#execute "extract files" do
#command "tar xvf Test.tar.gz -C /var/chef/cookbooks"
#end
6.uploaded cookbook using :
chef-client -z -r Test::default
BUT IT IS GIVING ME AN ERROR :
Error executing action `run` on resource 'execute[extract_Test_tar]