forj 0.0.19 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/forj +17 -10
- data/lib/boot.rb +16 -14
- data/lib/connection.rb +5 -1
- data/lib/down.rb +28 -18
- data/lib/network.rb +9 -5
- data/lib/repositories.rb +7 -3
- data/lib/security.rb +7 -19
- data/lib/setup.rb +5 -0
- data/lib/ssh.rb +1 -0
- data/lib/yaml_parse.rb +5 -1
- metadata +13 -13
- data/lib/compute.rb +0 -62
data/bin/forj
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
2
3
|
|
3
4
|
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
|
4
5
|
#
|
@@ -61,39 +62,45 @@ class Forj < Thor
|
|
61
62
|
end
|
62
63
|
|
63
64
|
desc 'boot', 'boot a Maestro box and instruct it to provision the blueprint'
|
64
|
-
|
65
|
-
method_option :
|
66
|
-
method_option :
|
67
|
-
|
65
|
+
|
66
|
+
method_option :build_conf_dir, :aliases => '-bcd', :desc => 'Defines the build configuration directory to load the build configuration file. You can set FORJ_BLD_CONF_DIR. By default, it will look in your current directory.'
|
67
|
+
method_option :build_conf, :aliases => '-bc', :desc => 'The build config file to load <confdir>/<BoxName>.<Config>.env. By default, uses "master" as Config.'
|
68
|
+
method_option :branch, :aliases => '-gb', :desc => 'The build will extract from git branch name. It sets the configuration build <config> to the branch name <branch>.'
|
69
|
+
method_option :test_box, :aliases => '-tb', :desc => 'Create test-box meta from the repository path provided.'
|
70
|
+
method_option :git_repo, :aliases => '-gr', :desc => 'The box built will use a different git repository sent out to <user_data>. This repository needs to be read only. No keys are sent.'
|
71
|
+
method_option :boothook, :aliases => '-b', :desc => 'By default, boothook file used is build/bin/build-tools/boothook.sh. Use this option to set another one.'
|
72
|
+
method_option :box_name, :aliases => '-bn', :desc => 'Defines the name of the box or box image to build.'
|
73
|
+
|
74
|
+
def boot(blueprint, on, cloud_provider, as, name, test = false)
|
68
75
|
build_conf_dir = options[:build_conf_dir]
|
69
76
|
branch = options[:branch]
|
70
77
|
unless branch
|
71
78
|
branch = 'master'
|
72
79
|
end
|
73
80
|
if options[:build_conf_dir]
|
74
|
-
Boot
|
81
|
+
Boot::boot(blueprint, cloud_provider, name, build_conf_dir, branch, test)
|
75
82
|
else
|
76
|
-
Boot
|
83
|
+
Boot::boot(blueprint, cloud_provider, name, nil, nil, test)
|
77
84
|
end
|
78
85
|
|
79
86
|
end
|
80
87
|
|
81
88
|
desc 'down', 'delete the Maestro box and all systems installed by the blueprint'
|
82
89
|
def down(name)
|
83
|
-
Down
|
90
|
+
Down::down(name)
|
84
91
|
end
|
85
92
|
|
86
|
-
desc 'ssh', ''
|
93
|
+
desc 'ssh', 'connect to your forge thru ssh'
|
87
94
|
def ssh
|
88
95
|
puts 'ssh'
|
89
96
|
end
|
90
97
|
|
91
98
|
desc 'setup', 'set the credentials for forj cli'
|
92
99
|
def setup
|
93
|
-
Setup
|
100
|
+
Setup::setup
|
94
101
|
end
|
95
102
|
|
96
103
|
end
|
97
104
|
|
98
105
|
|
99
|
-
Forj.start
|
106
|
+
Forj.start
|
data/lib/boot.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
2
3
|
|
3
4
|
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
|
4
5
|
#
|
@@ -16,8 +17,6 @@
|
|
16
17
|
|
17
18
|
require 'require_relative'
|
18
19
|
|
19
|
-
require_relative 'compute.rb'
|
20
|
-
include Compute
|
21
20
|
require_relative 'network.rb'
|
22
21
|
include Network
|
23
22
|
require_relative 'yaml_parse.rb'
|
@@ -27,12 +26,15 @@ include SecurityGroup
|
|
27
26
|
require_relative 'repositories.rb'
|
28
27
|
include Repositories
|
29
28
|
|
30
|
-
|
29
|
+
#
|
30
|
+
# Boot module
|
31
|
+
#
|
31
32
|
module Boot
|
32
|
-
def boot(blueprint, cloud_provider, name, build_config_dir, branch, test=false)
|
33
|
+
def boot(blueprint, cloud_provider, name, build_config_dir, branch, test = false)
|
33
34
|
begin
|
34
35
|
|
35
|
-
puts 'booting %
|
36
|
+
puts format('booting %{blueprint} on %{cloud_provider}',
|
37
|
+
blueprint: blueprint , cloud_provider: cloud_provider)
|
36
38
|
|
37
39
|
# get definitions from yaml
|
38
40
|
forj_dir = File.expand_path(File.dirname(__FILE__))
|
@@ -46,10 +48,10 @@ module Boot
|
|
46
48
|
network = Network.create_network(name)
|
47
49
|
subnet = Network.create_subnet(network.id, name)
|
48
50
|
router = Network.get_router(definitions[blueprint]['router'])
|
49
|
-
Network
|
51
|
+
Network::create_router_interface(subnet.id, router)
|
50
52
|
|
51
53
|
# create the security groups for the blueprint
|
52
|
-
security_group = SecurityGroup
|
54
|
+
security_group = SecurityGroup::create_security_group(blueprint)
|
53
55
|
|
54
56
|
ports = definitions['redstone']['ports']
|
55
57
|
|
@@ -68,10 +70,12 @@ module Boot
|
|
68
70
|
build_path = home + '/.hpcloud/maestro/build'
|
69
71
|
Dir.chdir(build_path)
|
70
72
|
|
71
|
-
if build_config_dir
|
72
|
-
command = 'bin/build.sh --build_ID maestro.%
|
73
|
+
if build_config_dir
|
74
|
+
command = format('bin/build.sh --build_ID maestro.%{name} --box-name maestro --build-conf-dir %{build_config_dir} --build-config box-13.5 --gitBranch %{branch}', name: name, build_config_dir: build_config_dir, branch: branch)
|
75
|
+
elsif name != 'redstone'
|
76
|
+
command = format('bin/build.sh --build_ID %{name} --box-name maestro --build-conf-dir ~/.hpcloud/maestro/build/conf --build-config box --blueprint %{blueprint_name}', name: name, blueprint_name: blueprint)
|
73
77
|
else
|
74
|
-
command = 'bin/build.sh --build_ID %
|
78
|
+
command = format('bin/build.sh --build_ID %{name} --box-name maestro --build-conf-dir ~/.hpcloud/maestro/build/conf --build-config box', name: name)
|
75
79
|
end
|
76
80
|
|
77
81
|
Kernel.system(command)
|
@@ -86,10 +90,8 @@ module Boot
|
|
86
90
|
|
87
91
|
rescue SystemExit, Interrupt
|
88
92
|
puts 'process interrupted by user'
|
89
|
-
rescue
|
93
|
+
rescue StandardError => e
|
90
94
|
puts e
|
91
95
|
end
|
92
|
-
|
93
96
|
end
|
94
|
-
|
95
|
-
end
|
97
|
+
end
|
data/lib/connection.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
2
3
|
|
3
4
|
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
|
4
5
|
#
|
@@ -20,6 +21,9 @@ require 'require_relative'
|
|
20
21
|
require_relative 'yaml_parse.rb'
|
21
22
|
include YamlParse
|
22
23
|
|
24
|
+
#
|
25
|
+
# Connection module
|
26
|
+
#
|
23
27
|
module Connection
|
24
28
|
|
25
29
|
def compute
|
@@ -42,7 +46,7 @@ module Connection
|
|
42
46
|
:hp_secret_key => credentials['secret_key'],
|
43
47
|
:hp_auth_uri => credentials['auth_uri'],
|
44
48
|
:hp_tenant_id => credentials['tenant_id'],
|
45
|
-
:hp_avl_zone => credentials['availability_zone']
|
49
|
+
:hp_avl_zone => credentials['availability_zone']
|
46
50
|
})
|
47
51
|
end
|
48
52
|
|
data/lib/down.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
2
3
|
|
3
4
|
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
|
4
5
|
#
|
@@ -16,8 +17,6 @@
|
|
16
17
|
|
17
18
|
require 'require_relative'
|
18
19
|
|
19
|
-
require_relative 'compute.rb'
|
20
|
-
include Compute
|
21
20
|
require_relative 'network.rb'
|
22
21
|
include Network
|
23
22
|
require_relative 'yaml_parse.rb'
|
@@ -25,29 +24,40 @@ include YamlParse
|
|
25
24
|
require_relative 'security.rb'
|
26
25
|
include SecurityGroup
|
27
26
|
|
27
|
+
#
|
28
|
+
# Down module
|
29
|
+
#
|
28
30
|
module Down
|
29
31
|
def down(name)
|
30
|
-
|
32
|
+
begin
|
33
|
+
|
34
|
+
puts format('deleting %{name}...', name: name)
|
35
|
+
|
36
|
+
definitions = YamlParse::get_values('../lib/catalog.yaml')
|
31
37
|
|
32
|
-
|
38
|
+
# first step is to delete the instance
|
39
|
+
Compute.delete_instance(name)
|
33
40
|
|
34
|
-
|
35
|
-
|
41
|
+
# get the subnet
|
42
|
+
subnet = Network::get_subnet(name)
|
36
43
|
|
37
|
-
|
38
|
-
|
44
|
+
# delete the router interface
|
45
|
+
router = Network::get_router(definitions['redstone']['router'])
|
46
|
+
Network.delete_router_interface(subnet.id, router)
|
39
47
|
|
40
|
-
|
41
|
-
|
42
|
-
Network.delete_router_interface(subnet.id, router)
|
48
|
+
# delete subnet
|
49
|
+
Network.delete_subnet(subnet.id)
|
43
50
|
|
44
|
-
|
45
|
-
|
51
|
+
# delete security group
|
52
|
+
# Network.delete_security_group(security_group.id)
|
46
53
|
|
47
|
-
|
48
|
-
|
54
|
+
# delete network
|
55
|
+
Network.delete_network(name)
|
49
56
|
|
50
|
-
|
51
|
-
|
57
|
+
rescue SystemExit, Interrupt
|
58
|
+
puts 'process interrupted by user'
|
59
|
+
rescue Exception => e
|
60
|
+
puts e
|
61
|
+
end
|
52
62
|
end
|
53
|
-
end
|
63
|
+
end
|
data/lib/network.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
2
3
|
|
3
4
|
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
|
4
5
|
#
|
@@ -19,6 +20,9 @@ require 'require_relative'
|
|
19
20
|
require_relative 'connection.rb'
|
20
21
|
include Connection
|
21
22
|
|
23
|
+
#
|
24
|
+
# Network module
|
25
|
+
#
|
22
26
|
module Network
|
23
27
|
|
24
28
|
def create_network(name)
|
@@ -83,7 +87,8 @@ end
|
|
83
87
|
def get_next_subnet
|
84
88
|
subnet_values = Array.new
|
85
89
|
subnets = Connection.network.subnets.all
|
86
|
-
|
90
|
+
|
91
|
+
subnets.each do|s|
|
87
92
|
subnet_values.push(s.cidr)
|
88
93
|
end
|
89
94
|
|
@@ -95,11 +100,11 @@ def get_next_subnet
|
|
95
100
|
|
96
101
|
subnet_values = subnet_values.sort!
|
97
102
|
|
98
|
-
|
103
|
+
subnet_values.each do|value|
|
99
104
|
range_used.push(value[5])
|
100
105
|
end
|
101
106
|
|
102
|
-
|
107
|
+
range_used.each do |n|
|
103
108
|
if count.to_i == n.to_i
|
104
109
|
else
|
105
110
|
new_subnet = count
|
@@ -117,5 +122,4 @@ def get_next_subnet
|
|
117
122
|
new_cidr = '10.0.%s.0/24' % [new_subnet]
|
118
123
|
end
|
119
124
|
new_cidr
|
120
|
-
|
121
|
-
end
|
125
|
+
end
|
data/lib/repositories.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
2
3
|
|
3
4
|
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
|
4
5
|
#
|
@@ -21,10 +22,13 @@ require 'require_relative'
|
|
21
22
|
require_relative 'yaml_parse.rb'
|
22
23
|
include YamlParse
|
23
24
|
|
25
|
+
#
|
26
|
+
# Repositories module
|
27
|
+
#
|
24
28
|
module Repositories
|
25
29
|
def clone_repo
|
26
30
|
|
27
|
-
definitions = YamlParse
|
31
|
+
definitions = YamlParse::get_values('../lib/catalog.yaml')
|
28
32
|
maestro_url = definitions['default']['maestro']
|
29
33
|
|
30
34
|
home = File.expand_path('~')
|
@@ -38,8 +42,8 @@ module Repositories
|
|
38
42
|
Git.clone(maestro_url, 'maestro', :path => path)
|
39
43
|
end
|
40
44
|
rescue
|
41
|
-
puts 'Error while cloning the repo from %
|
45
|
+
puts format('Error while cloning the repo from %{maestro_url}', maestro_url: maestro_url)
|
42
46
|
puts 'If this error persist you could clone the repo manually in ~/.hpcloud/'
|
43
47
|
end
|
44
48
|
end
|
45
|
-
end
|
49
|
+
end
|
data/lib/security.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
2
3
|
|
3
4
|
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
|
4
5
|
#
|
@@ -19,12 +20,13 @@ require 'require_relative'
|
|
19
20
|
require_relative 'connection.rb'
|
20
21
|
include Connection
|
21
22
|
|
22
|
-
#
|
23
|
-
|
23
|
+
#
|
24
|
+
# SecurityGroup module
|
25
|
+
#
|
24
26
|
module SecurityGroup
|
25
27
|
|
26
28
|
def create_security_group(name)
|
27
|
-
description = 'Security group for blueprint %
|
29
|
+
description = format('Security group for blueprint %{name}', name: name)
|
28
30
|
Connection.network.security_groups.create(
|
29
31
|
:name => name,
|
30
32
|
:description => description
|
@@ -46,25 +48,11 @@ module SecurityGroup
|
|
46
48
|
:remote_ip_prefix => '0.0.0.0/0'
|
47
49
|
)
|
48
50
|
rescue StandardError
|
49
|
-
puts 'error creating the rule for port %
|
51
|
+
puts format('error creating the rule for port %{port_min}', port_min: port_min)
|
50
52
|
end
|
51
|
-
|
52
53
|
end
|
53
54
|
|
54
55
|
def delete_security_group_rule(rule_id)
|
55
56
|
Connection.network.security_group_rules.get(rule_id).destroy
|
56
57
|
end
|
57
|
-
|
58
|
-
def upload_keypair(name)
|
59
|
-
begin
|
60
|
-
home = File.expand_path('~')
|
61
|
-
path = home + '/.hpcloud/' + name
|
62
|
-
# this will create a new keypair
|
63
|
-
key_pair = Connection.compute.key_pairs.create(:name => name)
|
64
|
-
key_pair.write(path)
|
65
|
-
rescue StandardError
|
66
|
-
puts 'error uploading the keypair'
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|
58
|
+
end
|
data/lib/setup.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
2
3
|
|
3
4
|
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
|
4
5
|
#
|
@@ -14,8 +15,12 @@
|
|
14
15
|
# See the License for the specific language governing permissions and
|
15
16
|
# limitations under the License.
|
16
17
|
|
18
|
+
#
|
19
|
+
# Setup module call the hpcloud functions
|
20
|
+
#
|
17
21
|
module Setup
|
18
22
|
def setup
|
23
|
+
# delegate the initial configuration to hpcloud (unix_cli)
|
19
24
|
Kernel.system('hpcloud account:setup')
|
20
25
|
Kernel.system('hpcloud keypairs:add nova')
|
21
26
|
end
|
data/lib/ssh.rb
CHANGED
data/lib/yaml_parse.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
2
3
|
|
3
4
|
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
|
4
5
|
#
|
@@ -16,8 +17,11 @@
|
|
16
17
|
|
17
18
|
require 'yaml'
|
18
19
|
|
20
|
+
#
|
21
|
+
# YamlParse module
|
22
|
+
#
|
19
23
|
module YamlParse
|
20
24
|
def get_values(path_to_yaml)
|
21
25
|
YAML.load_file(path_to_yaml)
|
22
26
|
end
|
23
|
-
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.20
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2014-06-12 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement: &
|
16
|
+
requirement: &12245580 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.16.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *12245580
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: fog
|
27
|
-
requirement: &
|
27
|
+
requirement: &12245000 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.22.1
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *12245000
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: hpcloud
|
38
|
-
requirement: &
|
38
|
+
requirement: &12244360 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.0.6
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *12244360
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: git
|
49
|
-
requirement: &
|
49
|
+
requirement: &12243700 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.2.7
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *12243700
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rbx-require-relative
|
60
|
-
requirement: &
|
60
|
+
requirement: &12242860 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: 0.0.9
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *12242860
|
69
69
|
description: forj command line
|
70
70
|
email:
|
71
71
|
- forj@forj.io
|
@@ -75,7 +75,6 @@ extensions: []
|
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
77
|
- bin/forj
|
78
|
-
- lib/compute.rb
|
79
78
|
- lib/connection.rb
|
80
79
|
- lib/network.rb
|
81
80
|
- lib/security.rb
|
@@ -89,7 +88,8 @@ files:
|
|
89
88
|
homepage: https://forj.io
|
90
89
|
licenses:
|
91
90
|
- Apache License, Version 2.0.
|
92
|
-
post_install_message: Go to docs.forj.io for more
|
91
|
+
post_install_message: ! "Go to docs.forj.io for more\n information
|
92
|
+
on how to use forj cli"
|
93
93
|
rdoc_options: []
|
94
94
|
require_paths:
|
95
95
|
- lib
|
data/lib/compute.rb
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require 'require_relative'
|
18
|
-
|
19
|
-
require_relative 'connection.rb'
|
20
|
-
include Connection
|
21
|
-
|
22
|
-
module Compute
|
23
|
-
|
24
|
-
def get_image(image_name)
|
25
|
-
compute = Connection.compute
|
26
|
-
|
27
|
-
images = compute.images.all
|
28
|
-
image = nil
|
29
|
-
|
30
|
-
for i in images do
|
31
|
-
if i.name == image_name
|
32
|
-
image = i
|
33
|
-
end
|
34
|
-
end
|
35
|
-
image
|
36
|
-
end
|
37
|
-
|
38
|
-
def get_flavor(flavor_name)
|
39
|
-
compute = Connection.compute
|
40
|
-
|
41
|
-
flavors = compute.flavors.all
|
42
|
-
flavor = nil
|
43
|
-
|
44
|
-
for f in flavors do
|
45
|
-
if f.name == flavor_name
|
46
|
-
flavor = f
|
47
|
-
end
|
48
|
-
end
|
49
|
-
flavor
|
50
|
-
end
|
51
|
-
|
52
|
-
def delete_instance(maestro)
|
53
|
-
result = Connection.compute.servers.all(:name => maestro)[0]
|
54
|
-
name = result.name
|
55
|
-
if name.include? maestro
|
56
|
-
Connection.compute.servers.get(result.id).destroy
|
57
|
-
else
|
58
|
-
puts '%s not found' % [maestro]
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|