Module: ChefProvisioner::Config

Extended by:
Config
Included in:
Config
Defined in:
lib/chef-provisioner/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



10
11
12
# File 'lib/chef-provisioner/config.rb', line 10

def client
  @client
end

#client_keyObject (readonly)

Returns the value of attribute client_key.



10
11
12
# File 'lib/chef-provisioner/config.rb', line 10

def client_key
  @client_key
end

#serverObject (readonly)

Returns the value of attribute server.



10
11
12
# File 'lib/chef-provisioner/config.rb', line 10

def server
  @server
end

Instance Method Details

#setup(server: nil, client_key: nil, client_key_path: nil, client: nil, listen: nil) ⇒ Object



12
13
14
15
16
17
# File 'lib/chef-provisioner/config.rb', line 12

def setup(server: nil, client_key: nil, client_key_path: nil, client: nil, listen: nil)
  @server = server || "http://#{listen || my_ip}:#{get_free_port}"
  @client_key = client_key || client_key_path || setup_chef_client_file
  @client = client || 'testing-client'
  ChefProvisioner::Chef.configure(endpoint: @server, key_path: @client_key, client: @client)
end