novawhiz 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/novawhiz.rb +41 -0
- metadata +61 -0
data/lib/novawhiz.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'openstack'
|
2
|
+
|
3
|
+
class NovaWhiz
|
4
|
+
|
5
|
+
attr_accessor :os
|
6
|
+
|
7
|
+
def initialize(opts)
|
8
|
+
@os = OpenStack::Connection.create(
|
9
|
+
:username => opts[:username],
|
10
|
+
:api_key => opts[:password],
|
11
|
+
:authtenant => opts[:authtenant],
|
12
|
+
:auth_url => opts[:auth_url],
|
13
|
+
:service_type => "compute")
|
14
|
+
end
|
15
|
+
|
16
|
+
def flavor_id(name)
|
17
|
+
flavors = @os.flavors.select { |f| f[:name] == name }
|
18
|
+
raise "ambiguous/unknown flavor: #{name}" unless flavors.length == 1
|
19
|
+
flavors.first[:id]
|
20
|
+
end
|
21
|
+
|
22
|
+
def image_id(reg)
|
23
|
+
images = @os.images.select { |i| i[:name] =~ reg }
|
24
|
+
raise "ambiguous/unknown image: #{reg} : #{images.inspect}" unless images.length == 1
|
25
|
+
images.first[:id]
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
{
|
30
|
+
:ip => 'xxx',
|
31
|
+
:user => 'xxx',
|
32
|
+
:key => 'xxx'
|
33
|
+
}
|
34
|
+
|
35
|
+
def boot(opts)
|
36
|
+
opts[:flavor] ||= 'standard.xsmall'
|
37
|
+
opts[:image] ||= /Precise/
|
38
|
+
raise 'no name provided' if !opts[:name] or opts[:name].empty?
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: novawhiz
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- tim miller
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-09-11 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: openstack
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
description: library and command line tool for simplifying openstack nova operations
|
31
|
+
email: none@example.com
|
32
|
+
executables: []
|
33
|
+
extensions: []
|
34
|
+
extra_rdoc_files: []
|
35
|
+
files:
|
36
|
+
- lib/novawhiz.rb
|
37
|
+
homepage: http://rubygems.org/gems/novawhiz
|
38
|
+
licenses: []
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
requirements: []
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 1.8.24
|
58
|
+
signing_key:
|
59
|
+
specification_version: 3
|
60
|
+
summary: simplify nova operations
|
61
|
+
test_files: []
|