Sha256: a54e6b3e94b39592e10e48c1b569693830cb5a46956e2023c32ec5369fb681a2

Contents?: true

Size: 974 Bytes

Versions: 1

Compression:

Stored size: 974 Bytes

Contents

Given /^a local mode chef repo with nodes '(.+)'$/ do |nodelist|
  # create the repo directory hierarchy
  %w(cookbooks clients nodes data_bags).each do |dir|
    create_dir dir
  end
  # create a basic knife.rb
  write_file 'knife.rb', <<EOF
local_mode true
chef_repo_path '.'
chef_zero.enabled true
EOF
  # create the admin user and capture its private key
  in_current_dir do
      system 'knife client create admin -z -d -a -c knife.rb > admin.pem'
  end
  # add the admin key to the knife configuration
  append_to_file 'knife.rb', <<EOF
node_name 'admin'
client_key 'admin.pem'
EOF
  # create the requested nodes
  nodelist.split(/,/).each do |node|
    run_simple "knife client create #{node} -z -d -c knife.rb"
    run_simple "knife node create #{node} -z -d -c knife.rb"
  end
end

When /^I delete clients? '(.+)' from the Chef server$/ do |nodelist|
  nodelist.split(/,/).each do |node|
    run_simple "knife client delete #{node} -z -d -y -c knife.rb"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chef-vault-2.4.0 features/step_definitions/chef-repo.rb