openstudio-aws 0.1.22 → 0.1.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/lib/openstudio-aws.rb +2 -3
  3. data/lib/openstudio/aws/aws.rb +44 -46
  4. data/lib/openstudio/aws/config.rb +3 -3
  5. data/lib/openstudio/aws/version.rb +1 -1
  6. data/lib/openstudio/lib/ami_list.rb +24 -26
  7. data/lib/openstudio/lib/mongoid.yml.template +0 -1
  8. data/lib/openstudio/lib/openstudio_aws_instance.rb +45 -48
  9. data/lib/openstudio/lib/openstudio_aws_logger.rb +5 -5
  10. data/lib/openstudio/lib/openstudio_aws_methods.rb +52 -54
  11. data/lib/openstudio/lib/openstudio_aws_wrapper.rb +89 -94
  12. data/lib/openstudio/lib/os-aws.rb +46 -46
  13. data/lib/openstudio/lib/server_script.sh +45 -16
  14. data/lib/openstudio/lib/worker_script.sh.template +15 -6
  15. data/spec/aws_instances/aws_spec_api.rb +15 -15
  16. data/spec/openstudio-aws/ami_list_spec.rb +14 -14
  17. data/spec/openstudio-aws/aws_methods_spec.rb +7 -9
  18. data/spec/openstudio-aws/aws_spec.rb +43 -47
  19. data/spec/openstudio-aws/aws_wrapper_spec.rb +39 -41
  20. data/spec/openstudio-aws/config_spec.rb +2 -2
  21. data/spec/reports/SPEC-OpenStudio-Aws-Aws-ami-lists.7.xml +11 -0
  22. data/spec/reports/SPEC-OpenStudio-Aws-Aws-ami-lists.8.xml +11 -0
  23. data/spec/reports/SPEC-OpenStudio-Aws-Aws-proxy-configuration.36.xml +13 -0
  24. data/spec/reports/SPEC-OpenStudio-Aws-Aws-proxy-configuration.37.xml +13 -0
  25. data/spec/reports/SPEC-OpenStudio-Aws-Aws-should-error.4.xml +9 -0
  26. data/spec/reports/SPEC-OpenStudio-Aws-Aws-should-error.5.xml +9 -0
  27. data/spec/reports/SPEC-OpenStudio-Aws-Aws-version-testing.4.xml +9 -0
  28. data/spec/reports/SPEC-OpenStudio-Aws-Aws-version-testing.5.xml +9 -0
  29. data/spec/reports/SPEC-OpenStudio-Aws-Aws.42.xml +7 -0
  30. data/spec/reports/SPEC-OpenStudio-Aws-Aws.43.xml +7 -0
  31. data/spec/reports/SPEC-OpenStudio-Aws-Config-create-a-new-config.61.xml +9 -0
  32. data/spec/reports/SPEC-OpenStudio-Aws-Config-create-a-new-config.62.xml +9 -0
  33. data/spec/reports/SPEC-OpenStudio-Aws-Config.61.xml +7 -0
  34. data/spec/reports/SPEC-OpenStudio-Aws-Config.62.xml +7 -0
  35. data/spec/reports/SPEC-OpenStudioAmis-version-1.63.xml +13 -0
  36. data/spec/reports/SPEC-OpenStudioAmis-version-1.64.xml +13 -0
  37. data/spec/reports/SPEC-OpenStudioAmis-version-2.61.xml +9 -0
  38. data/spec/reports/SPEC-OpenStudioAmis-version-2.62.xml +9 -0
  39. data/spec/reports/SPEC-OpenStudioAmis.63.xml +7 -0
  40. data/spec/reports/SPEC-OpenStudioAmis.64.xml +7 -0
  41. data/spec/reports/SPEC-OpenStudioAwsMethods-processors.63.xml +11 -0
  42. data/spec/reports/SPEC-OpenStudioAwsMethods-processors.64.xml +11 -0
  43. data/spec/reports/SPEC-OpenStudioAwsMethods.63.xml +7 -0
  44. data/spec/reports/SPEC-OpenStudioAwsMethods.64.xml +7 -0
  45. data/spec/reports/SPEC-OpenStudioAwsWrapper-ami-list.1.xml +9 -0
  46. data/spec/reports/SPEC-OpenStudioAwsWrapper-ami-list.2.xml +9 -0
  47. data/spec/reports/SPEC-OpenStudioAwsWrapper-authenticated-session-availability.62.xml +11 -0
  48. data/spec/reports/SPEC-OpenStudioAwsWrapper-authenticated-session-availability.63.xml +11 -0
  49. data/spec/reports/SPEC-OpenStudioAwsWrapper-authenticated-session-create-new-ami-json.53.xml +11 -0
  50. data/spec/reports/SPEC-OpenStudioAwsWrapper-authenticated-session-create-new-ami-json.54.xml +11 -0
  51. data/spec/reports/SPEC-OpenStudioAwsWrapper-authenticated-session-new-instance.62.xml +9 -0
  52. data/spec/reports/SPEC-OpenStudioAwsWrapper-authenticated-session-new-instance.63.xml +9 -0
  53. data/spec/reports/SPEC-OpenStudioAwsWrapper-authenticated-session-version-1.11.xml +87 -0
  54. data/spec/reports/SPEC-OpenStudioAwsWrapper-authenticated-session-version-1.12.xml +87 -0
  55. data/spec/reports/SPEC-OpenStudioAwsWrapper-authenticated-session-version-2.11.xml +821 -0
  56. data/spec/reports/SPEC-OpenStudioAwsWrapper-authenticated-session-version-2.12.xml +821 -0
  57. data/spec/reports/SPEC-OpenStudioAwsWrapper-authenticated-session.62.xml +7 -0
  58. data/spec/reports/SPEC-OpenStudioAwsWrapper-authenticated-session.63.xml +7 -0
  59. data/spec/reports/SPEC-OpenStudioAwsWrapper-unauthenticated-session.63.xml +9 -0
  60. data/spec/reports/SPEC-OpenStudioAwsWrapper-unauthenticated-session.64.xml +9 -0
  61. data/spec/reports/SPEC-OpenStudioAwsWrapper.63.xml +7 -0
  62. data/spec/reports/SPEC-OpenStudioAwsWrapper.64.xml +7 -0
  63. data/spec/spec_helper.rb +1 -4
  64. metadata +85 -1
