chef-cookbooks / chef-server

Cookbook to install standalone Chef Server

Home Page:http://supermarket.chef.io/cookbooks/chef-server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Addons that require 'accept_license' passed in chef_ingredient call fail on reconfigure

mengesb opened this issue · comments

Cookbook version

5.0.0

Chef-client version

12.8.1-1

Platform Details

AWS CentOS 6.6 x86_64 w/updates HVM

Scenario:

Install addons using the chef-server::addons recipe

Steps to Reproduce:

Setting in the node's attributes the following:

{
  "fqdn": "chef-01.[REDACTED]",
   "chef_client": {
     "init_style": "none"
   },
  "chef-server": {
    "addons": [
      "manage",
      "push-jobs-server",
      "reporting"
    ],
    "api_fqdn": "chef-01.[REDACTED]",
    "configuration": "nginx['ssl_certificate'] = '/var/chef/ssl/chef-01.[REDACTED].pem'\nnginx['ssl_certificate_key'] = '/var/chef/ssl/chef-01.[REDACTED].key'",
    "topology": "standalone"
  },
  "firewall": {
    "allow_established": true,
    "allow_ssh": true
  },
  "system": {
    "delay_network_restart": false,
    "domain_name": "[REDACTED]",
    "manage_hostsfile": true,
    "short_hostname": "chef-01"
  },
  "tags": []
}

Expected Result:

Expect all addons to be installed without issue during reconfigure

Actual Result:

Reconfiguration presents an error. This is new starting today (2016/04/28)

* chef_ingredient[manage] action reconfigure
  * ingredient_config[manage] action render (skipped due to not_if)
  * execute[chef-manage-reconfigure] action run

    ================================================================================
    Error executing action `run` on resource 'execute[chef-manage-reconfigure]'
    ================================================================================

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '1'
    ---- Begin output of chef-manage-ctl reconfigure ----
    STDOUT: To use this software, you must agree to the terms of the software license agreement.
    Please view and accept the software license agreement, or pass --accept-license.
    STDERR:
    ---- End output of chef-manage-ctl reconfigure ----
    Ran chef-manage-ctl reconfigure returned 1

    Resource Declaration:
    ---------------------
    # In /var/chef/cookbooks/chef-ingredient/libraries/chef_ingredient_provider.rb

    105:           execute "#{ingredient_package_name}-reconfigure" do
    106:             command "#{ingredient_ctl_command} reconfigure"
    107:           end
    108:         end

    Compiled Resource:
    ------------------
    # Declared in /var/chef/cookbooks/chef-ingredient/libraries/chef_ingredient_provider.rb:105:in `block in <class:ChefIngredient>'

    execute("chef-manage-reconfigure") do
      action [:run]
      retries 0
      retry_delay 2
      default_guard_interpreter :execute
      command "chef-manage-ctl reconfigure"
      backup 5
      returns 0
      declared_type :execute
      cookbook_name :"chef-server"
    end


  ================================================================================
  Error executing action `reconfigure` on resource 'chef_ingredient[manage]'
  ================================================================================

  Mixlib::ShellOut::ShellCommandFailed
  ------------------------------------
  execute[chef-manage-reconfigure] (/var/chef/cookbooks/chef-ingredient/libraries/chef_ingredient_provider.rb line 105) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
  ---- Begin output of chef-manage-ctl reconfigure ----
  STDOUT: To use this software, you must agree to the terms of the software license agreement.
  Please view and accept the software license agreement, or pass --accept-license.
  STDERR:
  ---- End output of chef-manage-ctl reconfigure ----
  Ran chef-manage-ctl reconfigure returned 1

  Resource Declaration:
  ---------------------
  # In /var/chef/cookbooks/chef-server/recipes/addons.rb

   20:   chef_ingredient addon do
   21:     notifies :reconfigure, "chef_ingredient[#{addon}]"
   22:   end
   23: end

  Compiled Resource:
  ------------------
  # Declared in /var/chef/cookbooks/chef-server/recipes/addons.rb:20:in `block in from_file'

  chef_ingredient("manage") do
    action [:install]
    updated true
    retries 0
    retry_delay 2
    default_guard_interpreter :default
    declared_type :chef_ingredient
    cookbook_name :"chef-server"
    recipe_name "addons"
    product_name "manage"
  end

My fix is to simply add accept_license to the addons.rb recipe and add a accept_license attribute. Not sure if this falls under Obvious Fix policy, but in the absence of more concise addons configuration in a different issue, this fixes things.

+1. I'm hitting this, too. Started today.

STDOUT: To use this software, you must agree to the terms of the software license agreement.
Please view and accept the software license agreement, or pass --accept-license.

Guys, this is so frustrating. The entire purpose of Chef is to create environments that are automatic, fluid, and controlled. Adding a step where an argument has to be passed to accept a license without having some mechanism to automate it goes completely contrary to that and has completely horked a bunch of demos I was doing to try to sell this tech internally.

I have PR #121 open on this... but i think i have to modify the tests...

Until the cookbook handles this properly, set the ['chef-server']['version'] attribute to 12.4.1-1 to go back to a version that doesn't require the license acceptance and use chef-server cookbook version 4.1.0.

EDIT: Actually, that didn't fix it. I'm still hunting for a version that works. Will update this comment when I find one.

EDIT: It looks like regardless of what you lock the version to for the package, the latest chef gems are installed, which means there's no version you can choose that will work.

EDIT: Confirmed. The only way to fix this (other than editing the cookbook) is to log into the chef server and run $ sudo chef-manage-ctl reconfigure --accept-license.

@ChadScott and @mengesb,

Thanks so much for bringing up the issue. We're working to get this cookbook updated asap. Additionally @mengesb thanks for working to add a fix for this issue!

This should be fixed in version 5.0.1 of this cookbook. Please let me know if it is still having problems for you. Please make sure to explicitly set the accept_license attribute value to true to express accepting the Chef MLSA.