Class: ChefDK::ProvisioningData::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/chef-dk/command/provision.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeContext

Returns a new instance of Context.



51
52
53
# File 'lib/chef-dk/command/provision.rb', line 51

def initialize
  @extra_chef_config = ""
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



39
40
41
# File 'lib/chef-dk/command/provision.rb', line 39

def action
  @action
end

#enable_policyfileObject

Returns the value of attribute enable_policyfile.



43
44
45
# File 'lib/chef-dk/command/provision.rb', line 43

def enable_policyfile
  @enable_policyfile
end

#extra_chef_configObject

Returns the value of attribute extra_chef_config.



49
50
51
# File 'lib/chef-dk/command/provision.rb', line 49

def extra_chef_config
  @extra_chef_config
end

#node_nameObject

Returns the value of attribute node_name.



41
42
43
# File 'lib/chef-dk/command/provision.rb', line 41

def node_name
  @node_name
end

#policy_groupObject

Returns the value of attribute policy_group.



45
46
47
# File 'lib/chef-dk/command/provision.rb', line 45

def policy_group
  @policy_group
end

#policy_nameObject

Returns the value of attribute policy_name.



47
48
49
# File 'lib/chef-dk/command/provision.rb', line 47

def policy_name
  @policy_name
end

Instance Method Details

#chef_configObject



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/chef-dk/command/provision.rb', line 62

def chef_config
  config=<<-CONFIG
# SSL Settings:
ssl_verify_mode #{Chef::Config.ssl_verify_mode.inspect}

CONFIG
  if enable_policyfile
    policyfile_config=<<-CONFIG
# Policyfile Settings:
use_policyfile true
policy_document_native_api true

policy_group "#{policy_group}"
policy_name "#{policy_name}"

CONFIG
    config << policyfile_config
  end

  config << extra_chef_config.to_s
  config
end

#convergence_optionsObject



55
56
57
58
59
60
# File 'lib/chef-dk/command/provision.rb', line 55

def convergence_options
  {
    chef_server: Chef::Config.chef_server_url,
    chef_config: chef_config
  }
end