chef-provisioning icon indicating copy to clipboard operation
chef-provisioning copied to clipboard

Bug using machine option `chef_server` on a `machine_batch`

Open afiune opened this issue 9 years ago • 2 comments

As a user I would expect to be able to use the machine option chef_server inside a machine_batch resource so I can create batch of machines without failing.

Problem Description

Having the recipe:

with_driver 'aws'

with_machine_options({
  convergence_options: {
    chef_server: "http://localhost:9999/"
  }
  bootstrap_options: {
    instance_type:        'c3.xlarge',
    key_name:             delivery_secrets['key_name'],
    subnet_id:            'subnet-19ac017c' ,
    security_group_ids:   'sg-cbacf8ae'
  },
  ssh_username:           'ubuntu',
  image_id:               'ami-3d50120d',
  use_private_ip_for_ssh: true
})

with_chef_local_server(
  :chef_repo_path => "/repo",
  :port => 9999
)
  machine_batch do
    action :converge
    machines 'analytics-acceptance', 'chef-server-acceptance'
  end

It blows up with the following error:

    Chef::Exceptions::ValidationFailed
    ----------------------------------
    Option chef_server must be a kind of Hash!  You passed "http://localhost:9999/".

    Resource Declaration:
    ---------------------
    # In /var/opt/delivery/workspace/delivery.chef.co/chef/Analytics/chef-analytics/master/acceptance/provision/cache/cookbooks/build-cookbook/recipes/provision.rb

     15:   machine_batch do
     16:     action :converge
     17:     machines 'analytics-acceptance', 'chef-server-acceptance'
     18:   end
     19: 

    Compiled Resource:
    ------------------
    # Declared in /var/opt/delivery/workspace/delivery.chef.co/chef/Analytics/chef-analytics/master/acceptance/provision/cache/cookbooks/build-cookbook/recipes/provision.rb:15:in `from_file'

    machine_batch("default") do
      action [:converge]
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      driver "aws"
      chef_server {:chef_server_url=>"http://127.0.0.1:9999", :options=>{:api_version=>"0"}}
      machine_options {:convergence_options=>{:chef_server=>"http://localhost:9999/"}, :bootstrap_options=>{:instance_type=>"c3.xlarge", :key_name=>"chef-analytics", :subnet_id=>"subnet-19ac017c", :security_group_ids=>"sg-cbacf8ae"}, :ssh_username=>"ubuntu", :image_id=>"ami-3d50120d", :use_private_ip_for_ssh=>true}
      declared_type :machine_batch
      cookbook_name "build-cookbook"
      recipe_name "provision"
      machines ["analytics-acceptance", "chef-server-acceptance"]
    end

Workaround

Avoid using machine_batch resource.

  machine 'analytics-acceptance'
  machine 'chef-server-acceptance'

afiune avatar Aug 21 '15 21:08 afiune

@afiune Did you get this sorted out? Okay to close?

randomcamel avatar Aug 27 '15 19:08 randomcamel

Not fixed.. I workarounded it, I just didn't use it.. Please don't close it

On Thursday, August 27, 2015, Chris Doherty [email protected] wrote:

@afiune https://github.com/afiune Did you get this sorted out? Okay to close?

— Reply to this email directly or view it on GitHub https://github.com/chef/chef-provisioning/issues/422#issuecomment-135525565 .

Salim Afiune — Solutions Engineer

917.716.0448 – [email protected] – *my: *Linkedin http://www.linkedin.com/in/afiune Twitter http://www.twitter.com/afiune

CHEF

  CHEF.IO <http://www.chef.io/>

TM

chef.io http://www.chef.io/ Blog http://www.chef.io/blog/ Facebook https://www.facebook.com/getchefdotcom Twitter https://twitter.com/chef Youtube https://www.youtube.com/getchef

afiune avatar Aug 28 '15 02:08 afiune