Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chef run fails on trying to start datadog on amazon-linux LTS 2 #554

Open
komealy opened this issue Aug 18, 2018 · 1 comment
Open

chef run fails on trying to start datadog on amazon-linux LTS 2 #554

komealy opened this issue Aug 18, 2018 · 1 comment
Milestone

Comments

@komealy
Copy link

komealy commented Aug 18, 2018

I am using this ami provided by amazon: amzn2-ami-hvm-2.0.20180810-x86_64-gp2 (ami-04681a1dbd79675a5)

It does not have a platform_version set in ohai:

  "platform": "amazon",
  "platform_version": null,
  "platform_family": "amazon",

The code in the cookbook that checks the amazon_linux version is expecting a value for platform_version

  service_provider = nil
  if node['datadog']['agent6'] &&
     (((node['platform'] == 'amazon' || node['platform_family'] == 'amazon') && node['platform_version'].to_i != 2) ||
     (node['platform'] != 'amazon' && node['platform_family'] == 'rhel' && node['platform_version'].to_i < 7))
    # use Upstart provider explicitly for Agent 6 on Amazon Linux < 2.0 and RHEL < 7
    service_provider = Chef::Provider::Service::Upstart
  end

Since this platform_version = null this will incorrectly set Upstart for the provider and the chef run fails:

Recipe: datadog::dd-agent
  * service[datadog-agent] action enable[2018-08-18T20:03:15+00:00] INFO: Processing service[datadog-agent] action enable (datadog::dd-agent line 113)
[2018-08-18T20:03:15+00:00] INFO: Retrying execution of service[datadog-agent], 1 attempt(s) left
[2018-08-18T20:03:20+00:00] INFO: Retrying execution of service[datadog-agent], 0 attempt(s) left


    ================================================================================
    Error executing action `enable` on resource 'service[datadog-agent]'
    ================================================================================

    Errno::ENOENT
    -------------
    No such file or directory - /sbin/status

    Resource Declaration:
    ---------------------
    # In /var/chef/.chef/local-mode-cache/cache/cookbooks/datadog/recipes/dd-agent.rb

    113: service 'datadog-agent' do
    114:   service_name node['datadog']['agent_name']
    115:   action [agent_enable, agent_start]
    116:   provider service_provider unless service_provider.nil?
    117:   if is_windows
    118:     supports :restart => true, :start => true, :stop => true
    119:     restart_command "powershell restart-service #{node['datadog']['agent_name']} -Force"
    120:     stop_command "powershell stop-service #{node['datadog']['agent_name']} -Force"
    121:   else
    122:     supports :restart => true, :status => true, :start => true, :stop => true
    123:   end
    124:   subscribes :restart, "template[#{agent_config_file}]", :delayed unless node['datadog']['agent_start'] == false

    Compiled Resource:
    ------------------
    # Declared in /var/chef/.chef/local-mode-cache/cache/cookbooks/datadog/recipes/dd-agent.rb:113:in `from_file'

    service("datadog-agent") do
      provider Chef::Provider::Service::Upstart
      action [:enable, :start]
      default_guard_interpreter :default
      service_name "datadog-agent"
      enabled nil
      running nil
      masked nil
      pattern "datadog-agent"
      declared_type :service
      cookbook_name "datadog"
      recipe_name "dd-agent"
      supports {:restart=>true, :status=>true, :start=>true, :stop=>true}
      retries 2
      retry_delay 5
    end

    System Info:
    ------------
    chef_version=13.8.5
    platform=amazon
    platform_version=
    ruby=ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux]
    program_name=chef-client worker: ppid=7926;start=20:03:06;
    executable=/opt/chefdk/bin/chef-client

[2018-08-18T20:03:25+00:00] INFO: Running queued delayed notifications before re-raising exception
[2018-08-18T20:03:25+00:00] DEBUG: Re-raising exception: Errno::ENOENT - service[datadog-agent] (datadog::dd-agent line 113) had an error: Errno::ENOENT: No such file or directory - /sbin/status
/opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/mixlib-shellout-2.3.2/lib/mixlib/shellout/unix.rb:340:in `exec'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/mixlib-shellout-2.3.2/lib/mixlib/shellout/unix.rb:340:in `block in fork_subprocess'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/mixlib-shellout-2.3.2/lib/mixlib/shellout/unix.rb:318:in `fork'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/mixlib-shellout-2.3.2/lib/mixlib/shellout/unix.rb:318:in `fork_subprocess'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/mixlib-shellout-2.3.2/lib/mixlib/shellout/unix.rb:95:in `run_command'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/mixlib-shellout-2.3.2/lib/mixlib/shellout.rb:263:in `run_command'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/mixin/shell_out.rb:171:in `shell_out_command'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/mixin/shell_out.rb:114:in `shell_out'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/provider/service/upstart.rb:243:in `upstart_goal_state'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/provider/service/upstart.rb:124:in `load_current_resource'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/provider.rb:154:in `run_action'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/resource.rb:591:in `run_action'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/runner.rb:70:in `run_action'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/runner.rb:98:in `block (2 levels) in converge'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/runner.rb:98:in `each'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/runner.rb:98:in `block in converge'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/resource_collection/resource_list.rb:94:in `block in execute_each_resource'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/resource_collection/stepable_iterator.rb:114:in `call_iterator_block'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/resource_collection/stepable_iterator.rb:103:in `iterate'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/resource_collection/resource_list.rb:92:in `execute_each_resource'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/runner.rb:97:in `converge'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/client.rb:718:in `block in converge'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/client.rb:713:in `catch'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/client.rb:713:in `converge'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/client.rb:752:in `converge_and_save'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/client.rb:286:in `run'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application.rb:292:in `block in fork_chef_client'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application.rb:280:in `fork'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application.rb:280:in `fork_chef_client'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application.rb:245:in `block in run_chef_client'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/local_mode.rb:44:in `with_server_connectivity'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application.rb:233:in `run_chef_client'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application/client.rb:469:in `sleep_then_run_chef_client'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application/client.rb:458:in `block in interval_run_chef_client'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application/client.rb:457:in `loop'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application/client.rb:457:in `interval_run_chef_client'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application/client.rb:441:in `run_application'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application.rb:59:in `run'
  /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/bin/chef-client:26:in `<top (required)>'
  /bin/chef-client:250:in `load'
  /bin/chef-client:250:in `<main>'

Running handlers:
[2018-08-18T20:03:25+00:00] ERROR: Running exception handlers
@edjackson-wf
Copy link

I'm seeing the same, although it should be addressed by chef/ohai#1214.

@olivielpeau olivielpeau added this to the 2.17.0 milestone Oct 29, 2018
@remeh remeh modified the milestones: 2.17.0, 3.0 Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants