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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d322a0449ade9efef2687f008518e7ac83d1e7d
4
- data.tar.gz: 7bd6f1bb30ac76cd48fda57143345225db5de2ad
3
+ metadata.gz: 808835083ceaf7db0de62541e834b4730d8ea919
4
+ data.tar.gz: d3333babf02cf215c515e78c8167fe9df22b0570
5
5
  SHA512:
6
- metadata.gz: 7de8f96cd3532800eb4b8f75624c689586d6c9dbbfceef3ba7491974d70fb854478ff3849e4a76fe8323d9700152ec6674e17eefe49a265684baf06cc0667d48
7
- data.tar.gz: df850e30c2f46a531d3b735c5aecdc8b9a3b2ce79245d321544dc0e290cbb9f551fc5a9603367669fd5f8f2d764f4b1c1253810ab1e07fde1424e95930a34640
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
- config = Cheffish::MergedConfig.new(new_config, config)
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
- driver_options[:region] = $3
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
- driver_options[:aws_profile] = id
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, :region].each do |key|
591
- new_compute_options[key] = aws_profile[key] if aws_profile.has_key?(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(config[:driver_options][:compute_options])
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]}:#{config[:driver_options][:compute_options][:region]}"
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 = config[:driver_options][:compute_options][:cloudstack_host]
627
- path = config[:driver_options][:compute_options][:cloudstack_path] || '/client/api'
628
- port = config[:driver_options][:compute_options][:cloudstack_port] || 443
629
- scheme = config[:driver_options][:compute_options][:cloudstack_scheme] || 'https'
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
- [ config, id ]
639
+ [ result, id ]
635
640
  end
636
641
  end
637
642
  end
@@ -1,3 +1,3 @@
1
1
  module ChefMetalFog
2
- VERSION = '0.5.beta.5'
2
+ VERSION = '0.5.beta.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-metal-fog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.beta.5
4
+ version: 0.5.beta.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser