ubuntu_ami 0.4.1 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b7478b9edc80983b43047540a08d14defff4aecb4f1447125b6b7959422aa9bc
4
+ data.tar.gz: 0b777e5e522d85e4977b1b5e0f40f1d8cf74f3223ec31a2b723aed14ef344751
5
+ SHA512:
6
+ metadata.gz: ae445e0ef42236866a29d5cb9aebdb541154f492ff5a84e71f98c967880679e4110f15cfe7b76d2e25882198276ca29b55d33e32b57a84f5fcd178a7e95247fc
7
+ data.tar.gz: 9de7c2e0dbb47afb5a934b054bd5a7ed71fef427f7986c247edf5fce5b5ed17f315eb455a8623da95dfe4f44f13f428fbd8c74aa2f5260795c89c6fb201f4602
@@ -43,15 +43,31 @@ module KnifePlugins
43
43
  region.gsub(/-1/,'').gsub(/-/,'_')
44
44
  end
45
45
 
46
+ # Identifies the virtualization type as HVM if image is HVM.
47
+ #
48
+ # === Parameters
49
+ # type<String>:: comes from Ubuntu::Ami#virtualization_type
50
+ #
51
+ # === Returns
52
+ # String:: "_hvm" if the #virtualization_type is HVM, otherwise empty.
53
+ def virt_type(type)
54
+ type =~ /hvm/ ? "_hvm" : ''
55
+ end
56
+
46
57
  # Indicates whether a particular image has EBS root volume.
47
58
  #
48
59
  # === Parameters
49
60
  # store<String>:: comes from Ubuntu::Ami#root_store
50
61
  #
51
62
  # === Returns
52
- # String:: "_ebs" if the #root_store is EBS, otherwise empty.
63
+ # String:: "_ebs" if the #root_store is EBS, _ebs_ssd if ebs-ssd,
64
+ # _ebs_io1 if provisioned IOPS, etc. Otherwise empty.
53
65
  def disk_store(store)
54
- store =~ /ebs/ ? "_ebs" : ''
66
+ if store =~ /ebs/
67
+ "_#{store.tr('-', '_')}"
68
+ else
69
+ ''
70
+ end
55
71
  end
56
72
 
57
73
  # Indicates whether the architecture type is a large or small AMI.
@@ -80,8 +96,8 @@ module KnifePlugins
80
96
  # === Returns
81
97
  # String:: The region, arch and root_store (if EBS) concatenated
82
98
  # with underscore (_).
83
- def build_type(region, arch, root_store)
84
- "#{region_fix(region)}_#{size_of(arch)}#{disk_store(root_store)}"
99
+ def build_type(region, arch, root_store, type)
100
+ "#{region_fix(region)}_#{size_of(arch)}#{disk_store(root_store)}#{virt_type(type)}"
85
101
  end
86
102
 
87
103
  # Iterates over the AMIs available for the specified distro.
@@ -94,7 +110,7 @@ module KnifePlugins
94
110
  def list_amis(distro)
95
111
  amis = Hash.new
96
112
  Ubuntu.release(distro).amis.each do |ami|
97
- amis[build_type(ami.region, ami.arch, ami.root_store)] = ami.name
113
+ amis[build_type(ami.region, ami.arch, ami.root_store, ami.virtualization_type)] = ami.name
98
114
  end
99
115
  amis
100
116
  end
@@ -17,6 +17,6 @@
17
17
 
18
18
  class Ubuntu
19
19
  class Ami
20
- VERSION = '0.4.1'
20
+ VERSION = '0.4.5'
21
21
  end
22
22
  end
data/lib/ubuntu_ami.rb CHANGED
@@ -58,7 +58,7 @@ class Ubuntu
58
58
  # === Returns
59
59
  # String:: The full URL to the released AMIs.
60
60
  def url
61
- "http://uec-images.ubuntu.com/query/#{release_name}/server/released.current.txt"
61
+ "http://cloud-images.ubuntu.com/query/#{release_name}/server/released.current.txt"
62
62
  end
63
63
 
64
64
  # Reads the URL for processing.
@@ -67,7 +67,7 @@ class Ubuntu
67
67
  # not found.
68
68
  def content
69
69
  begin
70
- @content ||= open(url).read.split("\n")
70
+ @content ||= ::OpenURI.open_uri(url).read.split("\n")
71
71
  rescue
