openstack_activeresource 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -86,7 +86,12 @@ module OpenStack
86
86
  new_attributes[:security_group_ids] = []
87
87
  else
88
88
 
89
- new_attributes[:security_group_ids] = attributes[:security_group_ids] || attributes[:security_groups].map { |sg| sg.id }
89
+ if attributes[:security_group_ids].nil?
90
+ new_attributes[:security_group_ids] = attributes[:security_groups].nil? ? [] : attributes[:security_groups].map { |sg| sg.id }
91
+ else
92
+ new_attributes[:security_group_ids] = attributes[:security_group_ids]
93
+ end
94
+
90
95
  end
91
96
 
92
97
  super(new_attributes, persisted)
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "openstack_activeresource"
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Davide Guerri"]
data/test/helper.rb CHANGED
@@ -21,7 +21,7 @@ end
21
21
  test_path = File.expand_path('..', __FILE__)
22
22
  $:.unshift(test_path)
23
23
 
24
- unless File.exist? "#{test_path}/test_configuration.ymla"
24
+ unless File.exist? "#{test_path}/test_configuration.yml"
25
25
  raise "\n****" +
26
26
  "\n**** Please add a valid 'test_configuration.yml' file in '#{test_path}'." +
27
27
  "\n**** See #{test_path}/test_configuration-sample.yml for an example" +
@@ -1,6 +1,8 @@
1
1
  test_configuration:
2
2
  public_base_site: "https://my.api.com:5000/v2.0/"
3
3
  public_admin_site: "https://my.api.com:35357/v2.0/"
4
+ image_id: "xxxx"
5
+ flavor_name: "yyyy"
4
6
  user_username: "user_username"
5
7
  user_password: "user_password"
6
8
  user_tenant_id: "user_tenant_id"
@@ -196,16 +196,17 @@ class TestOpenStackActiveResource < Test::Unit::TestCase
196
196
  def test_server_create_destroy
197
197
  auth_user
198
198
 
199
- flavor = OpenStack::Nova::Compute::Flavor.first
200
- image = OpenStack::Nova::Compute::Image.last
201
- security_groups = OpenStack::Nova::Compute::SecurityGroup.first
199
+ flavor = OpenStack::Nova::Compute::Flavor.find_by_name TEST_CONFIG[:flavor_name]
200
+ assert_not_nil flavor
201
+
202
+ image = OpenStack::Nova::Compute::Image.find TEST_CONFIG[:image_id]
203
+ assert_not_nil image
202
204
 
203
205
  new_server_id = nil
204
206
  assert_nothing_raised ActiveResource::ClientError, "Failed to create a new server" do
205
207
  new_server = OpenStack::Nova::Compute::Server.create :name => 'test_server',
206
208
  :flavor => flavor,
207
- :image => image,
208
- :security_groups => [security_groups]
209
+ :image => image
209
210
  assert_not_nil new_server
210
211
  new_server_id = new_server.id
211
212
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstack_activeresource
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -212,7 +212,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
212
212
  version: '0'
213
213
  segments:
214
214
  - 0
215
- hash: 3792719235558730488
215
+ hash: -1167566582415723720
216
216
  required_rubygems_version: !ruby/object:Gem::Requirement
217
217
  none: false
218
218
  requirements: