chef-metal-fog 0.5.beta.5 → 0.5.beta.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef_metal_fog/fog_driver.rb +18 -13
- data/lib/chef_metal_fog/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 808835083ceaf7db0de62541e834b4730d8ea919
|
4
|
+
data.tar.gz: d3333babf02cf215c515e78c8167fe9df22b0570
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54d7c00be7001d256832652f8d78865ed2a7eb43fc6e3a273c255aa24dd37d53e020a301067e9fd079d55528a27ca8b967a10b333ef67fe3fe1846523045f3bd
|
7
|
+
data.tar.gz: c5338a27a82b1d1f750feae7cb72214e064b65cce937b6b69afff0183b3d560f28dbe3567160d90b886a0f61069df683cf12808c1dc0ee2cf6941a531ac3393d
|
@@ -28,6 +28,7 @@ module ChefMetalFog
|
|
28
28
|
#
|
29
29
|
# fog:AWS:<account_id>:<region>
|
30
30
|
# fog:AWS:<profile_name>
|
31
|
+
# fog:AWS:<profile_name>:<region>
|
31
32
|
# fog:OpenStack:https://identityHost:portNumber/v2.0
|
32
33
|
# fog:DigitalOcean:<client id>
|
33
34
|
# fog:Rackspace:https://identity.api.rackspacecloud.com/v2.0
|
@@ -546,7 +547,7 @@ module ChefMetalFog
|
|
546
547
|
new_compute_options = {}
|
547
548
|
new_compute_options[:provider] = provider
|
548
549
|
new_config = { :driver_options => { :compute_options => new_compute_options }}
|
549
|
-
|
550
|
+
result = Cheffish::MergedConfig.new(new_config, config)
|
550
551
|
|
551
552
|
# Get data from the identifier in the URL
|
552
553
|
if id && id != ''
|
@@ -556,13 +557,15 @@ module ChefMetalFog
|
|
556
557
|
if id =~ /^(\d{12})(:(.+))?$/
|
557
558
|
if $2
|
558
559
|
id = $1
|
559
|
-
|
560
|
+
new_compute_options[:region] = $3
|
560
561
|
else
|
561
562
|
Chef::Log.warn("Old-style AWS URL #{id} from an early beta of chef-metal (before 0.11-final) found. If you have servers in multiple regions on this account, you may see odd behavior like servers being recreated. To fix, edit any nodes with attribute metal.location.driver_url to include the region like so: fog:AWS:#{id}:<region> (e.g. us-east-1)")
|
562
563
|
end
|
563
564
|
else
|
564
565
|
# Assume it is a profile name, and set that.
|
565
|
-
|
566
|
+
aws_profile, region = id.split(':', 2)
|
567
|
+
new_config[:driver_options][:aws_profile] = aws_profile
|
568
|
+
new_compute_options[:region] = region
|
566
569
|
id = nil
|
567
570
|
end
|
568
571
|
when 'DigitalOcean'
|
@@ -586,10 +589,12 @@ module ChefMetalFog
|
|
586
589
|
case provider
|
587
590
|
when 'AWS'
|
588
591
|
# Grab the profile
|
589
|
-
aws_profile = FogDriverAWS.get_aws_profile(driver_options, id)
|
590
|
-
[ :aws_access_key_id, :aws_secret_access_key, :aws_security_token
|
591
|
-
new_compute_options[key] = aws_profile[key]
|
592
|
+
aws_profile = FogDriverAWS.get_aws_profile(result[:driver_options], id)
|
593
|
+
[ :aws_access_key_id, :aws_secret_access_key, :aws_security_token].each do |key|
|
594
|
+
new_compute_options[key] = aws_profile[key]
|
592
595
|
end
|
596
|
+
# For :region, we prefer the region in compute options or URL over the region in the profile.
|
597
|
+
new_compute_options[:region] ||= aws_profile[:region] if aws_profile.has_key?(:region) && !compute_options.has_key?(:region)
|
593
598
|
when 'OpenStack'
|
594
599
|
# TODO it is supposed to be unnecessary to load credentials from fog this way;
|
595
600
|
# why are we doing it?
|
@@ -613,9 +618,9 @@ module ChefMetalFog
|
|
613
618
|
|
614
619
|
id = case provider
|
615
620
|
when 'AWS'
|
616
|
-
account_info = FogDriverAWS.aws_account_info_for(
|
621
|
+
account_info = FogDriverAWS.aws_account_info_for(result[:driver_options][:compute_options])
|
617
622
|
new_config[:driver_options][:aws_account_info] = account_info
|
618
|
-
"#{account_info[:aws_account_id]}:#{
|
623
|
+
"#{account_info[:aws_account_id]}:#{result[:driver_options][:compute_options][:region]}"
|
619
624
|
when 'DigitalOcean'
|
620
625
|
config[:driver_options][:compute_options][:digitalocean_client_id]
|
621
626
|
when 'OpenStack'
|
@@ -623,15 +628,15 @@ module ChefMetalFog
|
|
623
628
|
when 'Rackspace'
|
624
629
|
config[:driver_options][:compute_options][:rackspace_auth_url]
|
625
630
|
when 'CloudStack'
|
626
|
-
host =
|
627
|
-
path =
|
628
|
-
port =
|
629
|
-
scheme =
|
631
|
+
host = result[:driver_options][:compute_options][:cloudstack_host]
|
632
|
+
path = result[:driver_options][:compute_options][:cloudstack_path] || '/client/api'
|
633
|
+
port = result[:driver_options][:compute_options][:cloudstack_port] || 443
|
634
|
+
scheme = result[:driver_options][:compute_options][:cloudstack_scheme] || 'https'
|
630
635
|
|
631
636
|
URI.scheme_list[scheme.upcase].build(:host => host, :port => port, :path => path).to_s
|
632
637
|
end
|
633
638
|
|
634
|
-
[
|
639
|
+
[ result, id ]
|
635
640
|
end
|
636
641
|
end
|
637
642
|
end
|