Class: ChefWorkflow::VM::ChefServerProvisioner

Inherits:
Object
  • Object
show all
Includes:
DebugSupport, KnifePluginSupport
Defined in:
lib/chef-workflow/support/vm/chef_server.rb

Constant Summary

Constants included from DebugSupport

DebugSupport::CHEF_WORKFLOW_DEBUG_DEFAULT

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from KnifePluginSupport

#init_knife_plugin

Methods included from DebugSupport

#if_debug

Instance Attribute Details

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/chef-workflow/support/vm/chef_server.rb', line 10

def name
  @name
end

Instance Method Details

#reportObject



35
36
37
# File 'lib/chef-workflow/support/vm/chef_server.rb', line 35

def report
  [name]
end

#shutdownObject



31
32
33
# File 'lib/chef-workflow/support/vm/chef_server.rb', line 31

def shutdown
  true
end

#startup(*args) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/chef-workflow/support/vm/chef_server.rb', line 12

def startup(*args)
  require 'chef-workflow/support/knife'
  require 'chef/knife/ssh' # required for chef 10.12
  require 'chef/knife/server_bootstrap_standalone'

  ip = args.first.first #arg

  raise "No IP to use for the chef server" unless ip

  args = %W[--node-name test-chef-server --host #{ip}]

  args += %W[--ssh-user #{ChefWorkflow::KnifeSupport.ssh_user}]                 if ChefWorkflow::KnifeSupport.ssh_user
  args += %W[--ssh-password #{ChefWorkflow::KnifeSupport.ssh_password}]         if ChefWorkflow::KnifeSupport.ssh_password
  args += %W[--identity-file #{ChefWorkflow::KnifeSupport.ssh_identity_file}]   if ChefWorkflow::KnifeSupport.ssh_identity_file

  init_knife_plugin(Chef::Knife::ServerBootstrapStandalone, args).run
  true
end