Ошибка при выполнении действия «установить» на ресурсе «newrelic_agent_infrastructure[Install]» с использованием пакета данных

Мы пытаемся установить агент инфраструктуры New Relic, используя стороннюю кулинарную книгу. Но у нас возникла ошибка:
Ошибка при выполнении действия install для ресурса 'newrelic_agent_infrastructure[Install]'

Наш рецепт:

#
# 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'] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Мы пробовали много альтернатив для этой команды, но они не были плодотворными.

Заранее спасибо.


person Daniel    schedule 11.05.2018    source источник


Ответы (2)


Соответствующий код должен работать, но вы можете попробовать:

node.override['newrelic']['application_monitoring']['license'] = 'asdf'
person coderanger    schedule 11.05.2018
comment
Вы уверены, что устанавливаете атрибут в месте, прежде чем он будет использоваться? - person coderanger; 11.05.2018
comment
О, да, ошибка в поваренной книге github.com /djoos-cookbooks/newrelic/blob/master/resources/ - person coderanger; 11.05.2018
comment
У него нет оболочки lazy{}, поэтому он оценивается во время компиляции файла. Вам нужно будет установить атрибут через роль, среду или что-то еще статическое. - person coderanger; 11.05.2018
comment
Большое спасибо @coderanger, я видел, что вы открыли проблему для djoos, чтобы исправить обертку. . Вам нужно будет установить атрибут через роль, среду или что-то еще статическое. Мы думали об этом, но как мы можем менеджеру вставить пакет данных в роль? Заранее спасибо. - person Daniel; 11.05.2018
comment
К сожалению, в настоящее время вы не можете использовать пакет данных. - person coderanger; 12.05.2018