Commit c0cd0082 authored by Praveen Arimbrathodiyil's avatar Praveen Arimbrathodiyil
Browse files

Merge tag 'upstream/1.32.1'

Upstream version 1.32.1

# gpg: Signature made Tuesday 01 September 2015 02:36:47 PM IST using RSA key ID 4512C22A
# gpg: Good signature from "Praveen Arimbrathodiyil (piratepin) <praveen@debian.org>"
# gpg:                 aka "Pirate Praveen (pirates.org.in) <praveen@onenetbeyond.org>"
# gpg:                 aka "Pirate Praveen (piratesin) <me@j4v4m4n.in>"
# gpg:                 aka "Pirate Praveen (PP) <praveen@privacyrequired.com>"
# gpg:                 aka "Praveen Arimbrathodiyil (j4v4m4n) <pravi.a@gmail.com>"
parents a06f5f26 1214a0ac
* Aaron Patterson <aaron.patterson@gmail.com>
* Akira Matsuda <ronnie@dio.jp>
* Anatol <anatol.pomozov@gmail.com>
* Bryan Paxton <starbelly@pobox.com>
* Chris Johnson <wchrisjohnson@gmail.com>
* Chris Sinjakli <chris@sinjakli.co.uk>
* Dominic Cleal <dcleal@redhat.com>
* Evan Light <evan@tripledogdare.net>
* Frederick Cheung <frederick.cheung@gmail.com>
* Isaac Hollander McCreery <ihmccreery@google.com>
* Jake Bell <jake@theunraveler.com>
* Josh Kalderimis <josh.kalderimis@gmail.com>
* Josh Lane <me@joshualane.com>
* Kensuke Nagae <kyanny@gmail.com>
* Kevin Menard <kevin@nirvdrum.com>
* Ladislav Smola <lsmola@redhat.com>
* Matheus Mina <mfbmina@gmail.com>
* Matt Bostock <matt@mattbostock.com>
* Matt Darby <darby@mittdarko.com>
* Matt Darby <matt.darby@rackspace.com>
* Matt Eldridge <matt.eldridge@us.ibm.com>
* Mike Hagedorn <mike@silverchairsolutions.com>
* Naoto TAKAHASHI <tnaoto@gmail.com>
* Paul Thornthwaite <paul@brightbox.co.uk>
* Paul Thornthwaite <tokengeek@gmail.com>
* Paulo Henrique Lopes Ribeiro <plribeiro3000@gmail.com>
* Peter Drake <peter.drake@acquia.com>
* Wesley Beary <geemus+github@gmail.com>
* Wesley Beary <geemus@gmail.com>
* cristhiano <cristhiano_figueira@yahoo.com.br>
* geemus <geemus@gmail.com>
* mountkin <moutkin@gmail.com>
\ No newline at end of file
* mountkin <moutkin@gmail.com>
* ozroc <ozrocpablo@gmail.com>
* schneems <richard.schneeman@gmail.com>
* starbelly <starbelly@pobox.com>
\ No newline at end of file
1.32.1 08/12/2015
==========================================================
expose identities in models
1.32.0 07/02/2015
==========================================================
fix/refactor service initializers
1.31.1 06/17/2015
==========================================================
fixes around unknown providers/services
1.31.0 06/17/2015
==========================================================
use relative paths
add digital ocean examples
reinstate baremetal
add softlayer examples
add digital ocean v2 support
setup fog model equality to check identities (if available)
use Fog.interval in wait_for
reduce memory footprint
fix account handling
1.30.0 04/02/2015
==========================================================
......
module Fog
module Account
def self.[](provider)
new(:provider => provider)
end
extend Fog::ServicesMixin
def self.new(attributes)
attributes = attributes.dup
def self.new(orig_attributes)
attributes = orig_attributes.dup
provider = attributes.delete(:provider).to_s.downcase.to_sym
if provider == :stormondemand
require "fog/account/storm_on_demand"
Fog::Account::StormOnDemand.new(attributes)
else
raise ArgumentError, "#{provider} has no account service"
super(orig_attributes)
end
end
......
module Fog
module Baremetal
def self.[](provider)
new(:provider => provider)
end
def self.new(attributes)
attributes = attributes.dup # Prevent delete from having side effects
provider = attributes.delete(:provider).to_s.downcase.to_sym
if providers.include?(provider)
require "fog/#{provider}/baremetal"
return Fog::Baremetal.const_get(Fog.providers[provider]).new(attributes)
end
raise ArgumentError, "#{provider} has no baremetal service"
end
def self.providers
Fog.services[:baremetal]
end
extend Fog::ServicesMixin
end
end
module Fog
module Billing
def self.[](provider)
new(:provider => provider)
end
extend Fog::ServicesMixin
def self.new(attributes)
attributes = attributes.dup
def self.new(orig_attributes)
attributes = orig_attributes.dup
provider = attributes.delete(:provider).to_s.downcase.to_sym
if provider == :stormondemand
require "fog/billing/storm_on_demand"
Fog::Billing::StormOnDemand.new(attributes)
else
raise ArgumentError, "#{provider} has no billing service"
super(orig_attributes)
end
end
def self.providers
Fog.services[:billing]
end
end
end
module Fog
module CDN
def self.[](provider)
new(:provider => provider)
end
def self.new(attributes)
attributes = attributes.dup # prevent delete from having side effects
provider = attributes.delete(:provider).to_s.downcase.to_sym
if providers.include?(provider)
require "fog/#{provider}/cdn"
return Fog::CDN.const_get(Fog.providers[provider]).new(attributes)
end
raise ArgumentError, "#{provider} is not a recognized cdn provider"
end
def self.providers
Fog.services[:cdn]
end
extend Fog::ServicesMixin
end
end
module Fog
module Compute
def self.[](provider)
new(:provider => provider)
end
extend Fog::ServicesMixin
def self.new(attributes)
attributes = attributes.dup # prevent delete from having side effects
def self.new(orig_attributes)
attributes = orig_attributes.dup # prevent delete from having side effects
provider = attributes.delete(:provider).to_s.downcase.to_sym
case provider
......@@ -41,6 +39,16 @@ module Fog
require "fog/rackspace/compute_v2"
Fog::Compute::RackspaceV2.new(attributes)
end
when :digitalocean
version = attributes.delete(:version)
version = version.to_s.downcase.to_sym unless version.nil?
if version == :v2
require "fog/digitalocean/compute_v2"
Fog::Compute::DigitalOceanV2.new(attributes)
else
require "fog/digitalocean/compute"
Fog::Compute::DigitalOcean.new(attributes)
end
when :stormondemand
require "fog/compute/storm_on_demand"
Fog::Compute::StormOnDemand.new(attributes)
......@@ -51,27 +59,10 @@ module Fog
require "fog/vcloud_director/compute"
Fog::Compute::VcloudDirector.new(attributes)
else
if providers.include?(provider)
begin
require "fog/#{provider}/compute"
rescue LoadError
require "fog/compute/#{provider}"
end
begin
Fog::Compute.const_get(Fog.providers[provider])
rescue
Fog.const_get(Fog.providers[provider])::Compute
end.new(attributes)
else
raise ArgumentError, "#{provider} is not a recognized compute provider"
end
super(orig_attributes)
end
end
def self.providers
Fog.services[:compute]
end
def self.servers
servers = []
providers.each do |provider|
......
......@@ -11,62 +11,65 @@ require "timeout"
require "ipaddr"
# internal core dependencies
require "fog/core/version"
require File.expand_path('../core/version', __FILE__)
require "fog/core/attributes"
require "fog/core/attributes/default"
require "fog/core/attributes/array"
require "fog/core/attributes/boolean"
require "fog/core/attributes/float"
require "fog/core/attributes/integer"
require "fog/core/attributes/string"
require "fog/core/attributes/time"
require "fog/core/attributes/timestamp"
require "fog/core/associations/default"
require "fog/core/associations/many_identities"
require "fog/core/associations/many_models"
require "fog/core/associations/one_model"
require "fog/core/associations/one_identity"
require "fog/core/collection"
require "fog/core/association"
require "fog/core/connection"
require "fog/core/credentials"
require "fog/core/current_machine"
require "fog/core/deprecation"
require "fog/core/errors"
require "fog/core/hmac"
require "fog/core/logger"
require "fog/core/model"
require "fog/core/mock"
require "fog/core/provider"
require "fog/core/service"
require "fog/core/ssh"
require "fog/core/scp"
require "fog/core/time"
require "fog/core/utils"
require "fog/core/wait_for"
require "fog/core/wait_for_defaults"
require "fog/core/uuid"
require "fog/core/stringify_keys"
require "fog/core/whitelist_keys"
# Mixins
require File.expand_path('../core/services_mixin', __FILE__)
require File.expand_path('../core/attributes', __FILE__)
require File.expand_path('../core/attributes/default', __FILE__)
require File.expand_path('../core/attributes/array', __FILE__)
require File.expand_path('../core/attributes/boolean', __FILE__)
require File.expand_path('../core/attributes/float', __FILE__)
require File.expand_path('../core/attributes/integer', __FILE__)
require File.expand_path('../core/attributes/string', __FILE__)
require File.expand_path('../core/attributes/time', __FILE__)
require File.expand_path('../core/attributes/timestamp', __FILE__)
require File.expand_path('../core/associations/default', __FILE__)
require File.expand_path('../core/associations/many_identities', __FILE__)
require File.expand_path('../core/associations/many_models', __FILE__)
require File.expand_path('../core/associations/one_model', __FILE__)
require File.expand_path('../core/associations/one_identity', __FILE__)
require File.expand_path('../core/collection', __FILE__)
require File.expand_path('../core/association', __FILE__)
require File.expand_path('../core/connection', __FILE__)
require File.expand_path('../core/credentials', __FILE__)
require File.expand_path('../core/current_machine', __FILE__)
require File.expand_path('../core/deprecation', __FILE__)
require File.expand_path('../core/errors', __FILE__)
require File.expand_path('../core/hmac', __FILE__)
require File.expand_path('../core/logger', __FILE__)
require File.expand_path('../core/model', __FILE__)
require File.expand_path('../core/mock', __FILE__)
require File.expand_path('../core/provider', __FILE__)
require File.expand_path('../core/service', __FILE__)
require File.expand_path('../core/ssh', __FILE__)
require File.expand_path('../core/scp', __FILE__)
require File.expand_path('../core/time', __FILE__)
require File.expand_path('../core/utils', __FILE__)
require File.expand_path('../core/wait_for', __FILE__)
require File.expand_path('../core/wait_for_defaults', __FILE__)
require File.expand_path('../core/uuid', __FILE__)
require File.expand_path('../core/stringify_keys', __FILE__)
require File.expand_path('../core/whitelist_keys', __FILE__)
require File.expand_path('../account', __FILE__)
require File.expand_path('../baremetal', __FILE__)
require File.expand_path('../billing', __FILE__)
require File.expand_path('../cdn', __FILE__)
require File.expand_path('../compute', __FILE__)
require File.expand_path('../dns', __FILE__)
require File.expand_path('../identity', __FILE__)
require File.expand_path('../image', __FILE__)
require File.expand_path('../metering', __FILE__)
require File.expand_path('../monitoring', __FILE__)
require File.expand_path('../network', __FILE__)
require File.expand_path('../orchestration', __FILE__)
require File.expand_path('../storage', __FILE__)
require File.expand_path('../support', __FILE__)
require File.expand_path('../volume', __FILE__)
require File.expand_path('../vpn', __FILE__)
# service wrappers
require "fog/account"
require "fog/baremetal"
require "fog/billing"
require "fog/cdn"
require "fog/compute"
require "fog/dns"
require "fog/identity"
require "fog/image"
require "fog/metering"
require "fog/monitoring"
require "fog/network"
require "fog/orchestration"
require "fog/storage"
require "fog/support"
require "fog/volume"
require "fog/vpn"
# Utility
require 'fog/formatador'
require File.expand_path('../formatador', __FILE__)
......@@ -101,12 +101,16 @@ module Fog
copy
end
def identity_name
self.class.instance_variable_get("@identity")
end
def identity
send(self.class.instance_variable_get("@identity"))
send(identity_name)
end
def identity=(new_identity)
send("#{self.class.instance_variable_get("@identity")}=", new_identity)
send("#{identity_name}=", new_identity)
end
def merge_attributes(new_attributes = {})
......
......@@ -43,6 +43,8 @@ An alternate file may be used by placing its path in the FOG_RC environment vari
:brightbox_secret:
:clodo_api_key:
:clodo_username:
:digitalocean_api_key:
:digitalocean_client_id:
:go_grid_api_key:
:go_grid_shared_secret:
:google_client_email:
......@@ -77,6 +79,11 @@ An alternate file may be used by placing its path in the FOG_RC environment vari
:rage4_password:
:riakcs_access_key_id:
:riakcs_secret_access_key:
:softlayer_username:
:softlayer_api_key:
:softlayer_default_datacenter:
:softlayer_cluster:
:softlayer_default_domain:
:stormondemand_username:
:stormondemand_password:
:terremark_username:
......
......@@ -24,6 +24,18 @@ module Fog
Fog::Formatador.format(self)
end
def ==(o)
unless o.is_a?(Fog::Model)
super
else
if (o.identity.nil? and self.identity.nil?)
o.object_id == self.object_id
else
o.class == self.class and o.identity == self.identity
end
end
end
def reload
requires :identity
......@@ -52,7 +64,7 @@ module Fog
end
end
def wait_for(timeout = Fog.timeout, interval = 1, &block)
def wait_for(timeout = Fog.timeout, interval = Fog.interval, &block)
reload_has_succeeded = false
duration = Fog.wait_for(timeout, interval) do # Note that duration = false if it times out
if reload
......
module Fog
module ServicesMixin
def [](provider)
new(:provider => provider)
end
def new(attributes)
attributes = attributes.dup # Prevent delete from having side effects
provider = attributes.delete(:provider).to_s.downcase.to_sym
provider_name = Fog.providers[provider]
raise ArgumentError, "#{provider} is not a recognized provider" unless providers.include?(provider)
require_service_provider_library(service_name.downcase, provider)
spc = service_provider_constant(service_name, provider_name)
spc.new(attributes)
rescue LoadError, NameError # Only rescue errors in finding the libraries, allow connection errors through to the caller
raise ArgumentError, "#{provider} has no #{service_name.downcase} service"
end
def providers
Fog.services[service_name.downcase.to_sym] || []
end
private
def require_service_provider_library(service, provider)
require "fog/#{provider}/#{service}"
rescue LoadError # Try to require the service provider in an alternate location
require "fog/#{service}/#{provider}"
end
def service_provider_constant(service_name, provider_name)
Fog.const_get(service_name).const_get(provider_name)
rescue NameError # Try to find the constant from in an alternate location
Fog.const_get(provider_name).const_get(service_name)
end
def service_name
name.split("Fog::").last
end
end
end
module Fog
module Core
VERSION = "1.30.0"
VERSION = "1.32.1"
end
end
module Fog
module DNS
def self.[](provider)
new(:provider => provider)
end
extend Fog::ServicesMixin
def self.new(attributes)
attributes = attributes.dup # prevent delete from having side effects
def self.new(orig_attributes)
attributes = orig_attributes.dup # prevent delete from having side effects
case provider = attributes.delete(:provider).to_s.downcase.to_sym
when :stormondemand
require "fog/dns/storm_on_demand"
Fog::DNS::StormOnDemand.new(attributes)
else
if providers.include?(provider)
require "fog/#{provider}/dns"
begin
Fog::DNS.const_get(Fog.providers[provider])
rescue
Fog.const_get(Fog.providers[provider])::DNS
end.new(attributes)
else
raise ArgumentError, "#{provider} is not a recognized dns provider"
end
super(orig_attributes)
end
end
def self.providers
Fog.services[:dns]
end
def self.zones
zones = []
providers.each do |provider|
......
module Fog
module Identity
def self.[](provider)
new(:provider => provider)
end
def self.new(attributes)
attributes = attributes.dup # Prevent delete from having side effects
provider = attributes.delete(:provider).to_s.downcase.to_sym
unless providers.include?(provider)
raise ArgumentError, "#{provider} has no identity service"
end
require "fog/#{provider}/identity"
begin
Fog::Identity.const_get(Fog.providers[provider])
rescue
Fog.const_get(Fog.providers[provider])::Identity
end.new(attributes)
end
def self.providers
Fog.services[:identity]
end
extend Fog::ServicesMixin
end
end
module Fog
module Image
def self.[](provider)
new(:provider => provider)
end
def self.new(attributes)
attributes = attributes.dup # Prevent delete from having side effects
provider = attributes.delete(:provider).to_s.downcase.to_sym
if providers.include?(provider)
require "fog/#{provider}/image"
return Fog::Image.const_get(Fog.providers[provider]).new(attributes)
end
raise ArgumentError, "#{provider} has no image service"
end
def self.providers
Fog.services[:image]
end
extend Fog::ServicesMixin
end
end
module Fog
module Metering
def self.[](provider)
new(:provider => provider)
end
def self.new(attributes)
attributes = attributes.dup # Prevent delete from having side effects
provider = attributes.delete(:provider).to_s.downcase.to_sym
if providers.include?(provider)
require "fog/#{provider}/metering"
return Fog::Metering.const_get(Fog.providers[provider]).new(attributes)
end
raise ArgumentError, "#{provider} has no identity service"
end
def self.providers
Fog.services[:metering]
end
extend Fog::ServicesMixin
end
end
module Fog
module Monitoring
def self.[](provider)
new(:provider => provider)
end
extend Fog::ServicesMixin
def self.new(attributes)
attributes = attributes.dup
def self.new(orig_attributes)
attributes = orig_attributes.dup
provider = attributes.delete(:provider).to_s.downcase.to_sym
if provider == :stormondemand
require "fog/monitoring/storm_on_demand"
Fog::Monitoring::StormOnDemand.new(attributes)
else
raise ArgumentError, "#{provider} has no monitoring service"
super(orig_attributes)
end
end
def self.providers
Fog.services[:monitoring]
end
end
end
module Fog
module Network
def self.[](provider)
new(:provider => provider)
end