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:
commit
66ecacfaf9
10 changed files with 65 additions and 29 deletions
|
@ -5,7 +5,7 @@ module Fog
|
||||||
|
|
||||||
# define a specific version for the HP Provider
|
# define a specific version for the HP Provider
|
||||||
unless const_defined?(:VERSION)
|
unless const_defined?(:VERSION)
|
||||||
VERSION = '0.0.19'
|
VERSION = '0.0.20'
|
||||||
end
|
end
|
||||||
|
|
||||||
extend Fog::Provider
|
extend Fog::Provider
|
||||||
|
|
|
@ -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
|
- 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
|
- 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
|
0.0.18 12/04/2012
|
||||||
=================
|
=================
|
||||||
|
|
|
@ -144,6 +144,7 @@ module Fog
|
||||||
response = @connection.request(params.merge!({
|
response = @connection.request(params.merge!({
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
|
'Accept' => 'application/json',
|
||||||
'X-Auth-Token' => @auth_token
|
'X-Auth-Token' => @auth_token
|
||||||
}.merge!(params[:headers] || {}),
|
}.merge!(params[:headers] || {}),
|
||||||
:host => @host,
|
:host => @host,
|
||||||
|
|
|
@ -128,6 +128,7 @@ module Fog
|
||||||
response = @connection.request(params.merge!({
|
response = @connection.request(params.merge!({
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
|
'Accept' => 'application/json',
|
||||||
'X-Auth-Token' => @auth_token
|
'X-Auth-Token' => @auth_token
|
||||||
}.merge!(params[:headers] || {}),
|
}.merge!(params[:headers] || {}),
|
||||||
:host => @host,
|
:host => @host,
|
||||||
|
|
|
@ -227,6 +227,7 @@ module Fog
|
||||||
response = @connection.request(params.merge!({
|
response = @connection.request(params.merge!({
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
|
'Accept' => 'application/json',
|
||||||
'X-Auth-Token' => @auth_token
|
'X-Auth-Token' => @auth_token
|
||||||
}.merge!(params[:headers] || {}),
|
}.merge!(params[:headers] || {}),
|
||||||
:host => @host,
|
:host => @host,
|
||||||
|
|
|
@ -27,6 +27,7 @@ module Fog
|
||||||
attribute :key_name
|
attribute :key_name
|
||||||
attribute :security_groups
|
attribute :security_groups
|
||||||
attribute :config_drive
|
attribute :config_drive
|
||||||
|
attribute :user_data_encoded
|
||||||
# these are implemented as methods
|
# these are implemented as methods
|
||||||
attribute :image_id
|
attribute :image_id
|
||||||
attribute :flavor_id
|
attribute :flavor_id
|
||||||
|
@ -66,6 +67,10 @@ module Fog
|
||||||
metadata.load(metas)
|
metadata.load(metas)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def user_data=(ascii_userdata)
|
||||||
|
self.user_data_encoded = [ascii_userdata].pack('m') # same as Base64.encode64
|
||||||
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
requires :id
|
requires :id
|
||||||
service.delete_server(id)
|
service.delete_server(id)
|
||||||
|
@ -216,15 +221,16 @@ module Fog
|
||||||
meta_hash = {}
|
meta_hash = {}
|
||||||
metadata.each { |meta| meta_hash.store(meta.key, meta.value) }
|
metadata.each { |meta| meta_hash.store(meta.key, meta.value) }
|
||||||
options = {
|
options = {
|
||||||
'metadata' => meta_hash,
|
'metadata' => meta_hash,
|
||||||
'personality' => personality,
|
'personality' => personality,
|
||||||
'accessIPv4' => accessIPv4,
|
'accessIPv4' => accessIPv4,
|
||||||
'accessIPv6' => accessIPv6,
|
'accessIPv6' => accessIPv6,
|
||||||
'min_count' => @min_count,
|
'min_count' => @min_count,
|
||||||
'max_count' => @max_count,
|
'max_count' => @max_count,
|
||||||
'key_name' => key_name,
|
'key_name' => key_name,
|
||||||
'security_groups' => security_groups,
|
'security_groups' => security_groups,
|
||||||
'config_drive' => config_drive
|
'config_drive' => config_drive,
|
||||||
|
'user_data' => user_data_encoded
|
||||||
}
|
}
|
||||||
options = options.reject {|key, value| value.nil?}
|
options = options.reject {|key, value| value.nil?}
|
||||||
# either create a regular server or a persistent server based on input
|
# either create a regular server or a persistent server based on input
|
||||||
|
|
|
@ -49,7 +49,7 @@ module Fog
|
||||||
write_header = nil
|
write_header = nil
|
||||||
directory = new(:key => key)
|
directory = new(:key => key)
|
||||||
for key, value in data.headers
|
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)
|
directory.merge_attributes(key => value)
|
||||||
end
|
end
|
||||||
if key == 'X-Container-Read'
|
if key == 'X-Container-Read'
|
||||||
|
|
|
@ -7,10 +7,12 @@ module Fog
|
||||||
|
|
||||||
class Directory < Fog::Model
|
class Directory < Fog::Model
|
||||||
|
|
||||||
identity :key, :aliases => 'name'
|
identity :key, :aliases => 'name'
|
||||||
|
|
||||||
attribute :bytes, :aliases => 'X-Container-Bytes-Used'
|
attribute :bytes, :aliases => 'X-Container-Bytes-Used'
|
||||||
attribute :count, :aliases => 'X-Container-Object-Count'
|
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 = {})
|
def initialize(attributes = {})
|
||||||
@read_acl = []
|
@read_acl = []
|
||||||
|
@ -205,10 +207,33 @@ module Fog
|
||||||
end
|
end
|
||||||
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 = {})
|
def save(options = {})
|
||||||
requires :key
|
requires :key
|
||||||
# write out the acls into the headers before save
|
# write out the acls into the headers before save
|
||||||
options.merge!(service.perm_acl_to_header(@read_acl, @write_acl))
|
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)
|
service.put_container(key, options)
|
||||||
# Added an extra check to see if CDN is enabled for the container
|
# Added an extra check to see if CDN is enabled for the container
|
||||||
if (!service.cdn.nil? && service.cdn.enabled?)
|
if (!service.cdn.nil? && service.cdn.enabled?)
|
||||||
|
|
|
@ -63,15 +63,11 @@ module Fog
|
||||||
'name' => name
|
'name' => name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if options['metadata']
|
l_options = ['metadata', 'accessIPv4', 'accessIPv6', 'key_name', 'config_drive', 'user_data']
|
||||||
data['server']['metadata'] = options['metadata']
|
l_options.select{|o| options[o]}.each do |key|
|
||||||
end
|
data['server'][key] = options[key]
|
||||||
if options['accessIPv4']
|
|
||||||
data['server']['accessIPv4'] = options['accessIPv4']
|
|
||||||
end
|
|
||||||
if options['accessIPv6']
|
|
||||||
data['server']['accessIPv6'] = options['accessIPv6']
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if options['personality']
|
if options['personality']
|
||||||
data['server']['personality'] = []
|
data['server']['personality'] = []
|
||||||
for file in options['personality']
|
for file in options['personality']
|
||||||
|
@ -86,9 +82,6 @@ module Fog
|
||||||
data['server']['min_count'] = min_count
|
data['server']['min_count'] = min_count
|
||||||
data['server']['max_count'] = max_count
|
data['server']['max_count'] = max_count
|
||||||
|
|
||||||
if options['key_name']
|
|
||||||
data['server']['key_name'] = options['key_name']
|
|
||||||
end
|
|
||||||
if options['security_groups']
|
if options['security_groups']
|
||||||
data['server']['security_groups'] = []
|
data['server']['security_groups'] = []
|
||||||
for sg in options['security_groups']
|
for sg in options['security_groups']
|
||||||
|
@ -97,9 +90,6 @@ module Fog
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if options['config_drive']
|
|
||||||
data['server']['config_drive'] = options['config_drive']
|
|
||||||
end
|
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => Fog::JSON.encode(data),
|
:body => Fog::JSON.encode(data),
|
||||||
|
|
|
@ -291,6 +291,7 @@ module Fog
|
||||||
response = @connection.request(params.merge!({
|
response = @connection.request(params.merge!({
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
|
'Accept' => 'application/json',
|
||||||
'X-Auth-Token' => @auth_token
|
'X-Auth-Token' => @auth_token
|
||||||
}.merge!(params[:headers] || {}),
|
}.merge!(params[:headers] || {}),
|
||||||
:host => @host,
|
:host => @host,
|
||||||
|
@ -316,6 +317,7 @@ module Fog
|
||||||
response = @connection.request(params.merge!({
|
response = @connection.request(params.merge!({
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
|
'Accept' => 'application/json',
|
||||||
'X-Auth-Token' => @auth_token
|
'X-Auth-Token' => @auth_token
|
||||||
}.merge!(params[:headers] || {}),
|
}.merge!(params[:headers] || {}),
|
||||||
:host => @host,
|
:host => @host,
|
||||||
|
|
Loading…
Reference in a new issue