72
72
  raise "Could not find AMI list for distro release '#{release_name}', did you specify it correctly? (e.g., 'lucid')"
73
73
  end
metadata CHANGED
@@ -1,52 +1,47 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ubuntu_ami
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
5
- prerelease:
4
+ version: 0.4.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Joshua Timberman
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-02 00:00:00.000000000 Z
11
+ date: 2022-05-06 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: Retrieves AMI information from Canonical's Ubuntu release list.Also provides
15
14
  a knife plugin to retrieve the list.
16
- email: joshua@opscode.com
15
+ email: joshua@chef.io
17
16
  executables: []
18
17
  extensions: []
19
- extra_rdoc_files:
20
- - README.md
21
- - LICENSE
18
+ extra_rdoc_files: []
22
19
  files:
23
20
  - LICENSE
24
- - README.md
25
21
  - lib/chef/knife/ec2_amis_ubuntu.rb
26
- - lib/ubuntu_ami/version.rb
27
22
  - lib/ubuntu_ami.rb
28
- homepage: http://github.com/jtimberman/ubuntu_ami
29
- licenses: []
23
+ - lib/ubuntu_ami/version.rb
24
+ homepage: https://github.com/jtimberman/ubuntu_ami
25
+ licenses:
26
+ - Apache-2.0
27
+ metadata: {}
30
28
  post_install_message:
31
29
  rdoc_options: []
32
30
  require_paths:
33
31
  - lib
34
32
  required_ruby_version: !ruby/object:Gem::Requirement
35
- none: false
36
33
  requirements:
37
- - - ! '>='
34
+ - - ">="
38
35
  - !ruby/object:Gem::Version
39
36
  version: '0'
40
37
  required_rubygems_version: !ruby/object:Gem::Requirement
41
- none: false
42
38
  requirements:
43
- - - ! '>='
39
+ - - ">="
44
40
  - !ruby/object:Gem::Version
45
41
  version: '0'
46
42
  requirements: []
47
- rubyforge_project:
48
- rubygems_version: 1.8.23
43
+ rubygems_version: 3.1.6
49
44
  signing_key:
50
- specification_version: 3
45
+ specification_version: 4
51
46
  summary: Retrieves AMI information from Canonical's Ubuntu release list.
52
47
  test_files: []
data/README.md DELETED
@@ -1,53 +0,0 @@
1
- This gem provides a library for retrieving Canonical's Ubuntu AMI
2
- release list for Amazon EC2.
3
-
4
- It also includes a knife plugin to easily retrieve AMIs for launching
5
- instances with Chef.
6
-
7
- # Usage
8
-
9
- Find an AMI based on criteria:
10
-
11
- ami = Ubuntu.release("lucid").amis.find do |ami|
12
- ami.arch == "amd64" and
13
- ami.root_store == "instance-store" and
14
- ami.region == "us-east-1"
15
- end
16
-
17
- Return certain information about the AMIs:
18
-
19
- Ubuntu.release("lucid").amis.each do |ami|
20
- puts "#{ami.region} #{ami.name} (#{ami.arch}, #{ami.root_store})"
21
- end
22
-
23
- Use the knife plugin with Knife, from Chef. Pass just a distro name
24
- for the list of available AMIs by type:
25
-
26
- knife ec2 amis ubuntu lucid
27
-
28
- The first column will be the available types, and the second is the
29
- associated AMI. Specify the type to return just the AMI.
30
-
31
- knife ec2 amis ubuntu lucid us_east_small
32
-
33
- The type is made up of the region, the architecture size (small for 32
34
- bit, large for 64 bit). If the AMI is an EBS root store, that will be indicated.
35
-
36
- # License and Authors
37
-
38
- Author:: Joshua Timberman (<joshua@housepub.org>)
39
- Author:: Michael Hale (<mike@hales.ws>)
40
-
41
- Copyright:: 2011, Joshua Timberman
42
-
43
- Licensed under the Apache License, Version 2.0 (the "License");
44
- you may not use this file except in compliance with the License.
45
- You may obtain a copy of the License at
46
-
47
- http://www.apache.org/licenses/LICENSE-2.0
48
-
49
- Unless required by applicable law or agreed to in writing, software
50
- distributed under the License is distributed on an "AS IS" BASIS,
51
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
52
- See the License for the specific language governing permissions and
53
- limitations under the License.