@@ -1,18 +1,18 @@
1
1
  # NOTE: Do not modify this file as it is copied over. Modify the source file and rerun rake import_files
2
2
  ######################################################################
3
- # Copyright (c) 2008-2014, Alliance for Sustainable Energy.
3
+ # Copyright (c) 2008-2014, Alliance for Sustainable Energy.
4
4
  # All rights reserved.
5
- #
5
+ #
6
6
  # This library is free software; you can redistribute it and/or
7
7
  # modify it under the terms of the GNU Lesser General Public
8
8
  # License as published by the Free Software Foundation; either
9
9
  # version 2.1 of the License, or (at your option) any later version.
10
- #
10
+ #
11
11
  # This library is distributed in the hope that it will be useful,
12
12
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
13
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
14
  # Lesser General Public License for more details.
15
- #
15
+ #
16
16
  # You should have received a copy of the GNU Lesser General Public
17
17
  # License along with this library; if not, write to the Free Software
18
18
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@@ -52,10 +52,10 @@ require 'base64'
52
52
  def error(code, msg)
53
53
  puts (
54
54
  {
55
- :error => {
56
- :code => code, :message => msg
57
- },
58
- :arguments => ARGV[2..-1]
55
+ error: {
56
+ code: code, message: msg
57
+ },
58
+ arguments: ARGV[2..-1]
59
59
  }.to_json
60
60
  )
61
61
  exit(1)
@@ -81,7 +81,7 @@ if ARGV[4].empty?
81
81
  error(-1, 'Missing command argument')
82
82
  end
83
83
 
84
- Aws.config = {:access_key_id => ARGV[0], :secret_access_key => ARGV[1], :region => ARGV[2], :ssl_verify_peer => false}
84
+ Aws.config = { access_key_id: ARGV[0], secret_access_key: ARGV[1], region: ARGV[2], ssl_verify_peer: false }
85
85
 
86
86
  if ARGV[3] == 'EC2'
87
87
  @aws = Aws::EC2.new
@@ -100,11 +100,11 @@ end
100
100
 
