cft_smartcloud 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/cft_smartcloud.gemspec +199 -205
- data/lib/smartcloud.rb +41 -41
- metadata +12 -13
- data/.gitignore +0 -3
data/Rakefile
CHANGED
@@ -7,9 +7,9 @@ begin
|
|
7
7
|
gem.name = "cft_smartcloud"
|
8
8
|
gem.summary = %Q{CohesiveFT IBM SmartCloud API Gem}
|
9
9
|
gem.description = %Q{CohesiveFT Ruby Interface for IBM SmartCloud and 'smartcloud' command line helper.}
|
10
|
-
gem.email = "
|
10
|
+
gem.email = "rubygems@cohesiveft.com"
|
11
11
|
gem.homepage = "http://github.com/cohesive/cft_smartcloud"
|
12
|
-
gem.authors = ["
|
12
|
+
gem.authors = ["cohesive", "yan"]
|
13
13
|
# gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
14
14
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
15
|
end
|
@@ -42,7 +42,7 @@ task :test => :check_dependencies
|
|
42
42
|
|
43
43
|
task :default => :test
|
44
44
|
|
45
|
-
require '
|
45
|
+
require 'rdoc/task'
|
46
46
|
Rake::RDocTask.new do |rdoc|
|
47
47
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
48
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.3
|
data/cft_smartcloud.gemspec
CHANGED
@@ -1,230 +1,224 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{cft_smartcloud}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["
|
12
|
-
s.date = %q{
|
11
|
+
s.authors = ["cohesive", "yan"]
|
12
|
+
s.date = %q{2013-01-09}
|
13
13
|
s.description = %q{CohesiveFT Ruby Interface for IBM SmartCloud and 'smartcloud' command line helper.}
|
14
|
-
s.email = %q{
|
14
|
+
s.email = %q{rubygems@cohesiveft.com}
|
15
15
|
s.executables = ["cft_smartcloud", "smartcloud"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE",
|
18
|
-
|
18
|
+
"README.md"
|
19
19
|
]
|
20
20
|
s.files = [
|
21
|
-
"
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
"test/helper.rb"
|
21
|
+
"CHANGELOG",
|
22
|
+
"LICENSE",
|
23
|
+
"README.md",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"bin/cft_smartcloud",
|
27
|
+
"bin/smartcloud",
|
28
|
+
"cft_smartcloud.gemspec",
|
29
|
+
"lib/config/config.yml",
|
30
|
+
"lib/curl_client.rb",
|
31
|
+
"lib/dynamic_help_generator.rb",
|
32
|
+
"lib/hash_fix.rb",
|
33
|
+
"lib/mime-types-1.16/History.txt",
|
34
|
+
"lib/mime-types-1.16/Install.txt",
|
35
|
+
"lib/mime-types-1.16/Licence.txt",
|
36
|
+
"lib/mime-types-1.16/Manifest.txt",
|
37
|
+
"lib/mime-types-1.16/README.txt",
|
38
|
+
"lib/mime-types-1.16/Rakefile",
|
39
|
+
"lib/mime-types-1.16/lib/mime/types.rb",
|
40
|
+
"lib/mime-types-1.16/lib/mime/types.rb.data",
|
41
|
+
"lib/mime-types-1.16/mime-types.gemspec",
|
42
|
+
"lib/mime-types-1.16/setup.rb",
|
43
|
+
"lib/mime-types-1.16/test/test_mime_type.rb",
|
44
|
+
"lib/mime-types-1.16/test/test_mime_types.rb",
|
45
|
+
"lib/mock_smartcloud.rb",
|
46
|
+
"lib/rest-client-1.6.6-master/.gitignore",
|
47
|
+
"lib/rest-client-1.6.6-master/README.rdoc",
|
48
|
+
"lib/rest-client-1.6.6-master/Rakefile",
|
49
|
+
"lib/rest-client-1.6.6-master/VERSION",
|
50
|
+
"lib/rest-client-1.6.6-master/bin/restclient",
|
51
|
+
"lib/rest-client-1.6.6-master/history.md",
|
52
|
+
"lib/rest-client-1.6.6-master/lib/rest-client.rb",
|
53
|
+
"lib/rest-client-1.6.6-master/lib/rest_client.rb",
|
54
|
+
"lib/rest-client-1.6.6-master/lib/restclient.rb",
|
55
|
+
"lib/rest-client-1.6.6-master/lib/restclient/abstract_response.rb",
|
56
|
+
"lib/rest-client-1.6.6-master/lib/restclient/exceptions.rb",
|
57
|
+
"lib/rest-client-1.6.6-master/lib/restclient/net_http_ext.rb",
|
58
|
+
"lib/rest-client-1.6.6-master/lib/restclient/payload.rb",
|
59
|
+
"lib/rest-client-1.6.6-master/lib/restclient/raw_response.rb",
|
60
|
+
"lib/rest-client-1.6.6-master/lib/restclient/request.rb",
|
61
|
+
"lib/rest-client-1.6.6-master/lib/restclient/resource.rb",
|
62
|
+
"lib/rest-client-1.6.6-master/lib/restclient/response.rb",
|
63
|
+
"lib/rest-client-1.6.6-master/rest-client.gemspec",
|
64
|
+
"lib/rest-client-1.6.6-master/spec/abstract_response_spec.rb",
|
65
|
+
"lib/rest-client-1.6.6-master/spec/base.rb",
|
66
|
+
"lib/rest-client-1.6.6-master/spec/exceptions_spec.rb",
|
67
|
+
"lib/rest-client-1.6.6-master/spec/integration/certs/equifax.crt",
|
68
|
+
"lib/rest-client-1.6.6-master/spec/integration/certs/verisign.crt",
|
69
|
+
"lib/rest-client-1.6.6-master/spec/integration/request_spec.rb",
|
70
|
+
"lib/rest-client-1.6.6-master/spec/integration_spec.rb",
|
71
|
+
"lib/rest-client-1.6.6-master/spec/master_shake.jpg",
|
72
|
+
"lib/rest-client-1.6.6-master/spec/payload_spec.rb",
|
73
|
+
"lib/rest-client-1.6.6-master/spec/raw_response_spec.rb",
|
74
|
+
"lib/rest-client-1.6.6-master/spec/request2_spec.rb",
|
75
|
+
"lib/rest-client-1.6.6-master/spec/request_spec.rb",
|
76
|
+
"lib/rest-client-1.6.6-master/spec/resource_spec.rb",
|
77
|
+
"lib/rest-client-1.6.6-master/spec/response_spec.rb",
|
78
|
+
"lib/rest-client-1.6.6-master/spec/restclient_spec.rb",
|
79
|
+
"lib/restclient_fix.rb",
|
80
|
+
"lib/slop-2.3.1/.gemtest",
|
81
|
+
"lib/slop-2.3.1/.gitignore",
|
82
|
+
"lib/slop-2.3.1/.yardopts",
|
83
|
+
"lib/slop-2.3.1/CHANGES.md",
|
84
|
+
"lib/slop-2.3.1/LICENSE",
|
85
|
+
"lib/slop-2.3.1/README.md",
|
86
|
+
"lib/slop-2.3.1/Rakefile",
|
87
|
+
"lib/slop-2.3.1/lib/slop.rb",
|
88
|
+
"lib/slop-2.3.1/slop.gemspec",
|
89
|
+
"lib/slop-2.3.1/test/commands_test.rb",
|
90
|
+
"lib/slop-2.3.1/test/helper.rb",
|
91
|
+
"lib/slop-2.3.1/test/option_test.rb",
|
92
|
+
"lib/slop-2.3.1/test/slop_test.rb",
|
93
|
+
"lib/smartcloud.rb",
|
94
|
+
"lib/smartcloud_logger.rb",
|
95
|
+
"lib/terminal-table-1.4.4/History.rdoc",
|
96
|
+
"lib/terminal-table-1.4.4/Manifest",
|
97
|
+
"lib/terminal-table-1.4.4/README.rdoc",
|
98
|
+
"lib/terminal-table-1.4.4/Rakefile",
|
99
|
+
"lib/terminal-table-1.4.4/Todo.rdoc",
|
100
|
+
"lib/terminal-table-1.4.4/examples/examples.rb",
|
101
|
+
"lib/terminal-table-1.4.4/lib/terminal-table.rb",
|
102
|
+
"lib/terminal-table-1.4.4/lib/terminal-table/cell.rb",
|
103
|
+
"lib/terminal-table-1.4.4/lib/terminal-table/core_ext.rb",
|
104
|
+
"lib/terminal-table-1.4.4/lib/terminal-table/import.rb",
|
105
|
+
"lib/terminal-table-1.4.4/lib/terminal-table/row.rb",
|
106
|
+
"lib/terminal-table-1.4.4/lib/terminal-table/separator.rb",
|
107
|
+
"lib/terminal-table-1.4.4/lib/terminal-table/style.rb",
|
108
|
+
"lib/terminal-table-1.4.4/lib/terminal-table/table.rb",
|
109
|
+
"lib/terminal-table-1.4.4/lib/terminal-table/table_helper.rb",
|
110
|
+
"lib/terminal-table-1.4.4/lib/terminal-table/version.rb",
|
111
|
+
"lib/terminal-table-1.4.4/spec/cell_spec.rb",
|
112
|
+
"lib/terminal-table-1.4.4/spec/core_ext_spec.rb",
|
113
|
+
"lib/terminal-table-1.4.4/spec/import_spec.rb",
|
114
|
+
"lib/terminal-table-1.4.4/spec/spec.opts",
|
115
|
+
"lib/terminal-table-1.4.4/spec/spec_helper.rb",
|
116
|
+
"lib/terminal-table-1.4.4/spec/table_spec.rb",
|
117
|
+
"lib/terminal-table-1.4.4/tasks/docs.rake",
|
118
|
+
"lib/terminal-table-1.4.4/tasks/gemspec.rake",
|
119
|
+
"lib/terminal-table-1.4.4/tasks/spec.rake",
|
120
|
+
"lib/terminal-table-1.4.4/terminal-table.gemspec",
|
121
|
+
"lib/xml-simple-1.0.12/lib/xmlsimple.rb",
|
122
|
+
"rdoc/classes/ConfigTable.html",
|
123
|
+
"rdoc/classes/ConfigTable/BoolItem.html",
|
124
|
+
"rdoc/classes/ConfigTable/ExecItem.html",
|
125
|
+
"rdoc/classes/ConfigTable/Item.html",
|
126
|
+
"rdoc/classes/ConfigTable/MetaConfigEnvironment.html",
|
127
|
+
"rdoc/classes/ConfigTable/PackageSelectionItem.html",
|
128
|
+
"rdoc/classes/ConfigTable/PathItem.html",
|
129
|
+
"rdoc/classes/ConfigTable/ProgramItem.html",
|
130
|
+
"rdoc/classes/ConfigTable/SelectItem.html",
|
131
|
+
"rdoc/classes/Enumerable.html",
|
132
|
+
"rdoc/classes/Errno.html",
|
133
|
+
"rdoc/classes/Errno/ENOTEMPTY.html",
|
134
|
+
"rdoc/classes/File.html",
|
135
|
+
"rdoc/classes/FileOperations.html",
|
136
|
+
"rdoc/classes/Hash.html",
|
137
|
+
"rdoc/classes/HookScriptAPI.html",
|
138
|
+
"rdoc/classes/IBMSmartCloud.html",
|
139
|
+
"rdoc/classes/Installer.html",
|
140
|
+
"rdoc/classes/Installer/Shebang.html",
|
141
|
+
"rdoc/classes/MIME.html",
|
142
|
+
"rdoc/classes/MIME/InvalidContentType.html",
|
143
|
+
"rdoc/classes/MIME/Type.html",
|
144
|
+
"rdoc/classes/MIME/Types.html",
|
145
|
+
"rdoc/classes/MockSmartCloud.html",
|
146
|
+
"rdoc/classes/Net.html",
|
147
|
+
"rdoc/classes/Net/HTTP.html",
|
148
|
+
"rdoc/classes/RestClient.html",
|
149
|
+
"rdoc/classes/RestClient/AbstractResponse.html",
|
150
|
+
"rdoc/classes/RestClient/Exception.html",
|
151
|
+
"rdoc/classes/RestClient/ExceptionWithResponse.html",
|
152
|
+
"rdoc/classes/RestClient/Exceptions.html",
|
153
|
+
"rdoc/classes/RestClient/MaxRedirectsReached.html",
|
154
|
+
"rdoc/classes/RestClient/Payload.html",
|
155
|
+
"rdoc/classes/RestClient/Payload/Base.html",
|
156
|
+
"rdoc/classes/RestClient/Payload/Multipart.html",
|
157
|
+
"rdoc/classes/RestClient/Payload/Streamed.html",
|
158
|
+
"rdoc/classes/RestClient/Payload/UrlEncoded.html",
|
159
|
+
"rdoc/classes/RestClient/RawResponse.html",
|
160
|
+
"rdoc/classes/RestClient/Redirect.html",
|
161
|
+
"rdoc/classes/RestClient/Request.html",
|
162
|
+
"rdoc/classes/RestClient/RequestFailed.html",
|
163
|
+
"rdoc/classes/RestClient/Resource.html",
|
164
|
+
"rdoc/classes/RestClient/Response.html",
|
165
|
+
"rdoc/classes/RestClient/ResponseForException.html",
|
166
|
+
"rdoc/classes/RestClient/SSLCertificateNotVerified.html",
|
167
|
+
"rdoc/classes/RestClient/ServerBrokeConnection.html",
|
168
|
+
"rdoc/classes/SetupError.html",
|
169
|
+
"rdoc/classes/SmartcloudLogger.html",
|
170
|
+
"rdoc/classes/TestMIME.html",
|
171
|
+
"rdoc/classes/ToplevelInstaller.html",
|
172
|
+
"rdoc/classes/ToplevelInstallerMulti.html",
|
173
|
+
"rdoc/classes/XmlSimple.html",
|
174
|
+
"rdoc/classes/XmlSimple/Cache.html",
|
175
|
+
"rdoc/created.rid",
|
176
|
+
"rdoc/files/README_rdoc.html",
|
177
|
+
"rdoc/files/lib/hash_fix_rb.html",
|
178
|
+
"rdoc/files/lib/mime-types-1_16/lib/mime/types_rb.html",
|
179
|
+
"rdoc/files/lib/mime-types-1_16/setup_rb.html",
|
180
|
+
"rdoc/files/lib/mime-types-1_16/test/test_mime_type_rb.html",
|
181
|
+
"rdoc/files/lib/mime-types-1_16/test/test_mime_types_rb.html",
|
182
|
+
"rdoc/files/lib/mock_smartcloud_rb.html",
|
183
|
+
"rdoc/files/lib/rest-client-1_6_3/lib/rest-client_rb.html",
|
184
|
+
"rdoc/files/lib/rest-client-1_6_3/lib/rest_client_rb.html",
|
185
|
+
"rdoc/files/lib/rest-client-1_6_3/lib/restclient/abstract_response_rb.html",
|
186
|
+
"rdoc/files/lib/rest-client-1_6_3/lib/restclient/exceptions_rb.html",
|
187
|
+
"rdoc/files/lib/rest-client-1_6_3/lib/restclient/net_http_ext_rb.html",
|
188
|
+
"rdoc/files/lib/rest-client-1_6_3/lib/restclient/payload_rb.html",
|
189
|
+
"rdoc/files/lib/rest-client-1_6_3/lib/restclient/raw_response_rb.html",
|
190
|
+
"rdoc/files/lib/rest-client-1_6_3/lib/restclient/request_rb.html",
|
191
|
+
"rdoc/files/lib/rest-client-1_6_3/lib/restclient/resource_rb.html",
|
192
|
+
"rdoc/files/lib/rest-client-1_6_3/lib/restclient/response_rb.html",
|
193
|
+
"rdoc/files/lib/rest-client-1_6_3/lib/restclient_rb.html",
|
194
|
+
"rdoc/files/lib/restclient_fix_rb.html",
|
195
|
+
"rdoc/files/lib/smartcloud_logger_rb.html",
|
196
|
+
"rdoc/files/lib/smartcloud_rb.html",
|
197
|
+
"rdoc/files/lib/xml-simple-1_0_12/lib/xmlsimple_rb.html",
|
198
|
+
"rdoc/fr_class_index.html",
|
199
|
+
"rdoc/fr_file_index.html",
|
200
|
+
"rdoc/fr_method_index.html",
|
201
|
+
"rdoc/index.html",
|
202
|
+
"rdoc/rdoc-style.css",
|
203
|
+
"responses/addresses",
|
204
|
+
"responses/addresses.blank",
|
205
|
+
"responses/instances",
|
206
|
+
"responses/keys",
|
207
|
+
"responses/locations",
|
208
|
+
"responses/offerings_image",
|
209
|
+
"responses/storage",
|
210
|
+
"script/console",
|
211
|
+
"test/helper.rb"
|
213
212
|
]
|
214
213
|
s.homepage = %q{http://github.com/cohesive/cft_smartcloud}
|
215
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
216
214
|
s.require_paths = ["lib"]
|
217
|
-
s.rubygems_version = %q{1.
|
215
|
+
s.rubygems_version = %q{1.5.2}
|
218
216
|
s.summary = %q{CohesiveFT IBM SmartCloud API Gem}
|
219
|
-
s.test_files = [
|
220
|
-
"test/helper.rb"
|
221
|
-
]
|
222
217
|
|
223
218
|
if s.respond_to? :specification_version then
|
224
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
225
219
|
s.specification_version = 3
|
226
220
|
|
227
|
-
if Gem::Version.new(Gem::
|
221
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
228
222
|
else
|
229
223
|
end
|
230
224
|
else
|
data/lib/smartcloud.rb
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
#####################################################################################
|
3
3
|
# Copyright (c) 2011, Cohesive Flexible Technologies, Inc.
|
4
4
|
# This copyrighted material is the property of Cohesive Flexible Technologies and
|
5
|
-
# is subject to the license terms of the product it is contained within, whether
|
6
|
-
# in text or compiled form. It is licensed under the terms expressed in the
|
5
|
+
# is subject to the license terms of the product it is contained within, whether
|
6
|
+
# in text or compiled form. It is licensed under the terms expressed in the
|
7
7
|
# accompanying README and LICENSE files.
|
8
|
-
#
|
9
|
-
# This program is AS IS and WITHOUT ANY WARRANTY; without even the implied warranty
|
8
|
+
#
|
9
|
+
# This program is AS IS and WITHOUT ANY WARRANTY; without even the implied warranty
|
10
10
|
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
11
11
|
#####################################################################################
|
12
12
|
|
@@ -41,7 +41,7 @@ class IBMSmartCloud
|
|
41
41
|
# For handling errors
|
42
42
|
@retries = (opts[:retries] || 120).to_i
|
43
43
|
@sleep_interval = (opts[:sleep_interval] || 30).to_i
|
44
|
-
|
44
|
+
|
45
45
|
@username = opts[:username] || ENV['SMARTCLOUD_USERNAME'] || raise(RuntimeError, "Please specify username in an option or as ENV variable SMARTCLOUD_USERNAME")
|
46
46
|
@password = opts[:password]|| ENV['SMARTCLOUD_PASSWORD'] || raise(RuntimeError, "Please specify password in an option or as ENV variable SMARTCLOUD_PASSWORD")
|
47
47
|
@logger = opts[:logger] || SmartcloudLogger.new(STDOUT)
|
@@ -52,8 +52,8 @@ class IBMSmartCloud
|
|
52
52
|
|
53
53
|
@api_url = (opts[:api_url] || @config["api_url"]).to_s.dup # gotta dup it because the option string is frozen
|
54
54
|
@api_url.gsub!("https://", "https://#{CGI::escape(@username)}:#{CGI::escape(@password)}@")
|
55
|
-
|
56
|
-
@http_client = Kernel.const_get(@config["http_client"])
|
55
|
+
|
56
|
+
@http_client = Kernel.const_get(@config["http_client"])
|
57
57
|
@http_client.timeout = 120 # ibm requests can be very slow
|
58
58
|
@http_client.log = @logger if @debug
|
59
59
|
end
|
@@ -97,7 +97,7 @@ class IBMSmartCloud
|
|
97
97
|
# or API-style (imageID, location). If the CLI-style params are
|
98
98
|
# provided, they will be remapped to the correct API params.
|
99
99
|
help_for :create_instance, [:instance_params_hash], %{
|
100
|
-
Available hash keys: :name, :imageID, :instanceType, :location, :publicKey, :ip, :volumeID,
|
100
|
+
Available hash keys: :name, :imageID, :instanceType, :location, :publicKey, :ip, :volumeID,
|
101
101
|
:ConfigurationData, :vlanID, :antiCollocationInstance, :isMiniEphemeral
|
102
102
|
|
103
103
|
Example: smartcloud "create_instance(:name => 'MyTest', :instanceType=>'COP32.1/2048/60', ...)"
|
@@ -120,10 +120,10 @@ class IBMSmartCloud
|
|
120
120
|
instance_params.delete("description")
|
121
121
|
|
122
122
|
# configuration data has to be changed from a string like
|
123
|
-
# <configuration>{contextmanager:test-c3-master.cohesiveft.com,clustername:TEST_poc_pk0515,role:[nfs-client-setup|newyork_master_refdata_member|install-luci|rhel-openlikewise-client-setup|join-domain],hostname:r550n107}</configuration>
|
123
|
+
# <configuration>{contextmanager:test-c3-master.cohesiveft.com,clustername:TEST_poc_pk0515,role:[nfs-client-setup|newyork_master_refdata_member|install-luci|rhel-openlikewise-client-setup|join-domain],hostname:r550n107}</configuration>
|
124
124
|
# to a standard list of POST params like
|
125
125
|
# contextmanager=test-c3-mager&clustername=TEST...
|
126
|
-
configuration_data = instance_params.delete("configuration") || instance_params.delete("ConfigurationData")
|
126
|
+
configuration_data = instance_params.delete("configuration") || instance_params.delete("ConfigurationData")
|
127
127
|
if configuration_data
|
128
128
|
if configuration_data =~ /\s+/
|
129
129
|
logger.warn "<configuration> tag should not contain spaces! Correct format looks like: <configuration>{foo:bar,baz:quux}</configuration>. Spaces will be removed."
|
@@ -195,14 +195,14 @@ class IBMSmartCloud
|
|
195
195
|
response.Volume.ID
|
196
196
|
end
|
197
197
|
|
198
|
-
help_for :import_image, [{:name=>:req, :volume_id => :req}]
|
198
|
+
help_for :import_image, [{:name=>:req, :volume_id => :req}]
|
199
199
|
def import_image(name, volume_id)
|
200
200
|
# TODO: this is a complete guess as we have no info from IBM as to the URL for this api, only the parameters
|
201
201
|
response = post("/offerings/image", :volumeId => volume_id, :name => name)
|
202
202
|
response.Image.ID
|
203
203
|
end
|
204
204
|
|
205
|
-
help_for :delete_image, [:image_id => :req],
|
205
|
+
help_for :delete_image, [:image_id => :req],
|
206
206
|
def delete_image(image_id)
|
207
207
|
delete("/offerings/image/#{image_id}")
|
208
208
|
true
|
@@ -213,7 +213,7 @@ class IBMSmartCloud
|
|
213
213
|
}
|
214
214
|
def delete_images(*image_id_list)
|
215
215
|
threads=[]
|
216
|
-
image_id_list.each {|image|
|
216
|
+
image_id_list.each {|image|
|
217
217
|
threads << Thread.new { logger.info "Sending delete request for: #{image}..."; delete_image(image); logger.info "Finished delete request for #{image}" }
|
218
218
|
}
|
219
219
|
threads.each(&:join)
|
@@ -230,12 +230,12 @@ class IBMSmartCloud
|
|
230
230
|
|
231
231
|
help_for :attach_volume, [:instance_id, :volume_id]
|
232
232
|
def attach_volume(instance_id, volume_id)
|
233
|
-
put("/instances/#{instance_id}", :
|
233
|
+
put("/instances/#{instance_id}", :storageID => volume_id, :type => 'attach')
|
234
234
|
end
|
235
235
|
|
236
236
|
help_for :detach_volume, [:instance_id, :volume_id]
|
237
237
|
def detach_volume(instance_id, volume_id)
|
238
|
-
put("/instances/#{instance_id}", :
|
238
|
+
put("/instances/#{instance_id}", :storageID => volume_id, :type => 'detach')
|
239
239
|
end
|
240
240
|
|
241
241
|
# Delete the volume
|
@@ -250,7 +250,7 @@ class IBMSmartCloud
|
|
250
250
|
}
|
251
251
|
def delete_volumes(*vol_id_list)
|
252
252
|
threads=[]
|
253
|
-
vol_id_list.each {|vol|
|
253
|
+
vol_id_list.each {|vol|
|
254
254
|
threads << Thread.new { logger.info "Sending delete request for: #{vol}..."; delete_volume(vol); logger.info "Finished delete request for #{vol}" }
|
255
255
|
}
|
256
256
|
threads.each(&:join)
|
@@ -258,8 +258,8 @@ class IBMSmartCloud
|
|
258
258
|
end
|
259
259
|
|
260
260
|
# generates a keypair and returns the private key
|
261
|
-
help_for :generate_keypair, [{:name=>:req}, {:publicKey=>:opt}], %{
|
262
|
-
If publicKey parameter is given, creates a key with that public key, and returns nothing.
|
261
|
+
help_for :generate_keypair, [{:name=>:req}, {:publicKey=>:opt}], %{
|
262
|
+
If publicKey parameter is given, creates a key with that public key, and returns nothing.
|
263
263
|
If public key is omitted, generates a new key and returns the pirvate key.
|
264
264
|
}
|
265
265
|
def generate_keypair(name, publicKey=nil)
|
@@ -328,7 +328,7 @@ class IBMSmartCloud
|
|
328
328
|
arrayize(get("/keys").PublicKey)
|
329
329
|
end
|
330
330
|
|
331
|
-
def display_keys
|
331
|
+
def display_keys
|
332
332
|
keys = describe_keys
|
333
333
|
|
334
334
|
table = Terminal::Table.new do |t|
|
@@ -337,7 +337,7 @@ class IBMSmartCloud
|
|
337
337
|
t.add_row [k.KeyName, (k.Instances.empty? ? '[NONE]' : arrayize(k.Instances.InstanceID).join("\n")), time_format( k.LastModifiedTime )]
|
338
338
|
end
|
339
339
|
end
|
340
|
-
|
340
|
+
|
341
341
|
logger.info table
|
342
342
|
end
|
343
343
|
alias display_keypairs display_keys
|
@@ -386,7 +386,7 @@ class IBMSmartCloud
|
|
386
386
|
# Large == 2048 GB
|
387
387
|
#
|
388
388
|
help_for :create_volume, [{:name => :req},{:location_id => :req},
|
389
|
-
{:size => ['Small','Medium','Large','60','256','512','1024','2048','4112','8224','10240']},
|
389
|
+
{:size => ['Small','Medium','Large','60','256','512','1024','2048','4112','8224','10240']},
|
390
390
|
{:offering_id => :opt}, {:format => :opt}]
|
391
391
|
def create_volume(name, location, size, offering_id=nil, format="EXT3")
|
392
392
|
|
@@ -394,7 +394,7 @@ class IBMSmartCloud
|
|
394
394
|
if offering_id.nil?
|
395
395
|
logger.debug "Looking up volume offerings based on location: #{location} and size: #{size}"
|
396
396
|
|
397
|
-
filter_size = ( ["Small", "Medium", "Large"].include?( size )) ? size: "Storage"
|
397
|
+
filter_size = ( ["Small", "Medium", "Large"].include?( size )) ? size: "Storage"
|
398
398
|
offering = describe_volume_offerings(location, filter_size)
|
399
399
|
if( offering && offering.SupportedSizes.split(",").include?(size) || ["Small", "Medium", "Large"].include?( size ))
|
400
400
|
offering_id = offering.ID
|
@@ -439,7 +439,7 @@ class IBMSmartCloud
|
|
439
439
|
|
440
440
|
logger.info table
|
441
441
|
end
|
442
|
-
|
442
|
+
|
443
443
|
alias display_storage display_volumes
|
444
444
|
|
445
445
|
# Allows you to poll for a specific storage state
|
@@ -525,13 +525,13 @@ class IBMSmartCloud
|
|
525
525
|
delete("/instances/#{instance_id}")
|
526
526
|
true
|
527
527
|
end
|
528
|
-
|
528
|
+
|
529
529
|
help_for :restart_instance, [:instance_id]
|
530
530
|
def restart_instance(instance_id)
|
531
531
|
put("/instances/#{instance_id}", :state => "restart")
|
532
532
|
true
|
533
533
|
end
|
534
|
-
|
534
|
+
|
535
535
|
help_for :save_instance, [:instance_id, :name, :desc]
|
536
536
|
def save_instance(instance_id, name, desc = "")
|
537
537
|
put("/instances/#{instance_id}", :state => "save", :name => name, :description => desc)
|
@@ -551,7 +551,7 @@ class IBMSmartCloud
|
|
551
551
|
help_for :describe_instances, [:filters => :opt]
|
552
552
|
def describe_instances(filters={})
|
553
553
|
instances = arrayize(get("instances").Instance)
|
554
|
-
|
554
|
+
|
555
555
|
instances.each do |instance|
|
556
556
|
instance["Status"] = @states["instance"][instance.Status.to_i]
|
557
557
|
end
|
@@ -587,7 +587,7 @@ class IBMSmartCloud
|
|
587
587
|
def describe_image(image_id)
|
588
588
|
image = get("offerings/image/#{image_id}").Image
|
589
589
|
image["State"] = @states["image"][image.State.to_i]
|
590
|
-
image
|
590
|
+
image
|
591
591
|
end
|
592
592
|
|
593
593
|
help_for :describe_images, [:filters => :opt]
|
@@ -642,7 +642,7 @@ class IBMSmartCloud
|
|
642
642
|
end
|
643
643
|
|
644
644
|
# Save Response for posterity
|
645
|
-
if @save_response && !output.empty?
|
645
|
+
if @save_response && !output.empty?
|
646
646
|
logger.info "Saving response to: #{@save_response}"
|
647
647
|
File.open(@save_response,'w') {|f| f.write(output)}
|
648
648
|
end
|
@@ -667,16 +667,16 @@ class IBMSmartCloud
|
|
667
667
|
|
668
668
|
# Custom exception matcher
|
669
669
|
def timeouts_and_500s
|
670
|
-
m = Module.new
|
670
|
+
m = Module.new
|
671
671
|
(class << m; self; end).instance_eval do
|
672
672
|
define_method(:===) do |e|
|
673
|
-
[RestClient::RequestTimeout, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, Errno::ETIMEDOUT,
|
673
|
+
[RestClient::RequestTimeout, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, Errno::ETIMEDOUT,
|
674
674
|
EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError].include?(e.class)|| e.message =~ /500/
|
675
675
|
end
|
676
676
|
end
|
677
677
|
m
|
678
678
|
end
|
679
|
-
|
679
|
+
|
680
680
|
# rest client error details are in the response so we want to
|
681
681
|
# display that as the error, otherwise we lose that info
|
682
682
|
def rescue_and_retry_errors(&block)
|
@@ -697,15 +697,15 @@ class IBMSmartCloud
|
|
697
697
|
raise e
|
698
698
|
end
|
699
699
|
rescue => e
|
700
|
-
if e.respond_to?(:response)
|
701
|
-
raise "#{e.message} - #{e.response}"
|
700
|
+
if e.respond_to?(:response)
|
701
|
+
raise "#{e.message} - #{e.response}"
|
702
702
|
else
|
703
703
|
raise e
|
704
704
|
end
|
705
705
|
end
|
706
706
|
|
707
|
-
def make_param_string(params, param_remap)
|
708
|
-
param_string = params.map do |k,v|
|
707
|
+
def make_param_string(params, param_remap)
|
708
|
+
param_string = params.map do |k,v|
|
709
709
|
k=k.to_s # symbol keys turn to string
|
710
710
|
|
711
711
|
# logger.debug "Removing all spaces from parameters, smartcloud API does not allow spaces."
|
@@ -719,7 +719,7 @@ class IBMSmartCloud
|
|
719
719
|
end
|
720
720
|
|
721
721
|
def filter_and_sort(instances=[], filters={})
|
722
|
-
order_by = filters.delete(:order)
|
722
|
+
order_by = filters.delete(:order)
|
723
723
|
|
724
724
|
filters.each do |filter, value|
|
725
725
|
filter = filter.to_sym
|
@@ -731,21 +731,21 @@ class IBMSmartCloud
|
|
731
731
|
end
|
732
732
|
end
|
733
733
|
|
734
|
-
instances = instances.sort_by{|ins|
|
735
|
-
if ins.has_key?(order_by)
|
736
|
-
order_by_value = ins.send(order_by)
|
734
|
+
instances = instances.sort_by{|ins|
|
735
|
+
if ins.has_key?(order_by)
|
736
|
+
order_by_value = ins.send(order_by)
|
737
737
|
integer_sort = order_by_value.to_i
|
738
738
|
# If we are trying to sort by an integer field, i.e. 41.to_s=="41" then sort by the integer
|
739
739
|
# version of it, otherwise sort by the original string
|
740
740
|
order_by_value = (order_by_value == integer_sort.to_s) ? integer_sort : order_by_value
|
741
741
|
else
|
742
|
-
0
|
742
|
+
0
|
743
743
|
end
|
744
744
|
}
|
745
745
|
if order_by == "LaunchTime"
|
746
746
|
instances = instances.reverse
|
747
747
|
end
|
748
|
-
|
748
|
+
|
749
749
|
instances
|
750
750
|
end
|
751
751
|
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cft_smartcloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 21
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 3
|
10
|
+
version: 0.3.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
|
-
- yan
|
14
13
|
- cohesive
|
14
|
+
- yan
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date:
|
19
|
+
date: 2013-01-09 00:00:00 -06:00
|
20
20
|
default_executable:
|
21
21
|
dependencies: []
|
22
22
|
|
23
23
|
description: CohesiveFT Ruby Interface for IBM SmartCloud and 'smartcloud' command line helper.
|
24
|
-
email:
|
24
|
+
email: rubygems@cohesiveft.com
|
25
25
|
executables:
|
26
26
|
- cft_smartcloud
|
27
27
|
- smartcloud
|
@@ -31,7 +31,6 @@ extra_rdoc_files:
|
|
31
31
|
- LICENSE
|
32
32
|
- README.md
|
33
33
|
files:
|
34
|
-
- .gitignore
|
35
34
|
- CHANGELOG
|
36
35
|
- LICENSE
|
37
36
|
- README.md
|
@@ -228,8 +227,8 @@ homepage: http://github.com/cohesive/cft_smartcloud
|
|
228
227
|
licenses: []
|
229
228
|
|
230
229
|
post_install_message:
|
231
|
-
rdoc_options:
|
232
|
-
|
230
|
+
rdoc_options: []
|
231
|
+
|
233
232
|
require_paths:
|
234
233
|
- lib
|
235
234
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -253,9 +252,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
253
252
|
requirements: []
|
254
253
|
|
255
254
|
rubyforge_project:
|
256
|
-
rubygems_version: 1.
|
255
|
+
rubygems_version: 1.5.2
|
257
256
|
signing_key:
|
258
257
|
specification_version: 3
|
259
258
|
summary: CohesiveFT IBM SmartCloud API Gem
|
260
|
-
test_files:
|
261
|
-
|
259
|
+
test_files: []
|
260
|
+
|
data/.gitignore
DELETED