vagrant-azure 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,147 +1,147 @@
1
- #--------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Open Technologies, Inc.
3
- # All Rights Reserved. Licensed under the Apache 2.0 License.
4
- #--------------------------------------------------------------------------
5
- require 'vagrant'
6
- require 'azure'
7
-
8
- module VagrantPlugins
9
- module WinAzure
10
- class Config < Vagrant.plugin('2', :config)
11
- attr_accessor :mgmt_certificate
12
- attr_accessor :mgmt_endpoint
13
- attr_accessor :subscription_id
14
- attr_accessor :storage_acct_name
15
- attr_accessor :storage_access_key
16
-
17
- attr_accessor :vm_name
18
- attr_accessor :vm_user
19
- attr_accessor :vm_password
20
- attr_accessor :vm_image
21
- attr_accessor :vm_location
22
- attr_accessor :vm_affinity_group
23
-
24
- attr_accessor :cloud_service_name
25
- attr_accessor :deployment_name
26
- attr_accessor :tcp_endpoints
27
- attr_accessor :ssh_private_key_file
28
- attr_accessor :ssh_certificate_file
29
- attr_accessor :ssh_port
30
- attr_accessor :vm_size
31
- attr_accessor :winrm_transport
32
- attr_accessor :winrm_http_port
33
- attr_accessor :winrm_https_port
34
- attr_accessor :availability_set_name
35
-
36
- attr_accessor :state_read_timeout
37
-
38
- def initialize
39
- @storage_acct_name = UNSET_VALUE
40
- @storage_access_key = UNSET_VALUE
41
- @mgmt_certificate = UNSET_VALUE
42
- @mgmt_endpoint = UNSET_VALUE
43
- @subscription_id = UNSET_VALUE
44
-
45
- @vm_name = UNSET_VALUE
46
- @vm_user = UNSET_VALUE
47
- @vm_password = UNSET_VALUE
48
- @vm_image = UNSET_VALUE
49
- @vm_location = UNSET_VALUE
50
- @vm_affinity_group = UNSET_VALUE
51
-
52
- @cloud_service_name = UNSET_VALUE
53
- @deployment_name = UNSET_VALUE
54
- @tcp_endpoints = UNSET_VALUE
55
- @ssh_private_key_file = UNSET_VALUE
56
- @ssh_certificate_file = UNSET_VALUE
57
- @ssh_port = UNSET_VALUE
58
- @vm_size = UNSET_VALUE
59
- @winrm_transport = UNSET_VALUE
60
- @winrm_http_port = UNSET_VALUE
61
- @winrm_https_port = UNSET_VALUE
62
- @availability_set_name = UNSET_VALUE
63
- @state_read_timeout = UNSET_VALUE
64
- end
65
-
66
- def finalize!
67
- @storage_acct_name = ENV["AZURE_STORAGE_ACCOUNT"] if \
68
- @storage_acct_name == UNSET_VALUE
69
- @storage_access_key = ENV["AZURE_STORAGE_ACCESS_KEY"] if \
70
- @storage_access_key == UNSET_VALUE
71
- @mgmt_certificate = ENV["AZURE_MANAGEMENT_CERTIFICATE"] if \
72
- @mgmt_certificate == UNSET_VALUE
73
- @mgmt_endpoint = ENV["AZURE_MANAGEMENT_ENDPOINT"] if \
74
- @mgmt_endpoint == UNSET_VALUE
75
- @subscription_id = ENV["AZURE_SUBSCRIPTION_ID"] if \
76
- @subscription_id == UNSET_VALUE
77
-
78
- @vm_name = nil if @vm_name == UNSET_VALUE
79
- @vm_user = 'vagrant' if @vm_user == UNSET_VALUE
80
- @vm_password = nil if @vm_password == UNSET_VALUE
81
- @vm_image = nil if @vm_image == UNSET_VALUE
82
- @vm_location = nil if @vm_location == UNSET_VALUE
83
- @vm_affinity_group = nil if @vm_affinity_group == UNSET_VALUE
84
-
85
- @cloud_service_name = nil if @cloud_service_name == UNSET_VALUE
86
- @deployment_name = nil if @deployment_name == UNSET_VALUE
87
- @tcp_endpoints = nil if @tcp_endpoints == UNSET_VALUE
88
- @ssh_private_key_file = nil if @ssh_private_key_file == UNSET_VALUE
89
- @ssh_certificate_file = nil if @ssh_certificate_file == UNSET_VALUE
90
- @ssh_port = nil if @ssh_port == UNSET_VALUE
91
- @vm_size = nil if @vm_size == UNSET_VALUE
92
- @winrm_transport = nil if @winrm_transport == UNSET_VALUE
93
- @winrm_http_port = nil if @winrm_http_port == UNSET_VALUE
94
- @winrm_https_port = nil if @winrm_https_port == UNSET_VALUE
95
- @availability_set_name = nil if @availability_set_name == UNSET_VALUE
96
-
97
- @state_read_timeout = 360 if @state_read_timeout == UNSET_VALUE
98
-
99
- # This done due to a bug in Ruby SDK - it doesn't generate a storage
100
- # account name if add_role = true
101
- if @storage_acct_name.nil? || @storage_acct_name.empty?
102
- @storage_acct_name = Azure::Core::Utility.random_string(
103
- "#{@vm_name}storage"
104
- ).gsub(/[^0-9a-z ]/i, '').downcase[0..23]
105
- end
106
-
107
- if @cloud_service_name.nil? || @cloud_service_name.empty?
108
- @cloud_service_name = Azure::Core::Utility.random_string(
109
- "#{@vm_name}-service-"
110
- )
111
- end
112
- end
113
-
114
- def merge(other)
115
- super.tap do |result|
116
- result.mgmt_certificate = other.mgmt_certificate || \
117
- self.mgmt_certificate
118
- result.mgmt_endpoint = other.mgmt_endpoint || \
119
- self.mgmt_endpoint
120
- result.subscription_id = other.subscription_id || \
121
- self.subscription_id
122
- result.storage_account_name = other.storage_acct_name || \
123
- self.storage_acct_name
124
- result.storage_access_key = other.storage_access_key || \
125
- self.storage_access_key
126
- end
127
- end
128
-
129
- def validate(machine)
130
- errors = _detected_errors
131
-
132
- # Azure connection properties related validation.
133
- errors << "vagrant_azure.subscription_id.required" if \
134
- @subscription_id.nil?
135
- errors << "vagrant_azure.mgmt_certificate.required" if \
136
- @mgmt_certificate.nil?
137
- errors << "vagrant_azure.mgmt_endpoint.required" if \
138
- @mgmt_endpoint.nil?
139
-
140
- # Azure Virtual Machine related validation
141
- errors << "vagrant_azure.vm_name.required" if @vm_name.nil?
142
-
143
- { "Windows Azure Provider" => errors }
144
- end
145
- end
146
- end
147
- end
1
+ #--------------------------------------------------------------------------
2
+ # Copyright (c) Microsoft Open Technologies, Inc.
3
+ # All Rights Reserved. Licensed under the Apache 2.0 License.
4
+ #--------------------------------------------------------------------------
5
+ require 'vagrant'
6
+ require 'azure'
7
+
8
+ module VagrantPlugins
9
+ module WinAzure
10
+ class Config < Vagrant.plugin('2', :config)
11
+ attr_accessor :mgmt_certificate
12
+ attr_accessor :mgmt_endpoint
13
+ attr_accessor :subscription_id
14
+ attr_accessor :storage_acct_name
15
+ attr_accessor :storage_access_key
16
+
17
+ attr_accessor :vm_name
18
+ attr_accessor :vm_user
19
+ attr_accessor :vm_password
20
+ attr_accessor :vm_image
21
+ attr_accessor :vm_location
22
+ attr_accessor :vm_affinity_group
23
+
24
+ attr_accessor :cloud_service_name
25
+ attr_accessor :deployment_name
26
+ attr_accessor :tcp_endpoints
27
+ attr_accessor :ssh_private_key_file
28
+ attr_accessor :ssh_certificate_file
29
+ attr_accessor :ssh_port
30
+ attr_accessor :vm_size
31
+ attr_accessor :winrm_transport
32
+ attr_accessor :winrm_http_port
33
+ attr_accessor :winrm_https_port
34
+ attr_accessor :availability_set_name
35
+
36
+ attr_accessor :state_read_timeout
37
+
38
+ def initialize
39
+ @storage_acct_name = UNSET_VALUE
40
+ @storage_access_key = UNSET_VALUE
41
+ @mgmt_certificate = UNSET_VALUE
42
+ @mgmt_endpoint = UNSET_VALUE
43
+ @subscription_id = UNSET_VALUE
44
+
45
+ @vm_name = UNSET_VALUE
46
+ @vm_user = UNSET_VALUE
47
+ @vm_password = UNSET_VALUE
48
+ @vm_image = UNSET_VALUE
49
+ @vm_location = UNSET_VALUE
50
+ @vm_affinity_group = UNSET_VALUE
51
+
52
+ @cloud_service_name = UNSET_VALUE
53
+ @deployment_name = UNSET_VALUE
54
+ @tcp_endpoints = UNSET_VALUE
55
+ @ssh_private_key_file = UNSET_VALUE
56
+ @ssh_certificate_file = UNSET_VALUE
57
+ @ssh_port = UNSET_VALUE
58
+ @vm_size = UNSET_VALUE
59
+ @winrm_transport = UNSET_VALUE
60
+ @winrm_http_port = UNSET_VALUE
61
+ @winrm_https_port = UNSET_VALUE
62
+ @availability_set_name = UNSET_VALUE
63
+ @state_read_timeout = UNSET_VALUE
64
+ end
65
+
66
+ def finalize!
67
+ @storage_acct_name = ENV["AZURE_STORAGE_ACCOUNT"] if \
68
+ @storage_acct_name == UNSET_VALUE
69
+ @storage_access_key = ENV["AZURE_STORAGE_ACCESS_KEY"] if \
70
+ @storage_access_key == UNSET_VALUE
71
+ @mgmt_certificate = ENV["AZURE_MANAGEMENT_CERTIFICATE"] if \
72
+ @mgmt_certificate == UNSET_VALUE
73
+ @mgmt_endpoint = ENV["AZURE_MANAGEMENT_ENDPOINT"] if \
74
+ @mgmt_endpoint == UNSET_VALUE
75
+ @subscription_id = ENV["AZURE_SUBSCRIPTION_ID"] if \
76
+ @subscription_id == UNSET_VALUE
77
+
78
+ @vm_name = nil if @vm_name == UNSET_VALUE
79
+ @vm_user = 'vagrant' if @vm_user == UNSET_VALUE
80
+ @vm_password = nil if @vm_password == UNSET_VALUE
81
+ @vm_image = nil if @vm_image == UNSET_VALUE
82
+ @vm_location = nil if @vm_location == UNSET_VALUE
83
+ @vm_affinity_group = nil if @vm_affinity_group == UNSET_VALUE
84
+
85
+ @cloud_service_name = nil if @cloud_service_name == UNSET_VALUE
86
+ @deployment_name = nil if @deployment_name == UNSET_VALUE
87
+ @tcp_endpoints = nil if @tcp_endpoints == UNSET_VALUE
88
+ @ssh_private_key_file = nil if @ssh_private_key_file == UNSET_VALUE
89
+ @ssh_certificate_file = nil if @ssh_certificate_file == UNSET_VALUE
90
+ @ssh_port = nil if @ssh_port == UNSET_VALUE
91
+ @vm_size = nil if @vm_size == UNSET_VALUE
92
+ @winrm_transport = nil if @winrm_transport == UNSET_VALUE
93
+ @winrm_http_port = nil if @winrm_http_port == UNSET_VALUE
94
+ @winrm_https_port = nil if @winrm_https_port == UNSET_VALUE
95
+ @availability_set_name = nil if @availability_set_name == UNSET_VALUE
96
+
97
+ @state_read_timeout = 360 if @state_read_timeout == UNSET_VALUE
98
+
99
+ # This done due to a bug in Ruby SDK - it doesn't generate a storage
100
+ # account name if add_role = true
101
+ if @storage_acct_name.nil? || @storage_acct_name.empty?
102
+ @storage_acct_name = Azure::Core::Utility.random_string(
103
+ "#{@vm_name}storage"
104
+ ).gsub(/[^0-9a-z ]/i, '').downcase[0..23]
105
+ end
106
+
107
+ if @cloud_service_name.nil? || @cloud_service_name.empty?
108
+ @cloud_service_name = Azure::Core::Utility.random_string(
109
+ "#{@vm_name}-service-"
110
+ )
111
+ end
112
+ end
113
+
114
+ def merge(other)
115
+ super.tap do |result|
116
+ result.mgmt_certificate = other.mgmt_certificate || \
117
+ self.mgmt_certificate
118
+ result.mgmt_endpoint = other.mgmt_endpoint || \
119
+ self.mgmt_endpoint
120
+ result.subscription_id = other.subscription_id || \
121
+ self.subscription_id
122
+ result.storage_account_name = other.storage_acct_name || \
123
+ self.storage_acct_name
124
+ result.storage_access_key = other.storage_access_key || \
125
+ self.storage_access_key
126
+ end
127
+ end
128
+
129
+ def validate(machine)
130
+ errors = _detected_errors
131
+
132
+ # Azure connection properties related validation.
133
+ errors << "vagrant_azure.subscription_id.required" if \
134
+ @subscription_id.nil?
135
+ errors << "vagrant_azure.mgmt_certificate.required" if \
136
+ @mgmt_certificate.nil?
137
+ errors << "vagrant_azure.mgmt_endpoint.required" if \
138
+ @mgmt_endpoint.nil?
139
+
140
+ # Azure Virtual Machine related validation
141
+ errors << "vagrant_azure.vm_name.required" if @vm_name.nil?
142
+
143
+ { "Windows Azure Provider" => errors }
144
+ end
145
+ end
146
+ end
147
+ end
@@ -1,70 +1,70 @@
1
- #--------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Open Technologies, Inc.
3
- # All Rights Reserved. Licensed under the Apache 2.0 License.
4
- #--------------------------------------------------------------------------
5
- require 'log4r'
6
- require 'vagrant'
7
-
8
- module VagrantPlugins
9
- module WinAzure
10
- class Provider < Vagrant.plugin('2', :provider)
11
- attr_reader :driver
12
-
13
- def initialize(machine)
14
- @machine = machine
15
-
16
- # Load the driver
17
- machine_id_changed
18
- end
19
-
20
- def action(name)
21
- # Attempt to get the action method from the Action class if it
22
- # exists, otherwise return nil to show that we don't support the
23
- # given action.
24
- action_method = "action_#{name}"
25
- return Action.send(action_method) if Action.respond_to?(action_method)
26
- nil
27
- end
28
-
29
- def machine_id_changed
30
- @driver = Driver.new(@machine)
31
- end
32
-
33
- def ssh_info
34
- # Run a custom action called "read_ssh_info" which does what it
35
- # says and puts the resulting SSH info into the `:machine_ssh_info`
36
- # key in the environment.
37
- env = @machine.action('read_ssh_info')
38
- env[:machine_ssh_info]
39
- end
40
-
41
- def rdp_info
42
- env = @machine.action('read_rdp_info')
43
- env[:machine_ssh_info]
44
- end
45
-
46
- def winrm_info
47
- env = @machine.action('read_winrm_info')
48
- env[:machine_ssh_info]
49
- end
50
-
51
- def state
52
- # Run a custom action we define called "read_state" which does what it
53
- # says. It puts the state in the `:machine_state_id` key in the env
54
- env = @machine.action('read_state')
55
- state_id = env[:machine_state_id]
56
-
57
- short = "Machine's current state is #{state_id}"
58
- long = ""
59
-
60
- # Return the MachineState object
61
- Vagrant::MachineState.new(state_id, short, long)
62
- end
63
-
64
- def to_s
65
- id = @machine.id.nil? ? 'new' : @machine.id
66
- "Azure (#{id})"
67
- end
68
- end
69
- end
70
- end
1
+ #--------------------------------------------------------------------------
2
+ # Copyright (c) Microsoft Open Technologies, Inc.
3
+ # All Rights Reserved. Licensed under the Apache 2.0 License.
4
+ #--------------------------------------------------------------------------
5
+ require 'log4r'
6
+ require 'vagrant'
7
+
8
+ module VagrantPlugins
9
+ module WinAzure
10
+ class Provider < Vagrant.plugin('2', :provider)
11
+ attr_reader :driver
12
+
13
+ def initialize(machine)
14
+ @machine = machine
15
+
16
+ # Load the driver
17
+ machine_id_changed
18
+ end
19
+
20
+ def action(name)
21
+ # Attempt to get the action method from the Action class if it
22
+ # exists, otherwise return nil to show that we don't support the
23
+ # given action.
24
+ action_method = "action_#{name}"
25
+ return Action.send(action_method) if Action.respond_to?(action_method)
26
+ nil
27
+ end
28
+
29
+ def machine_id_changed
30
+ @driver = Driver.new(@machine)
31
+ end
32
+
33
+ def ssh_info
34
+ # Run a custom action called "read_ssh_info" which does what it
35
+ # says and puts the resulting SSH info into the `:machine_ssh_info`
36
+ # key in the environment.
37
+ env = @machine.action('read_ssh_info')
38
+ env[:machine_ssh_info]
39
+ end
40
+
41
+ def rdp_info
42
+ env = @machine.action('read_rdp_info')
43
+ env[:machine_ssh_info]
44
+ end
45
+
46
+ def winrm_info
47
+ env = @machine.action('read_winrm_info')
48
+ env[:machine_ssh_info]
49
+ end
50
+
51
+ def state
52
+ # Run a custom action we define called "read_state" which does what it
53
+ # says. It puts the state in the `:machine_state_id` key in the env
54
+ env = @machine.action('read_state')
55
+ state_id = env[:machine_state_id]
56
+
57
+ short = "Machine's current state is #{state_id}"
58
+ long = ""
59
+
60
+ # Return the MachineState object
61
+ Vagrant::MachineState.new(state_id, short, long)
62
+ end
63
+
64
+ def to_s
65
+ id = @machine.id.nil? ? 'new' : @machine.id
66
+ "Azure (#{id})"
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,177 @@
1
+ #-------------------------------------------------------------------------
2
+ # Copyright (c) Microsoft Open Technologies, Inc.
3
+ # All Rights Reserved. Licensed under the Apache 2.0 License.
4
+ #--------------------------------------------------------------------------
5
+
6
+ require "fileutils"
7
+ require "tempfile"
8
+
9
+ module VagrantPlugins
10
+ module WinAzure
11
+ module Provisioner
12
+ class ChefSolo
13
+ attr_reader :provisioner
14
+
15
+ def initialize(env)
16
+ @env = env
17
+ @provisioner = env[:provisioner]
18
+ end
19
+
20
+ def provision_for_windows
21
+ # Copy the chef cookbooks roles data bags and environment folders to Guest
22
+ copy_folder_to_guest(provisioner.cookbook_folders)
23
+ copy_folder_to_guest(provisioner.role_folders)
24
+ copy_folder_to_guest(provisioner.data_bags_folders)
25
+ copy_folder_to_guest(provisioner.environments_folders)
26
+
27
+ # Upload Encrypted data bag
28
+ upload_encrypted_data_bag_secret if config.encrypted_data_bag_secret_key_path
29
+ setup_json
30
+ setup_solo_config
31
+ run_chef_solo
32
+
33
+ # TODO
34
+ # delete_encrypted_data_bag_secret
35
+ end
36
+
37
+ def setup_json
38
+ @env[:machine].env.ui.info I18n.t("vagrant.provisioners.chef.json")
39
+
40
+ # Get the JSON that we're going to expose to Chef
41
+ json = config.json
42
+ json[:run_list] = config.run_list if !config.run_list.empty?
43
+ json = JSON.pretty_generate(json)
44
+
45
+ # Create a temporary file to store the data so we
46
+ # can upload it
47
+ temp = Tempfile.new("vagrant")
48
+ temp.write(json)
49
+ temp.close
50
+
51
+ remote_file = File.join(config.provisioning_path, "dna.json")
52
+ @env[:machine].provider.driver.upload(temp.path, remote_file)
53
+ end
54
+
55
+ def setup_solo_config
56
+ cookbooks_path = guest_paths(provisioner.cookbook_folders)
57
+ roles_path = guest_paths(provisioner.role_folders)
58
+ data_bags_path = guest_paths(provisioner.data_bags_folders).first
59
+ environments_path = guest_paths(provisioner.environments_folders).first
60
+ source_path = "#{VagrantPlugins::WinAzure.source_root}"
61
+ template_path = source_path + "/templates/provisioners/chef-solo/solo"
62
+ setup_config(template_path, "solo.rb", {
63
+ :cookbooks_path => cookbooks_path,
64
+ :recipe_url => config.recipe_url,
65
+ :roles_path => roles_path,
66
+ :data_bags_path => data_bags_path,
67
+ :environments_path => environments_path
68
+ })
69
+ end
70
+
71
+ def setup_config(template, filename, template_vars)
72
+ # If we have custom configuration, upload it
73
+ remote_custom_config_path = nil
74
+ if config.custom_config_path
75
+ expanded = File.expand_path(
76
+ config.custom_config_path, @machine.env.root_path)
77
+ remote_custom_config_path = File.join(
78
+ config.provisioning_path, "custom-config.rb")
79
+
80
+ @env[:machine].provider.driver.upload(expanded, remote_custom_config_path)
81
+ end
82
+
83
+ config_file = Vagrant::Util::TemplateRenderer.render(template, {
84
+ :custom_configuration => remote_custom_config_path,
85
+ :file_cache_path => config.file_cache_path,
86
+ :file_backup_path => config.file_backup_path,
87
+ :log_level => config.log_level.to_sym,
88
+ :verbose_logging => config.verbose_logging,
89
+ :http_proxy => config.http_proxy,
90
+ :http_proxy_user => config.http_proxy_user,
91
+ :http_proxy_pass => config.http_proxy_pass,
92
+ :https_proxy => config.https_proxy,
93
+ :https_proxy_user => config.https_proxy_user,
94
+ :https_proxy_pass => config.https_proxy_pass,
95
+ :no_proxy => config.no_proxy,
96
+ :formatter => config.formatter
97
+ }.merge(template_vars))
98
+
99
+ # Create a temporary file to store the data so we can upload it
100
+ temp = Tempfile.new("vagrant")
101
+ temp.write(config_file)
102
+ temp.close
103
+
104
+ remote_file = File.join(config.provisioning_path, filename)
105
+ @env[:machine].provider.driver.upload(temp.path, remote_file)
106
+ end
107
+
108
+ def run_chef_solo
109
+ if config.run_list && config.run_list.empty?
110
+ @env[:machine].ui.warn(I18n.t("vagrant.chef_run_list_empty"))
111
+ end
112
+
113
+ options = [
114
+ "-c #{config.provisioning_path}/solo.rb",
115
+ "-j #{config.provisioning_path}/dna.json"
116
+ ]
117
+
118
+ command_env = config.binary_env ? "#{config.binary_env} " : ""
119
+ command_args = config.arguments ? " #{config.arguments}" : ""
120
+ command = "#{command_env}#{chef_binary_path("chef-solo")} " +
121
+ "#{options.join(" ")} #{command_args}"
122
+ config.attempts.times do |attempt|
123
+ if attempt == 0
124
+ @env[:machine].env.ui.info I18n.t("vagrant.provisioners.chef.running_solo")
125
+ else
126
+ @env[:machine].env.ui.info I18n.t("vagrant.provisioners.chef.running_solo_again")
127
+ end
128
+
129
+ command
130
+
131
+ @env[:machine].provider.driver.run_remote_ps(command) do |type, data|
132
+ # Output the data with the proper color based on the stream.
133
+ if (type == :stdout || type == :stderr)
134
+ @env[:ui].detail data
135
+ end
136
+ end
137
+ end
138
+
139
+ end
140
+
141
+ def upload_encrypted_data_bag_secret
142
+ @machine.env.ui.info I18n.t("vagrant.provisioners.chef.upload_encrypted_data_bag_secret_key")
143
+ @env[:machine].provider.driver.upload(encrypted_data_bag_secret_key_path,
144
+ config.encrypted_data_bag_secret)
145
+ end
146
+
147
+ def encrypted_data_bag_secret_key_path
148
+ File.expand_path(config.encrypted_data_bag_secret_key_path, @env[:machine].env.root_path)
149
+ end
150
+
151
+ def config
152
+ provisioner.config
153
+ end
154
+
155
+ def guest_paths(folders)
156
+ folders.map { |parts| parts[2] }
157
+ end
158
+
159
+ # Returns the path to the Chef binary, taking into account the
160
+ # `binary_path` configuration option.
161
+ def chef_binary_path(binary)
162
+ return binary if !config.binary_path
163
+ return File.join(config.binary_path, binary)
164
+ end
165
+
166
+ def copy_folder_to_guest(folders)
167
+ folders.each do |type, local_path, remote_path|
168
+ if type == :host
169
+ @env[:machine].provider.driver.upload(local_path, remote_path)
170
+ end
171
+ end
172
+ end
173
+
174
+ end
175
+ end
176
+ end
177
+ end