101
101
  OPENSTUDIO_VERSION = '1.1.4' unless defined?(OPENSTUDIO_VERSION)
102
102
 
103
- SERVER_PEM_FILENAME = File.expand_path("~/openstudio-server.pem")
103
+ SERVER_PEM_FILENAME = File.expand_path('~/openstudio-server.pem')
104
104
 
105
- if (!defined?(@server_image_id) || !defined?(@worker_image_id))
105
+ if !defined?(@server_image_id) || !defined?(@worker_image_id)
106
106
  amis = OpenStudioAmis.new(1, OPENSTUDIO_VERSION)
107
-
107
+
108
108
  if amis
109
109
  @server_image_id = amis['server']
110
110
  if ARGV.length >= 6 && @params['instance_type'] == 'cc2.8xlarge'
@@ -118,8 +118,8 @@ if (!defined?(@server_image_id) || !defined?(@worker_image_id))
118
118
  end
119
119
 
120
120
  begin
121
- @logger = Logger.new(File.expand_path("~/.aws.log"))
122
- @logger.info("initialized")
121
+ @logger = Logger.new(File.expand_path('~/.aws.log'))
122
+ @logger.info('initialized')
123
123
  case ARGV[4]
124
124
  when 'describe_availability_zones'
125
125
  os_aws = OpenStudioAwsWrapper.new
@@ -137,15 +137,15 @@ begin
137
137
  if ARGV.length < 6
138
138
  resp = os_aws.describe_instance_status
139
139
  else
140
- resp = os_aws.describe_instance_status({:instance_ids => [@params['instance_id']]})
140
+ resp = os_aws.describe_instance_status(instance_ids: [@params['instance_id']])
141
141
  end
142
- #resp = nil
143
- #if ARGV.length < 6
142
+ # resp = nil
143
+ # if ARGV.length < 6
144
144
  # resp = @aws.client.describe_instance_status
145
- #else
145
+ # else
146
146
  # resp = @aws.client.describe_instance_status({:instance_ids => [@params['instance_id']]})
147
- #end
148
- output = Hash.new
147
+ # end
148
+ output = {}
149
149
  resp.data[:instance_status_set].each { |instance|
150
150
  output[instance[:instance_id]] = instance[:instance_state][:name]
151
151
  }
@@ -155,11 +155,11 @@ begin
155
155
  error(-1, 'Invalid number of args')
156
156
  end
157
157
  os_aws = OpenStudioAwsWrapper.new
158
- os_aws.create_or_retrieve_security_group("openstudio-server-sg-v1")
158
+ os_aws.create_or_retrieve_security_group('openstudio-server-sg-v1')
159
159
  os_aws.create_or_retrieve_key_pair
160
160
 
161
161
  # this step is really important because this is read from the worker nodes. We
162
- # should not be printing this to screen nor putting into the log in case the
162
+ # should not be printing this to screen nor putting into the log in case the
163
163
  # user is starting to used shared keys.
164
164
  os_aws.save_private_key(SERVER_PEM_FILENAME)
165
165
 
@@ -172,17 +172,17 @@ begin
172
172
 
173
173
  puts os_aws.server.to_os_hash.to_json
174
174
  when 'launch_workers'
175
- @timestamp = @params['timestamp'] #timestamp is renamed to groupuuid in the backend
175
+ @timestamp = @params['timestamp'] # timestamp is renamed to groupuuid in the backend
176
176
 
177
177
  os_aws = OpenStudioAwsWrapper.new(nil, @timestamp)
178
178
  os_aws.find_server(@timestamp) # really the group id
179
- os_aws.create_or_retrieve_security_group("openstudio-worker-sg-v1")
179
+ os_aws.create_or_retrieve_security_group('openstudio-worker-sg-v1')
180
180
 
181
181
  # find the private key in the users home directory, or crash
182
- if File.exists?(SERVER_PEM_FILENAME)
182
+ if File.exist?(SERVER_PEM_FILENAME)
183
183
  os_aws.create_or_retrieve_key_pair(nil, SERVER_PEM_FILENAME)
184
184
  else
185
- raise "Could not find previous private key which should be here: #{SERVER_PEM_FILENAME}"
185
+ fail "Could not find previous private key which should be here: #{SERVER_PEM_FILENAME}"
186
186
  end
