CloudyScripts 1.8.32 → 1.8.33

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ require 'rake/testtask'
12
12
 
13
13
  spec = Gem::Specification.new do |s|
14
14
  s.name = 'CloudyScripts'
15
- s.version = '1.8.32'
15
+ s.version = '1.8.33'
16
16
  s.has_rdoc = true
17
17
  s.extra_rdoc_files = ['README.rdoc', 'LICENSE']
18
18
  s.summary = 'Scripts to facilitate programming for infrastructure clouds.'
@@ -101,7 +101,7 @@ class RemoteCommandHandler
101
101
  else
102
102
  cmd = "e2label #{device} #{label}"
103
103
  end
104
- remote_execute("e2label #{device} #{label}", nil, false)
104
+ remote_execute(cmd, nil, false)
105
105
  end
106
106
 
107
107
  # Get filesystem type
@@ -861,7 +861,7 @@ module StateTransitionHelper
861
861
  # aki-ea5df7eb ec2-public-images-ap-northeast-1/pv-grub-hd00_1.02-x86_64.gz.manifest.xml
862
862
  # aki-ec5df7ed ec2-public-images-ap-northeast-1/pv-grub-hd0_1.02-i386.gz.manifest.xml
863
863
  # aki-ee5df7ef ec2-public-images-ap-northeast-1/pv-grub-hd0_1.02-x86_64.gz.manifest.xml
864
- def get_aws_kernel_image_aki(source_region, source_aki, target_region)
864
+ def get_aws_kernel_image_aki(source_endpoint, source_aki, target_endpoint)
865
865
  map = { 'us-east-1' => {'aki-4c7d9525' => 'pv-grub-hd00-V1.01-i386',
866
866
  'aki-4e7d9527' => 'pv-grub-hd00-V1.01-x86_64',
867
867
  'aki-407d9529' => 'pv-grub-hd0-V1.01-i386',
@@ -909,6 +909,8 @@ module StateTransitionHelper
909
909
  }
910
910
  }
911
911
  target_aki = ''
912
+ source_region = get_aws_region_from_endpoint(source_endpoint)
913
+ target_region = get_aws_region_from_endpoint(target_endpoint)
912
914
  post_message("mapping AKI '#{source_aki}' from #{source_region} region to #{target_region} region...")
913
915
 
914
916
  if map[source_region] == nil
@@ -933,6 +935,24 @@ module StateTransitionHelper
933
935
  return target_aki
934
936
  end
935
937
 
938
+ def get_aws_region_from_endpoint(endpoint)
939
+ region = "us-east-1"
940
+ case endpoint
941
+ when /us-east/
942
+ region = "us-east-1"
943
+ when /us-west/
944
+ region = "us-west-1"
945
+ when /eu-west/
946
+ region = "eu-west-1"
947
+ when /ap-southeast/
948
+ region = "ap-southeast-1"
949
+ when /ap-northeast/
950
+ region = "ap-northeast-1"
951
+ else
952
+ region = "us-east-1"
953
+ end
954
+ return region
955
+ end
936
956
 
937
957
  #setting/retrieving handlers
938
958
 
@@ -62,7 +62,6 @@ class CopyAmi < Ec2Script
62
62
  if @input_params[:target_ssh_username] == nil
63
63
  @input_params[:target_ssh_username] = "root"
64
64
  end
65
-
66
65
  end
67
66
 
68
67
  # Load the initial state for the script.
@@ -214,8 +213,10 @@ class CopyAmi < Ec2Script
214
213
  def enter()
215
214
  remote_region()
216
215
  # Get Amazon Kernel Image ID
217
- aki = get_aws_kernel_image_aki(@context[:ec2_api_handler].server.split('.')[1], @context[:kernel_id],
218
- @context[:target_ec2_handler].server.split('.')[1])
216
+ #aki = get_aws_kernel_image_aki(@context[:ec2_api_handler].server.split('.')[0], @context[:kernel_id],
217
+ # @context[:target_ec2_handler].server.split('.')[0])
218
+ aki = get_aws_kernel_image_aki(@context[:ec2_api_handler].server, @context[:kernel_id],
219
+ @context[:target_ec2_handler].server)
219
220
  #@context[:result][:image_id] = register_snapshot(@context[:new_snapshot_id], @context[:name],
220
221
  # @context[:root_device_name], @context[:description], nil,
221
222
  # nil, @context[:architecture])
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: CloudyScripts
3
3
  version: !ruby/object:Gem::Version
4
- hash: 119
4
+ hash: 117
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 8
9
- - 32
10
- version: 1.8.32
9
+ - 33
10
+ version: 1.8.33
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matthias Jung