1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #1667 from fog/merge_hpfog_0.0.20_release

Merge hpfog 0.0.20 release
This commit is contained in:
Rupak Ganguly 2013-03-14 15:16:23 -07:00
commit 66ecacfaf9
10 changed files with 65 additions and 29 deletions

View file

@ -5,7 +5,7 @@ module Fog
# define a specific version for the HP Provider
unless const_defined?(:VERSION)
VERSION = '0.0.19'
VERSION = '0.0.20'
end
extend Fog::Provider

View file

@ -1,8 +1,18 @@
0.0.19 18/01/2013
0.0.20 03/13/2013
=================
- add Accept header with application/json for all requests
- add support for user_data while creating servers in Compute
- add support for one/two way container synchronisation in Object Storage
- merge with upstream fog v1.10.0
0.0.19 01/25/2013
=================
- update Block Storage namespace to be Fog::HP::BlockStorage
- merge with upstream fog v1.8.0
- merge with upstream fog v1.9.0
- deprecate hp_account_id to use hp_access_key instead
- fix temp_url to use signer that is backward compatible to 1.8.7
- fix issue in Storage provider with service catalog having an invalid CDN endpoint
- Happy New Year to all...
0.0.18 12/04/2012
=================

View file

@ -144,6 +144,7 @@ module Fog
response = @connection.request(params.merge!({
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-Auth-Token' => @auth_token
}.merge!(params[:headers] || {}),
:host => @host,

View file

@ -128,6 +128,7 @@ module Fog
response = @connection.request(params.merge!({
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-Auth-Token' => @auth_token
}.merge!(params[:headers] || {}),
:host => @host,

View file

@ -227,6 +227,7 @@ module Fog
response = @connection.request(params.merge!({
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-Auth-Token' => @auth_token
}.merge!(params[:headers] || {}),
:host => @host,

View file

@ -27,6 +27,7 @@ module Fog
attribute :key_name
attribute :security_groups
attribute :config_drive
attribute :user_data_encoded
# these are implemented as methods
attribute :image_id
attribute :flavor_id
@ -66,6 +67,10 @@ module Fog
metadata.load(metas)
end
def user_data=(ascii_userdata)
self.user_data_encoded = [ascii_userdata].pack('m') # same as Base64.encode64
end
def destroy
requires :id
service.delete_server(id)
@ -224,7 +229,8 @@ module Fog
'max_count' => @max_count,
'key_name' => key_name,
'security_groups' => security_groups,
'config_drive' => config_drive
'config_drive' => config_drive,
'user_data' => user_data_encoded
}
options = options.reject {|key, value| value.nil?}
# either create a regular server or a persistent server based on input

View file

@ -49,7 +49,7 @@ module Fog
write_header = nil
directory = new(:key => key)
for key, value in data.headers
if ['X-Container-Bytes-Used', 'X-Container-Object-Count'].include?(key)
if ['X-Container-Bytes-Used', 'X-Container-Object-Count', 'X-Container-Sync-To', 'X-Container-Sync-Key'].include?(key)
directory.merge_attributes(key => value)
end
if key == 'X-Container-Read'

View file

@ -11,6 +11,8 @@ module Fog
attribute :bytes, :aliases => 'X-Container-Bytes-Used'
attribute :count, :aliases => 'X-Container-Object-Count'
attribute :sync_to, :aliases => 'X-Container-Sync-To'
attribute :sync_key, :aliases => 'X-Container-Sync-Key'
def initialize(attributes = {})
@read_acl = []
@ -205,10 +207,33 @@ module Fog
end
end
def sync(target_dir, secret)
requires :key
# do not sync if dir is same as target dir
return false if target_dir.key == key
begin service.head_container(key)
if !target_dir.nil? && target_dir.is_a?(Fog::Storage::HP::Directory) && target_dir.respond_to?(:public_url) && !target_dir.public_url.nil?
# set sync metadata on source dir
self.sync_to = target_dir.public_url
self.sync_key = secret
# set sync metadata on target dir
target_dir.sync_key = secret
target_dir.save
true
else
false
end
rescue Fog::Storage::HP::NotFound
false
end
end
def save(options = {})
requires :key
# write out the acls into the headers before save
options.merge!(service.perm_acl_to_header(@read_acl, @write_acl))
options.merge!({'X-Container-Sync-To' => self.sync_to}) unless self.sync_to.nil?
options.merge!({'X-Container-Sync-Key' => self.sync_key}) unless self.sync_key.nil?
service.put_container(key, options)
# Added an extra check to see if CDN is enabled for the container
if (!service.cdn.nil? && service.cdn.enabled?)

View file

@ -63,15 +63,11 @@ module Fog
'name' => name
}
}
if options['metadata']
data['server']['metadata'] = options['metadata']
end
if options['accessIPv4']
data['server']['accessIPv4'] = options['accessIPv4']
end
if options['accessIPv6']
data['server']['accessIPv6'] = options['accessIPv6']
l_options = ['metadata', 'accessIPv4', 'accessIPv6', 'key_name', 'config_drive', 'user_data']
l_options.select{|o| options[o]}.each do |key|
data['server'][key] = options[key]
end
if options['personality']
data['server']['personality'] = []
for file in options['personality']
@ -86,9 +82,6 @@ module Fog
data['server']['min_count'] = min_count
data['server']['max_count'] = max_count
if options['key_name']
data['server']['key_name'] = options['key_name']
end
if options['security_groups']
data['server']['security_groups'] = []
for sg in options['security_groups']
@ -97,9 +90,6 @@ module Fog
}
end
end
if options['config_drive']
data['server']['config_drive'] = options['config_drive']
end
request(
:body => Fog::JSON.encode(data),

View file

@ -291,6 +291,7 @@ module Fog
response = @connection.request(params.merge!({
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-Auth-Token' => @auth_token
}.merge!(params[:headers] || {}),
:host => @host,
@ -316,6 +317,7 @@ module Fog
response = @connection.request(params.merge!({
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-Auth-Token' => @auth_token
}.merge!(params[:headers] || {}),
:host => @host,