187
187
 
188
188
  if ARGV.length < 6
@@ -194,13 +194,13 @@ begin
194
194
 
195
195
  @worker_instance_type = @params['instance_type']
196
196
  begin
197
- # this will launch and configure with threads inside os_aws
197
+ # this will launch and configure with threads inside os_aws
198
198
  os_aws.launch_workers(@worker_image_id, @worker_instance_type, @params['num'])
199
199
  rescue Exception => e
200
200
  error(-1, "Server status: #{e.message}")
201
201
  end
202
202
 
203
- #wait for user_data to complete execution
203
+ # wait for user_data to complete execution
204
204
  os_aws.configure_server_and_workers
205
205
 
206
206
  # have to print to screen for c++ to grab the information
@@ -214,7 +214,7 @@ begin
214
214
  server = @aws.instances[@params['server_id']]
215
215
  error(-1, "Server node #{@params['server_id']} does not exist") unless server.exists?
216
216
 
217
- #@timestamp = @aws.client.describe_instances({:instance_ids=>[@params['server_id']]}).data[:instance_index][@params['server_id']][:key_name][9,10]
217
+ # @timestamp = @aws.client.describe_instances({:instance_ids=>[@params['server_id']]}).data[:instance_index][@params['server_id']][:key_name][9,10]
218
218
  @timestamp = server.key_name[9, 10]
219
219
 
220
220
  instances.push(server)
@@ -230,9 +230,9 @@ begin
230
230
  sleep 5 while instances.any? { |instance| instance.status != :terminated }
231
231
 
232
232
  # When session is fully terminated, then delete the key pair
233
- #@aws.client.delete_security_group({:group_name=>'openstudio-server-sg-v1'}"})
234
- #@aws.client.delete_security_group({:group_name=>'openstudio-worker-sg-v1'}"})
235
- @aws.client.delete_key_pair({:key_name => "key-pair-#{@timestamp}"})
233
+ # @aws.client.delete_security_group({:group_name=>'openstudio-server-sg-v1'}"})
234
+ # @aws.client.delete_security_group({:group_name=>'openstudio-worker-sg-v1'}"})
235
+ @aws.client.delete_key_pair(key_name: "key-pair-#{@timestamp}")
236
236
 
237
237
  when 'termination_status'
238
238
  if ARGV.length < 6
@@ -241,39 +241,39 @@ begin
241
241
  notTerminated = 0
242
242
 
243
243
  server = @aws.instances[@params['server_id']]
244
- notTerminated += 1 if (server.exists? && server.status != :terminated)
244
+ notTerminated += 1 if server.exists? && server.status != :terminated
245
245
 
246
- @params['worker_ids'].each { |worker_id|
246
+ @params['worker_ids'].each do |worker_id|
247
247
  worker = @aws.instances[worker_id]
248
- notTerminated += 1 if (worker.exists? && worker.status != :terminated)
249
- }
248
+ notTerminated += 1 if worker.exists? && worker.status != :terminated
249
+ end
250
250
 
251
- puts ({:all_instances_terminated => (notTerminated == 0)}.to_json)
251
+ puts ({ all_instances_terminated: (notTerminated == 0) }.to_json)
252
252
 
253
253
  when 'session_uptime'
254
254
  if ARGV.length < 6
255
255
  error(-1, 'Invalid number of args')
256
256
  end
257
257
  server_id = @params['server_id']
258
- #No need to call AWS, but we can
259
- #minutes = (Time.now.to_i - @aws.client.describe_instances({:instance_ids=>[server_id]}).data[:instance_index][server_id][:launch_time].to_i)/60
260
- minutes = (Time.now.to_i - @params['timestamp'].to_i)/60
261
- puts ({:session_uptime => minutes}.to_json)
258
+ # No need to call AWS, but we can
259
+ # minutes = (Time.now.to_i - @aws.client.describe_instances({:instance_ids=>[server_id]}).data[:instance_index][server_id][:launch_time].to_i)/60
260
+ minutes = (Time.now.to_i - @params['timestamp'].to_i) / 60
261
+ puts ({ session_uptime: minutes }.to_json)
262
262
 
263
263
  when 'estimated_charges'
264
264
  endTime = Time.now.utc
