在资源&new; newrelic_agent_infrastructure [Install]'上执行动作`install`时出错使用数据包

时间:2018-05-11 11:44:08

标签: linux chef chef-recipe databags

我们正在尝试使用第三方食谱安装New Relic Infrastructure代理。但是我们遇到了错误:
            在资源上执行操作install时出错[newrelic_agent_infrastructure [安装]'

我们的食谱:

#
# Cookbook:: third-party-newrelic
# Recipe:: infraestructure-agent
#
# Copyright:: 2018, The Authors, All Rights Reserved.

include_recipe 'base::databag'
include_recipe 'newrelic::infrastructure_agent'
# Default Variables
newrelic = decrypt_databag('newrelic')

node.normal['newrelic']['license'] = newrelic['license_key']

记录错误:

Recipe: newrelic::infrastructure_agent
  * newrelic_agent_infrastructure[Install] action install

    ================================================================================
    Error executing action `install` on resource 'newrelic_agent_infrastructure[Install]'
    ================================================================================

    RuntimeError
    ------------
    The NewRelic key is required.

    Cookbook Trace:
    ---------------
    /var/chef/cache/cookbooks/newrelic/libraries/helpers.rb:15:in `check_license'
    /var/chef/cache/cookbooks/newrelic/providers/agent_infrastructure.rb:18:in `block in class_from_file'

    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/newrelic/recipes/infrastructure_agent.rb

      8: newrelic_agent_infrastructure 'Install'

    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/newrelic/recipes/infrastructure_agent.rb:8:in `from_file'

    newrelic_agent_infrastructure("Install") do
      action [:install]
      default_guard_interpreter :default
      declared_type :newrelic_agent_infrastructure
      cookbook_name "newrelic"
      recipe_name "infrastructure_agent"
    end

    System Info:
    ------------
    chef_version=13.8.5
    platform=ubuntu
    platform_version=16.04
    ruby=ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux]
    program_name=chef-client worker: ppid=101819;start=19:52:27;
    executable=/opt/chef/bin/chef-client


Running handlers:
[2018-05-10T19:52:34+00:00] ERROR: Running exception handlers
Running handlers complete
[2018-05-10T19:52:34+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 07 seconds
[2018-05-10T19:52:34+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2018-05-10T19:52:34+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2018-05-10T19:52:34+00:00] ERROR: newrelic_agent_infrastructure[Install] (newrelic::infrastructure_agent line 8) had an error: RuntimeError: The NewRelic key is required.
[2018-05-10T19:52:34+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

即使使用以下行代替数据包:

node.default_unless [' newrelic'] [' license'] =" xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

我们为这个命令尝试了许多替代方案,但它没有生育能力。

先谢谢。

1 个答案:

答案 0 :(得分:0)

问题: https://github.com/djoos-cookbooks/newrelic/issues/345

确定。我们设法通过更改以下文件中的这一行来解决此问题: ../resources/agent_infrastructure.rb ../资源/ agent_php.rb

自:

属性:license,:kind_of => String,:default => NewRelic.application_monitoring_license(节点)

要:

属性:license,:kind_of => String,:default => lazy {NewRelic.application_monitoring_license(node)}

在食谱内

node.default ['newrelic'] ['license'] = newrelic ['license_key']

使用以下结构调用我们的数据包:

id:newrelic

许可密钥:xxxxxxxxxxxxxxxxxxxxx

感谢您的帮助。