代码之家  ›  专栏  ›  技术社区  ›  zabumba

对资源“包[pgdg-centos93]”执行操作“安装”时出错

  •  0
  • zabumba  · 技术社区  · 10 年前

    环境

    • 厨师
    • CentOS系统
    • PostGres公司
    • 栏杆

    亚马逊云服务器

    $ cat /etc/redhat-release 
    CentOS release 6.7 (Final)
    
    $ uname -a
    Linux ip-10-0-0-250 2.6.32-504.8.1.el6.x86_64 #1 SMP Wed Jan 28 21:11:36 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
    

    将一个Amazon CentOS实例休眠几个月,并于今天再次启动。要使一切都更新,“魔力”应该发生( 修辞 )与 sudo chef-client ,至少这是预期的。根据我目前的经验, 厨师 给我的项目带来的开销几乎超过了时间上的收益。(注意:这是与个人经历相关的旁注。)

    这是我最近的头疼

    Recipe: postgresql::yum_pgdg_postgresql
      * remote_file[/var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm] action create (up to date)
      * package[pgdg-centos93] action install
    ================================================================================
    Error executing action `install` on resource 'package[pgdg-centos93]'
    ================================================================================
    
    
    Chef::Exceptions::Exec
    ----------------------
    rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm returned 2, expected 0
    
    
    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/postgresql/recipes/yum_pgdg_postgresql.rb
    
     43: package repo_rpm_package do
     44:   provider Chef::Provider::Package::Rpm
     45:   source "#{Chef::Config[:file_cache_path]}/#{repo_rpm_filename}"
     46:   action :install
     47: end
    
    
    
    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/postgresql/recipes/yum_pgdg_postgresql.rb:43:in `from_file'
    
    package("pgdg-centos93") do
      provider Chef::Provider::Package::Rpm
      action [:install]
      retries 0
      retry_delay 2
      guard_interpreter :default
      package_name "pgdg-centos93"
      source "/var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm"
      version "9.3-1"
      cookbook_name "postgresql"
      recipe_name "yum_pgdg_postgresql"
    end
    
    
    
    
    Running handlers:
    [2016-02-02T12:34:02+00:00] ERROR: Running exception handlers
    Running handlers complete
    
    [2016-02-02T12:34:02+00:00] ERROR: Exception handlers complete
    [2016-02-02T12:34:02+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
    Chef Client failed. 8 resources updated in 42.119165396 seconds
    [2016-02-02T12:34:03+00:00] ERROR: package[pgdg-centos93] (postgresql::yum_pgdg_postgresql line 43) had an error: Chef::Exceptions::Exec: rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm returned 2, expected 0
    [2016-02-02T12:34:03+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
    

    任何指针都是最受欢迎的。我只是无法理解错误

    更新

    按照建议

    $ sudo rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm
    [sudo] password for ed: 
        package pgdg-centos93-9.3-2.noarch (which is newer than pgdg-centos93-9.3-1.noarch) is already installed
    

    在调试模式下运行Chef

      * package[pgdg-centos93] action install[2016-02-02T14:05:16+00:00] INFO: Processing package[pgdg-centos93] action install (postgresql::yum_pgdg_postgresql line 43)
    [2016-02-02T14:05:16+00:00] DEBUG: package[pgdg-centos93] checking rpm status
    [2016-02-02T14:05:17+00:00] DEBUG: package[pgdg-centos93] checking install state
    [2016-02-02T14:05:17+00:00] DEBUG: package[pgdg-centos93] current version is 9.3-2
    [2016-02-02T14:05:17+00:00] DEBUG: Executing rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm
    [2016-02-02T14:05:17+00:00] DEBUG: ---- Begin output of rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm ----
    [2016-02-02T14:05:17+00:00] DEBUG: STDOUT: 
    [2016-02-02T14:05:17+00:00] DEBUG: STDERR:  package pgdg-centos93-9.3-2.noarch (which is newer than pgdg-centos93-9.3-1.noarch) is already installed
    [2016-02-02T14:05:17+00:00] DEBUG: ---- End output of rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm ----
    [2016-02-02T14:05:17+00:00] DEBUG: Ran rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm returned 2
    
    ================================================================================
    Error executing action `install` on resource 'package[pgdg-centos93]'
    ================================================================================
    
    
    Chef::Exceptions::Exec
    ----------------------
    rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm returned 2, expected 0
    ---- Begin output of rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm ----
    STDOUT: STDERR:     package pgdg-centos93-9.3-2.noarch (which is newer than pgdg-centos93-9.3-1.noarch) is already installed
    ---- End output of rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm ----
    
    
    
    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/postgresql/recipes/yum_pgdg_postgresql.rb
    
     43: package repo_rpm_package do
     44:   provider Chef::Provider::Package::Rpm
     45:   source "#{Chef::Config[:file_cache_path]}/#{repo_rpm_filename}"
     46:   action :install
     47: end
    
    
    
    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/postgresql/recipes/yum_pgdg_postgresql.rb:43:in `from_file'
    
    package("pgdg-centos93") do
      provider Chef::Provider::Package::Rpm
      action [:install]
      retries 0
      retry_delay 2
      guard_interpreter :default
      package_name "pgdg-centos93"
      source "/var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm"
      version "9.3-1"
      cookbook_name "postgresql"
      recipe_name "yum_pgdg_postgresql"
    end
    
    
    
    [2016-02-02T14:05:17+00:00] INFO: Running queued delayed notifications before re-raising exception
    [2016-02-02T14:05:17+00:00] DEBUG: Re-raising exception: Chef::Exceptions::Exec - package[pgdg-centos93] (postgresql::yum_pgdg_postgresql line 43) had an error: Chef::Exceptions::Exec: rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm returned 2, expected 0
    ---- Begin output of rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm ----
    STDOUT: STDERR:     package pgdg-centos93-9.3-2.noarch (which is newer than pgdg-centos93-9.3-1.noarch) is already installed
    ---- End output of rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm ----
    
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/mixin/command.rb:158:in `handle_command_failures'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/mixin/command.rb:104:in `run_command_and_return_stdout_stderr'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/mixin/command.rb:79:in `run_command'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/mixin/command.rb:171:in `run_command_with_systems_locale'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/provider/package/rpm.rb:98:in `install_package'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/provider/package.rb:82:in `block in action_install'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/mixin/why_run.rb:52:in `call'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/mixin/why_run.rb:52:in `add_action'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/provider.rb:155:in `converge_by'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/provider/package.rb:80:in `action_install'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/provider.rb:120:in `run_action'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource.rb:637:in `run_action'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/runner.rb:49:in `run_action'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/runner.rb:81:in `block (2 levels) in converge'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/runner.rb:81:in `each'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/runner.rb:81:in `block in converge'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource_collection.rb:98:in `block in execute_each_resource'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource_collection.rb:96:in `execute_each_resource'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/runner.rb:80:in `converge'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/client.rb:345:in `converge'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/client.rb:431:in `do_run'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/client.rb:213:in `block in run'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/client.rb:207:in `fork'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/client.rb:207:in `run'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/application.rb:217:in `run_chef_client'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/application/client.rb:328:in `block in run_application'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/application/client.rb:317:in `loop'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/application/client.rb:317:in `run_application'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/application.rb:67:in `run'
      /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/bin/chef-client:26:in `<top (required)>'
      /usr/bin/chef-client:23:in `load'
      /usr/bin/chef-client:23:in `<main>'
    
    Running handlers:
    [2016-02-02T14:05:17+00:00] ERROR: Running exception handlers
    Running handlers complete
    
    [2016-02-02T14:05:17+00:00] ERROR: Exception handlers complete
    [2016-02-02T14:05:17+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
    [2016-02-02T14:05:17+00:00] DEBUG: Chef::Exceptions::Exec: package[pgdg-centos93] (postgresql::yum_pgdg_postgresql line 43) had an error: Chef::Exceptions::Exec: rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm returned 2, expected 0
    ---- Begin output of rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm ----
    STDOUT: STDERR:     package pgdg-centos93-9.3-2.noarch (which is newer than pgdg-centos93-9.3-1.noarch) is already installed
    ---- End output of rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm ----
    
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/mixin/command.rb:158:in `handle_command_failures'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/mixin/command.rb:104:in `run_command_and_return_stdout_stderr'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/mixin/command.rb:79:in `run_command'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/mixin/command.rb:171:in `run_command_with_systems_locale'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/provider/package/rpm.rb:98:in `install_package'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/provider/package.rb:82:in `block in action_install'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/mixin/why_run.rb:52:in `call'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/mixin/why_run.rb:52:in `add_action'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/provider.rb:155:in `converge_by'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/provider/package.rb:80:in `action_install'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/provider.rb:120:in `run_action'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource.rb:637:in `run_action'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/runner.rb:49:in `run_action'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/runner.rb:81:in `block (2 levels) in converge'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/runner.rb:81:in `each'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/runner.rb:81:in `block in converge'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource_collection.rb:98:in `block in execute_each_resource'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource_collection.rb:96:in `execute_each_resource'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/runner.rb:80:in `converge'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/client.rb:345:in `converge'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/client.rb:431:in `do_run'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/client.rb:213:in `block in run'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/client.rb:207:in `fork'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/client.rb:207:in `run'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/application.rb:217:in `run_chef_client'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/application/client.rb:328:in `block in run_application'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/application/client.rb:317:in `loop'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/application/client.rb:317:in `run_application'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/application.rb:67:in `run'
    /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/bin/chef-client:26:in `<top (required)>'
    /usr/bin/chef-client:23:in `load'
    /usr/bin/chef-client:23:in `<main>'
    Chef Client failed. 8 resources updated in 42.825243439 seconds
    [2016-02-02T14:05:17+00:00] INFO: Sending resource update report (run-id: ac041d25-eba7-4865-a20a-d16ffa60acef)
    [2016-02-02T14:05:17+00:00] DEBUG: {"action"=>"end", "resources"=>[{"type"=>"ruby_block", "name"=>"run-iptables-resources-early", "id"=>"run-iptables-resources-early", "after"=>{}, "before"=>{}, "duration"=>"16183", "delta"=>"", "result"=>"run", "cookbook_name"=>"simple_iptables", "cookbook_version"=>"0.6.0"}, {"type"=>"package", "name"=>"pgdg-centos93", "id"=>"pgdg-centos93", "after"=>{:version=>"9.3-1", :options=>nil}, "before"=>{:version=>"9.3-2", :options=>nil}, "duration"=>"961", "delta"=>"", "result"=>"install", "cookbook_name"=>"postgresql", "cookbook_version"=>"3.4.0"}], "status"=>"failure", "run_list"=>"[\"role[website]\"]", "total_res_count"=>"27", "data"=>{"exception"=>{"class"=>"#<Chef::Exceptions::Exec: package[pgdg-centos93] (postgresql::yum_pgdg_postgresql line 43) had an error: Chef::Exceptions::Exec: rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm returned 2, expected 0\n---- Begin output of rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm ----\nSTDOUT: STDERR: \tpackage pgdg-centos93-9.3-2.noarch (which is newer than pgdg-centos93-9.3-1.noarch) is already installed\n---- End output of rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm ----\n>", "message"=>"package[pgdg-centos93] (postgresql::yum_pgdg_postgresql line 43) had an error: Chef::Exceptions::Exec: rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm returned 2, expected 0\n---- Begin output of rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm ----\nSTDOUT: STDERR: \tpackage pgdg-centos93-9.3-2.noarch (which is newer than pgdg-centos93-9.3-1.noarch) is already installed\n---- End output of rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm ----\n", "backtrace"=>"[\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/mixin/command.rb:158:in `handle_command_failures'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/mixin/command.rb:104:in `run_command_and_return_stdout_stderr'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/mixin/command.rb:79:in `run_command'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/mixin/command.rb:171:in `run_command_with_systems_locale'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/provider/package/rpm.rb:98:in `install_package'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/provider/package.rb:82:in `block in action_install'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/mixin/why_run.rb:52:in `call'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/mixin/why_run.rb:52:in `add_action'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/provider.rb:155:in `converge_by'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/provider/package.rb:80:in `action_install'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/provider.rb:120:in `run_action'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource.rb:637:in `run_action'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/runner.rb:49:in `run_action'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/runner.rb:81:in `block (2 levels) in converge'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/runner.rb:81:in `each'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/runner.rb:81:in `block in converge'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource_collection.rb:98:in `block in execute_each_resource'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/resource_collection.rb:96:in `execute_each_resource'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/runner.rb:80:in `converge'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/client.rb:345:in `converge'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/client.rb:431:in `do_run'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/client.rb:213:in `block in run'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/client.rb:207:in `fork'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/client.rb:207:in `run'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/application.rb:217:in `run_chef_client'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/application/client.rb:328:in `block in run_application'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/application/client.rb:317:in `loop'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/application/client.rb:317:in `run_application'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/application.rb:67:in `run'\",\"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/bin/chef-client:26:in `<top (required)>'\",\"/usr/bin/chef-client:23:in `load'\",\"/usr/bin/chef-client:23:in `<main>'\"]", "description"=>{"title"=>"Error executing action `install` on resource 'package[pgdg-centos93]'", "sections"=>[{"Chef::Exceptions::Exec"=>"rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm returned 2, expected 0\n---- Begin output of rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm ----\nSTDOUT: STDERR: \tpackage pgdg-centos93-9.3-2.noarch (which is newer than pgdg-centos93-9.3-1.noarch) is already installed\n---- End output of rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm ----\n"}, {"Resource Declaration:"=>"# In /var/chef/cache/cookbooks/postgresql/recipes/yum_pgdg_postgresql.rb\n\n 43: package repo_rpm_package do\n 44:   provider Chef::Provider::Package::Rpm\n 45:   source \"\#{Chef::Config[:file_cache_path]}/\#{repo_rpm_filename}\"\n 46:   action :install\n 47: end\n"}, {"Compiled Resource:"=>"# Declared in /var/chef/cache/cookbooks/postgresql/recipes/yum_pgdg_postgresql.rb:43:in `from_file'\n\npackage(\"pgdg-centos93\") do\n  provider Chef::Provider::Package::Rpm\n  action [:install]\n  retries 0\n  retry_delay 2\n  guard_interpreter :default\n  package_name \"pgdg-centos93\"\n  source \"/var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm\"\n  version \"9.3-1\"\n  cookbook_name \"postgresql\"\n  recipe_name \"yum_pgdg_postgresql\"\nend\n"}]}}}, "start_time"=>"2016-02-02 14:04:41 +0000", "end_time"=>"2016-02-02 14:05:17 +0000"}
    [2016-02-02T14:05:17+00:00] DEBUG: Sending compressed run data...
    [2016-02-02T14:05:17+00:00] DEBUG: Signing the request as ec2-production-web
    [2016-02-02T14:05:17+00:00] DEBUG: String to sign: 'Method:POST
    Hashed Path:ZNfsXWm0ScG9Y7tct4xU2t8Ruc4=
    X-Ops-Content-Hash:JebmaJ0FR9SKdg1Whn6EXf9AjeY=
    X-Ops-Timestamp:2016-02-02T14:05:17Z
    X-Ops-UserId:ec2-production-web'
    Header hash: {"X-Ops-Sign"=>"algorithm=sha1;version=1.0;", "X-Ops-Userid"=>"ec2-production-web", "X-Ops-Timestamp"=>"2016-02-02T14:05:17Z", "X-Ops-Content-Hash"=>"JebmaJ0FR9SKdg1Whn6EXf9AjeY=", "X-Ops-Authorization-1"=>"i25tlVgWl76JsqbNZFU9HKNBWbeIUUdOOIkInmsgw4cPI8zctpzNRZi9e5JF", "X-Ops-Authorization-2"=>"flygf7pnwtIH0UFpUJSukmHAklqGL2pQlMy3oRoSxQhzvYTW+njD4SznjEY/", "X-Ops-Authorization-3"=>"Cf0nkNUkf0mlch5oTiU9PD6md/irpT0IIv+fYCBS1HRoYpbiJVWuYqHchgOo", "X-Ops-Authorization-4"=>"Ir0DnFtZ4SFucPATkHWQMxx/c1tAY1sSoQZv02kceDJVPuMAarRI8gKzOQ6+", "X-Ops-Authorization-5"=>"Z6TBmJWXVqdRU4CAvjihr87hVadAYQQZURuQCEwsnxFUnxDZkrz1jDV+PnhQ", "X-Ops-Authorization-6"=>"uXPPOgdI5DuF45RvJfoFO8AvTkg+QCEwkqwCAY+e3w=="}
    [2016-02-02T14:05:17+00:00] DEBUG: Initiating POST to https://api.opscode.com/organizations/[filtered]/reports/nodes/ec2-production-web/runs/ac041d25-eba7-4865-a20a-d16ffa60acef
    [2016-02-02T14:05:17+00:00] DEBUG: ---- HTTP Request Header Data: ----
    [2016-02-02T14:05:17+00:00] DEBUG: X-Ops-Reporting-Protocol-Version: 0.1.0
    [2016-02-02T14:05:17+00:00] DEBUG: Content-Encoding: gzip
    [2016-02-02T14:05:17+00:00] DEBUG: X-OPS-SIGN: algorithm=sha1;version=1.0;
    [2016-02-02T14:05:17+00:00] DEBUG: X-OPS-USERID: ec2-production-web
    [2016-02-02T14:05:17+00:00] DEBUG: X-OPS-TIMESTAMP: 2016-02-02T14:05:17Z
    [2016-02-02T14:05:17+00:00] DEBUG: X-OPS-CONTENT-HASH: JebmaJ0FR9SKdg1Whn6EXf9AjeY=
    [2016-02-02T14:05:17+00:00] DEBUG: X-OPS-AUTHORIZATION-1: i25tlVgWl76JsqbNZFU9HKNBWbeIUUdOOIkInmsgw4cPI8zctpzNRZi9e5JF
    [2016-02-02T14:05:17+00:00] DEBUG: X-OPS-AUTHORIZATION-2: flygf7pnwtIH0UFpUJSukmHAklqGL2pQlMy3oRoSxQhzvYTW+njD4SznjEY/
    [2016-02-02T14:05:17+00:00] DEBUG: X-OPS-AUTHORIZATION-3: Cf0nkNUkf0mlch5oTiU9PD6md/irpT0IIv+fYCBS1HRoYpbiJVWuYqHchgOo
    [2016-02-02T14:05:17+00:00] DEBUG: X-OPS-AUTHORIZATION-4: Ir0DnFtZ4SFucPATkHWQMxx/c1tAY1sSoQZv02kceDJVPuMAarRI8gKzOQ6+
    [2016-02-02T14:05:17+00:00] DEBUG: X-OPS-AUTHORIZATION-5: Z6TBmJWXVqdRU4CAvjihr87hVadAYQQZURuQCEwsnxFUnxDZkrz1jDV+PnhQ
    [2016-02-02T14:05:17+00:00] DEBUG: X-OPS-AUTHORIZATION-6: uXPPOgdI5DuF45RvJfoFO8AvTkg+QCEwkqwCAY+e3w==
    [2016-02-02T14:05:17+00:00] DEBUG: HOST: api.opscode.com:443
    [2016-02-02T14:05:17+00:00] DEBUG: X-REMOTE-REQUEST-ID: ac041d25-eba7-4865-a20a-d16ffa60acef
    [2016-02-02T14:05:17+00:00] DEBUG: Content-Length: 1391
    [2016-02-02T14:05:17+00:00] DEBUG: ---- End HTTP Request Header Data ----
    [2016-02-02T14:05:18+00:00] DEBUG: ---- HTTP Status and Header Data: ----
    [2016-02-02T14:05:18+00:00] DEBUG: HTTP 1.1 200 OK
    [2016-02-02T14:05:18+00:00] DEBUG: content-type: application/json
    [2016-02-02T14:05:18+00:00] DEBUG: date: Tue, 02 Feb 2016 14:05:18 GMT
    [2016-02-02T14:05:18+00:00] DEBUG: server: openresty/1.9.3.1
    [2016-02-02T14:05:18+00:00] DEBUG: content-length: 2
    [2016-02-02T14:05:18+00:00] DEBUG: connection: Close
    [2016-02-02T14:05:18+00:00] DEBUG: ---- End HTTP Status/Header Data ----
    [2016-02-02T14:05:18+00:00] ERROR: package[pgdg-centos93] (postgresql::yum_pgdg_postgresql line 43) had an error: Chef::Exceptions::Exec: rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm returned 2, expected 0
    ---- Begin output of rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm ----
    STDOUT: STDERR:     package pgdg-centos93-9.3-2.noarch (which is newer than pgdg-centos93-9.3-1.noarch) is already installed
    ---- End output of rpm  -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm ----
    
    [2016-02-02T14:05:18+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
    [ed@ip-10-0-0-250 ~]$ 
    

    更新2

    已删除的程序包 pgdg-centos93-9.3-2.noarch 它比厨师试图安装的新

    yum remove pgdg-centos93-9.3-2.noarch
    

    然后跑步 sudo chef-client -l debug 再一次

    遇到了另一个阻塞问题,这个问题一旦解决,我就遇到了第一个问题。所以我在绕圈子。将验证一个有用的答案,因为我相信没有简单的解决我的问题的方法。

    1 回复  |  直到 10 年前
        1
  •  2
  •   coderanger    10 年前

    错误是命令 rpm -U /var/chef/cache/pgdg-centos93-9.3-1.noarch.rpm 退出代码为2,表示存在错误。手动运行该命令以查看错误详细信息,或者运行 chef-client -l debug 以启用Chef的调试级输出,该输出将包括来自子流程的stdout和stderr。

    所以你更广泛的问题是:厨师既不是魔术,也不是平台即服务。Chef本身提供了相当基本的原语,如软件包安装和模板化配置文件,一般来说,这些原语只做他们在tin上说的事情。当你开始构建自己的复杂食谱或使用社区食谱时,你可以获得更多的交钥匙魔法,比如“将它添加到你的运行列表中,然后弹出一个PostgreSQL服务器”,但随着这种复杂性,会出现更多的bug。尤其是社区食谱的质量差异很大,你应该经常检查一些东西是否来自你个人或机构信任的作者,如果不是,你可能会阅读其中的所有代码,并确保你喜欢它。当您开始使用外部工具/库/宝石/包等时,与任何软件开发环境的基本过程相同。

    推荐文章