265
- startTime = endTime - 86400
266
- resp = @aws.client.get_metric_statistics({:dimensions => [{:name => 'ServiceName', :value => 'AmazonEC2'}, {:name => 'Currency', :value => 'USD'}], :metric_name => 'EstimatedCharges', :namespace => 'AWS/Billing', :start_time => startTime.iso8601, :end_time => endTime.iso8601, :period => 300, :statistics => ['Maximum']})
265
+ startTime = endTime - 86_400
266
+ resp = @aws.client.get_metric_statistics(dimensions: [{ name: 'ServiceName', value: 'AmazonEC2' }, { name: 'Currency', value: 'USD' }], metric_name: 'EstimatedCharges', namespace: 'AWS/Billing', start_time: startTime.iso8601, end_time: endTime.iso8601, period: 300, statistics: ['Maximum'])
267
267
  error(-1, 'No Billing Data') if resp.data[:datapoints].length == 0
268
268
  datapoints = resp.data[:datapoints]
269
269
  datapoints.sort! { |a, b| a[:timestamp] <=> b[:timestamp] }
270
- puts ({:estimated_charges => datapoints[-1][:maximum],
271
- :timestamp => datapoints[-1][:timestamp].to_i}.to_json)
270
+ puts ({ estimated_charges: datapoints[-1][:maximum],
271
+ timestamp: datapoints[-1][:timestamp].to_i }.to_json)
272
272
 
273
273
  else
274
274
  error(-1, "Unknown command: #{ARGV[4]} (#{ARGV[3]})")
275
275
  end
276
- #puts \"Status: #{resp.http_response.status}\"
276
+ # puts \"Status: #{resp.http_response.status}\"
277
277
  rescue SystemExit => e
278
278
  rescue Exception => e
279
279
  if e.message == 'getaddrinfo: No such host is known. '
@@ -1,5 +1,9 @@
1
1
  #!/bin/sh
2
- # NOTE: Do not modify this file as it is copied over. Modify the source file and rerun rake import_files
2
+
3
+ # NOTE: This file is now the main script -- OpenStudio's version is now out of date
4
+
5
+ # AWS Server Bootstrap File
6
+ # This script is used to configure the AWS boxes
3
7
 
4
8
  # Change Host File Entries
5
9
  ENTRY="localhost localhost master"
@@ -11,34 +15,59 @@ else
11
15
  fi
12
16
 
13
17
  # copy all the setup scripts to the appropriate home directory
18
+ # the scripts are called by the AWS connector for passwordless ssh config
14
19
  cp /data/launch-instance/setup* /home/ubuntu/
15
20
  chmod 775 /home/ubuntu/setup*
16
21
  chown ubuntu:ubuntu /home/ubuntu/setup*
17
22
 
18
- # Set permissions on rails apps folders
23
+ # stop the various services that use mongo
24
+ sudo service delayed_job stop
25
+ sudo service apache2 stop
26
+ sudo service mongodb stop
27
+
28
+ # remove mongo db & add it back
29
+ sudo rm -rf /mnt/mongodb/data
30
+ sudo mkdir -p /mnt/mongodb/data
31
+ sudo chown mongodb:nogroup /mnt/mongodb/data
32
+ sudo rm -rf /var/lib/mongodb
33
+
34
+ # restart mongo
35
+ sudo service mongodb start
36
+
37
+ # restart the rails application
38
+ sudo service apache2 stop
39
+ sudo service apache2 start
40
+
41
+ # Add in the database indexes after making the db directory
19
42
  sudo chmod 777 /var/www/rails/openstudio/public
43
+ cd /var/www/rails/openstudio
44
+ rake db:purge
45
+ rake db:mongoid:create_indexes
20
46
 
21
- # Force the generation of OpenStudio on the EBS mount and copy worker files
47
+ ## Worker Data Configuration
48
+ # Force the generation of various directories that are in the EBS mnt
22
49
  sudo rm -rf /mnt/openstudio
23
50
  sudo mkdir -p /mnt/openstudio
