chef-provisioning-fog 0.11 → 0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34990906985f7a7c4de47ef2a7e670a309412324
|
4
|
+
data.tar.gz: ad07082eaa71fc18afdc44b5fbd22819ffc75998
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62236621c239d507ed1393e3a6780ca72966e7f27a46d4954ea5ca4da066dc18b826c5a2cf7f3fe4b251decec583e9212774a0614228abd62a4e6f379c400eec
|
7
|
+
data.tar.gz: 1b7e1878546996f6d05790f3efbf5d0b855aa88db4a77553ef08c039a31c3f36979eedca140311d78a7f826339b31502ea2fef266b7902f40a3d48d8feb4579e
|
@@ -316,7 +316,6 @@ module FogDriver
|
|
316
316
|
description = [ "creating #{machine_description} on #{driver_url}" ]
|
317
317
|
bootstrap_options.each_pair { |key,value| description << " #{key}: #{value.inspect}" }
|
318
318
|
action_handler.report_progress description
|
319
|
-
|
320
319
|
if action_handler.should_perform_actions
|
321
320
|
# Actually create the servers
|
322
321
|
create_many_servers(machine_specs.size, bootstrap_options, parallelizer) do |server|
|
@@ -341,7 +340,7 @@ module FogDriver
|
|
341
340
|
end
|
342
341
|
|
343
342
|
if machine_specs.size > 0
|
344
|
-
raise "Not all machines were created by
|
343
|
+
raise "Not all machines were created by create_many_servers!"
|
345
344
|
end
|
346
345
|
end
|
347
346
|
end.to_a
|
@@ -349,7 +348,8 @@ module FogDriver
|
|
349
348
|
|
350
349
|
def create_many_servers(num_servers, bootstrap_options, parallelizer)
|
351
350
|
parallelizer.parallelize(1.upto(num_servers)) do |i|
|
352
|
-
|
351
|
+
clean_bootstrap_options = Marshal.load(Marshal.dump(bootstrap_options)) # Prevent destructive operations on bootstrap_options.
|
352
|
+
server = compute.servers.create(clean_bootstrap_options)
|
353
353
|
yield server if block_given?
|
354
354
|
server
|
355
355
|
end.to_a
|
@@ -572,9 +572,10 @@ module FogDriver
|
|
572
572
|
# Get the private key for a machine - prioritize the server data, fall back to the
|
573
573
|
# the machine spec data, and if that doesn't work, raise an exception.
|
574
574
|
# @param [Hash] machine_spec Machine spec data
|
575
|
+
# @param [Hash] machine_options Machine options
|
575
576
|
# @param [Chef::Provisioning::Machine] server a Machine representing the server
|
576
577
|
# @return [String] PEM-encoded private key
|
577
|
-
def private_key_for(machine_spec, server)
|
578
|
+
def private_key_for(machine_spec, machine_options, server)
|
578
579
|
if server.respond_to?(:private_key) && server.private_key
|
579
580
|
server.private_key
|
580
581
|
elsif server.respond_to?(:key_name) && server.key_name
|
@@ -602,10 +603,13 @@ module FogDriver
|
|
602
603
|
def ssh_options_for(machine_spec, machine_options, server)
|
603
604
|
result = {
|
604
605
|
:auth_methods => [ 'publickey' ],
|
605
|
-
:keys_only => true,
|
606
606
|
:host_key_alias => "#{server.id}.#{provider}"
|
607
607
|
}.merge(machine_options[:ssh_options] || {})
|
608
|
-
|
608
|
+
# Grab key_data from the user's config if not specified
|
609
|
+
unless result.has_key?(:key_data)
|
610
|
+
result[:keys_only] = true
|
611
|
+
result[:key_data] = [ private_key_for(machine_spec, machine_options, server) ]
|
612
|
+
end
|
609
613
|
result
|
610
614
|
end
|
611
615
|
|
@@ -47,7 +47,7 @@ module FogDriver
|
|
47
47
|
port = machine_spec.location['winrm_port'] || 5985
|
48
48
|
endpoint = "http://#{remote_host}:#{port}/wsman"
|
49
49
|
type = :plaintext
|
50
|
-
pem_bytes = private_key_for(machine_spec, server)
|
50
|
+
pem_bytes = private_key_for(machine_spec, machine_options, server)
|
51
51
|
encrypted_admin_password = wait_for_admin_password(machine_spec)
|
52
52
|
decoded = Base64.decode64(encrypted_admin_password)
|
53
53
|
private_key = OpenSSL::PKey::RSA.new(pem_bytes)
|
@@ -335,7 +335,7 @@ module FogDriver
|
|
335
335
|
|
336
336
|
if id && id != ''
|
337
337
|
# AWS canonical URLs are of the form fog:AWS:
|
338
|
-
if id =~ /^(\d{12})(:(.+))?$/
|
338
|
+
if id =~ /^(\d{12}|IAM)(:(.+))?$/
|
339
339
|
if $2
|
340
340
|
id = $1
|
341
341
|
new_compute_options[:region] = $3
|
@@ -350,17 +350,22 @@ module FogDriver
|
|
350
350
|
id = nil
|
351
351
|
end
|
352
352
|
end
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
353
|
+
if id == 'IAM'
|
354
|
+
id = "IAM:#{result[:driver_options][:compute_options][:region]}"
|
355
|
+
new_config[:driver_options][:aws_account_info] = { aws_username: 'IAM' }
|
356
|
+
new_compute_options[:use_iam_profile] = true
|
357
|
+
else
|
358
|
+
aws_profile = get_aws_profile(result[:driver_options], id)
|
359
|
+
new_compute_options[:aws_access_key_id] = aws_profile[:aws_access_key_id]
|
360
|
+
new_compute_options[:aws_secret_access_key] = aws_profile[:aws_secret_access_key]
|
361
|
+
new_compute_options[:aws_session_token] = aws_profile[:aws_security_token]
|
362
|
+
new_defaults[:driver_options][:compute_options][:region] = aws_profile[:region]
|
363
|
+
new_defaults[:driver_options][:compute_options][:endpoint] = aws_profile[:ec2_endpoint]
|
364
|
+
|
365
|
+
account_info = aws_account_info_for(result[:driver_options][:compute_options])
|
366
|
+
new_config[:driver_options][:aws_account_info] = account_info
|
367
|
+
id = "#{account_info[:aws_account_id]}:#{result[:driver_options][:compute_options][:region]}"
|
368
|
+
end
|
364
369
|
|
365
370
|
# Make sure we're using a reasonable default AMI, for now this is Ubuntu 14.04 LTS
|
366
371
|
result[:machine_options][:bootstrap_options][:image_id] ||=
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-provisioning-fog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.12'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Keiser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef
|
@@ -107,7 +107,6 @@ files:
|
|
107
107
|
- Rakefile
|
108
108
|
- lib/chef/provider/fog_key_pair.rb
|
109
109
|
- lib/chef/provisioning/driver_init/fog.rb
|
110
|
-
- lib/chef/provisioning/fog_driver.rb
|
111
110
|
- lib/chef/provisioning/fog_driver/driver.rb
|
112
111
|
- lib/chef/provisioning/fog_driver/providers/aws.rb
|
113
112
|
- lib/chef/provisioning/fog_driver/providers/aws/credentials.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
require 'chef/provisioning/fog_driver/driver'
|