24
- sudo chmod -R 777 /mnt/openstudio
51
+ sudo chown -R ubuntu:www-data /mnt/openstudio
52
+ sudo chmod -R 775 /mnt/openstudio
53
+
54
+ # save application files into the right directory
25
55
  cp -rf /data/worker-nodes/* /mnt/openstudio/
26
56
 
27
- # Unzip the worker files (including Mongoid models) and set permissions one last time
28
- # Note that the 777 is redundant but needed until we actually deploy ACL
57
+ # copy over the models needed for mongo
29
58
  cd /mnt/openstudio/rails-models && unzip -o rails-models.zip
30
- sudo chmod -R 777 /mnt/openstudio
31
59
 
32
- # Force the generation of MongoDB dbpath on the EBS mount
33
- sudo rm -rf /mnt/mongodb/data
34
- sudo mkdir -p /mnt/mongodb/data
35
- sudo chown mongodb:nogroup /mnt/mongodb/data
36
- sudo service mongodb restart
37
- sudo service delayed_job restart
60
+ # rerun the permissions after unzipping the files
61
+ sudo chown -R ubuntu:www-data /mnt/openstudio
62
+ sudo find /mnt/openstudio -type d -print0 | xargs -0 chmod 775
63
+ sudo find /mnt/openstudio -type f -print0 | xargs -0 chmod 664
64
+ ## End of Worker Data Configuration
38
65
 
39
- # Add database indexes after it gets mounted for the first time
40
- cd /var/www/rails/openstudio
41
- sudo rake db:mongoid:create_indexes
66
+ # restart rserve
67
+ sudo service Rserve restart
68
+
69
+ # restart delayed jobs
70
+ sudo service delayed_job start
42
71
 
43
72
  #file flag the user_data has completed
44
73
  cat /dev/null > /home/ubuntu/user_data_done
@@ -1,7 +1,8 @@
1
1
  #!/bin/sh
2
- # NOTE: Do not modify this file as it is copied over. Modify the source file and rerun rake import_files
2
+ # NOTE: This file is now the main script to configure AWS workers
3
3
 
4
4
  # AWS Worker Bootstrap File
5
+ # File used to configure worker nodes on AWS
5
6
 
6
7
  # Change Host File Entries
7
8
  ENTRY="SERVER_IP SERVER_HOSTNAME SERVER_ALIAS"
@@ -17,16 +18,24 @@ cp /data/launch-instance/setup* /home/ubuntu/
17
18
  chmod 775 /home/ubuntu/setup*
18
19
  chown ubuntu:ubuntu /home/ubuntu/setup*
19
20
 
20
- # Force the generation of OpenStudio on the EBS mount and copy worker files
21
+ ## Worker Data Configuration
22
+ # Force the generation of various directories that are in the EBS mnt
21
23
  sudo rm -rf /mnt/openstudio
22
24
  sudo mkdir -p /mnt/openstudio
23
- sudo chmod -R 777 /mnt/openstudio
25
+ sudo chown -R ubuntu:www-data /mnt/openstudio
26
+ sudo chmod -R 775 /mnt/openstudio
27
+
28
+ # save application files into the right directory
24
29
  cp -rf /data/worker-nodes/* /mnt/openstudio/
25
30
 
26
- # Unzip the worker files (including Mongoid models) and set permissions one last time
27
- # Note that the 777 is redundant but needed until we actually deploy ACL
31
+ # copy over the models needed for mongo
28
32
  cd /mnt/openstudio/rails-models && unzip -o rails-models.zip
29
- sudo chmod -R 777 /mnt/openstudio
33
+
34
+ # rerun the permissions after unzipping the files
35
+ sudo chown -R ubuntu:www-data /mnt/openstudio
36
+ sudo find /mnt/openstudio -type d -print0 | xargs -0 chmod 775
37
+ sudo find /mnt/openstudio -type f -print0 | xargs -0 chmod 664
38
+ ## End of Worker Data Configuration
30
39
 
31
40
  #turn off hyperthreading
32
41
  for cpunum in $(
@@ -1,61 +1,61 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe OpenStudio::Aws::Aws do
4
- context "create a new instance" do
4
+ context 'create a new instance' do
5
5
  before(:all) do
6
6
  @config = OpenStudio::Aws::Config.new
7
7
  @aws = OpenStudio::Aws::Aws.new
8
8
  end
9
9
 
10
- it "should create a new instance" do
10
+ it 'should create a new instance' do
11
11
  @aws.should_not be_nil
12
12
  end
13
13
 
14
- it "should create a server" do
14
+ it 'should create a server' do
15
15
  # use the default instance type
16
- options = {instance_type: "m1.small", image_id: "ami-29faca40"}
16
+ options = { instance_type: 'm1.small', image_id: 'ami-29faca40' }
17
17
 
18
18
  @aws.create_server(options)
19
19
  expect(@aws.os_aws.server).not_to be_nil
20
20
  end
21
21
 
22
- it "should create a 1 worker" do
23
- options = {instance_type: "m1.small", image_id: "ami-95f9c9fc"}
22
+ it 'should create a 1 worker' do
23
+ options = { instance_type: 'm1.small', image_id: 'ami-95f9c9fc' }
24
24
 
25
25
  @aws.create_workers(1, options)
26
26
 
27
27
  expect(@aws.os_aws.workers).to have(1).thing
28
28
  expect(@aws.os_aws.workers[0].data[:dns]).not_to be_nil
29
29
  end
30
-
31
- it "should be able to connect a worker to an existing server" do
32
- options = {instance_type: "m1.small", image_id: "ami-29faca40"}
30
+
31
+ it 'should be able to connect a worker to an existing server' do
32
+ options = { instance_type: 'm1.small', image_id: 'ami-29faca40' }
33
33
 
34
34
  # will require a new @aws class--but attached to same group_uuid
35
35
  @config = OpenStudio::Aws::Config.new
36
36
  @aws_2 = OpenStudio::Aws::Aws.new
37
-
37
+
38
38
  @aws_2.os_aws.find_server(@aws.os_aws.group_uuid)
39
39
 
40
40
  expect(@aws.os_aws.server).not_to be_nil
41
41
  end
42
-
43
- it "should kill running instances" do
42
+
43
+ it 'should kill running instances' do
44
44
  # how to test this?
45
45
  end
46
46
  end
47
47
 
48
- context "workers before server" do
48
+ context 'workers before server' do
49
49
  before(:all) do
50
50
  @aws = OpenStudio::Aws::Aws.new
51
51
  end
52
52
 
53
- it "should not create any workers" do
53
+ it 'should not create any workers' do
54
54
  expect { @aws.create_workers(5) }.to raise_error
55
55
  end
56
56
  end
57
57
 
58
- context "larger cluster" do
58
+ context 'larger cluster' do
59
59
 
60
60
  end
61
61
 
@@ -2,8 +2,8 @@ require 'spec_helper'
2
2
 
3
3
  describe OpenStudioAmis do
4
4
 
5
- context "version 1" do
6
- it "should default to an ami if nothing passed" do
5
+ context 'version 1' do
6
+ it 'should default to an ami if nothing passed' do
7
7
  a = OpenStudioAmis.new
8
8
  amis = a.get_amis
9
9
 
@@ -12,26 +12,26 @@ describe OpenStudioAmis do
12
12
  expect(amis[:cc2worker]).not_to be_nil
13
13
  end
14
14
 
15
- it "should return specific amis if passed a version" do
16
- a = OpenStudioAmis.new(1, {:openstudio_version => "1.2.0"})
15
+ it 'should return specific amis if passed a version' do
16
+ a = OpenStudioAmis.new(1, openstudio_version: '1.2.0')
17
17
 
18
18
  amis = a.get_amis
19
19
 
20
- expect(amis[:server]).to eq("ami-a3edddca")
21
- expect(amis[:worker]).to eq("ami-bfedddd6")
22
- expect(amis[:cc2worker]).to eq("ami-b5eddddc")
20
+ expect(amis[:server]).to eq('ami-a3edddca')
21
+ expect(amis[:worker]).to eq('ami-bfedddd6')
22
+ expect(amis[:cc2worker]).to eq('ami-b5eddddc')
23
23
  end
24
-
25
- it "should list all amis" do
24
+
25
+ it 'should list all amis' do
26
26
  a = OpenStudioAmis.new(1).list
27
-
27
+
28
28
  expect(a).not_to be_nil
29
29
  end
30
30
  end
31
-
32
- context "version 2" do
33
- it "should default the server version" do
34
-
31
+
32
+ context 'version 2' do
33
+ it 'should default the server version' do
34
+
35
35
  end
36
36
  end
37
37
  end