Skip to content

Commit

Permalink
Merge pull request #185 from MissionCriticalCloud/sync_resource_using…
Browse files Browse the repository at this point in the history
…_name

Sync resource using name
  • Loading branch information
remibergsma committed Apr 18, 2019
2 parents ac39e81 + e2814a6 commit 9e72463
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 47 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 1.5.1 (18 Apr 2019)

**Implemented enhancements:**

- Sync resources by name: sometimes a resource (e.g. templates) were not correctly found; resources are now looked up by specifying the name of the resource

# 1.5.0 (17 Oct 2018)

**Implemented enhancements:**
Expand Down
117 changes: 79 additions & 38 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ GIT
PATH
remote: .
specs:
vagrant-cloudstack (1.5.0)
vagrant-cloudstack (1.5.1)
fog (>= 1.32.0)
fog-xml (>= 0.1.2)

GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.3.6)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
builder (3.2.3)
childprocess (0.6.3)
ffi (~> 1.0, >= 1.0.11)
Expand All @@ -41,14 +43,19 @@ GEM
simplecov (>= 0.7)
term-ansicolor (= 1.2.2)
thor (= 0.18.1)
declarative (0.0.10)
declarative-option (0.1.0)
diff-lcs (1.3)
docile (1.3.0)
dry-inflector (0.1.2)
erubis (2.7.0)
excon (0.62.0)
excon (0.64.0)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
ffi (1.9.23)
fission (0.5.0)
CFPropertyList (~> 2.2)
fog (2.0.0)
fog (2.1.0)
fog-aliyun (>= 0.1.0)
fog-atmos
fog-aws (>= 0.6.0)
Expand All @@ -59,7 +66,7 @@ GEM
fog-dnsimple (~> 1.0)
fog-dynect (~> 0.0.2)
fog-ecloud (~> 0.1)
fog-google (<= 0.1.0)
fog-google (~> 1.0)
fog-internet-archive
fog-joyent
fog-json
Expand All @@ -83,9 +90,9 @@ GEM
fog-xml (~> 0.1.1)
ipaddress (~> 0.5)
json (~> 2.0)
fog-aliyun (0.2.0)
fog-core (~> 1.27)
fog-json (~> 1.0)
fog-aliyun (0.3.3)
fog-core
fog-json
ipaddress (~> 0.8)
xml-simple (~> 1.1)
fog-atmos (0.1.0)
Expand All @@ -96,10 +103,11 @@ GEM
fog-json (~> 1.0)
fog-xml (~> 0.1)
ipaddress (~> 0.8)
fog-brightbox (0.14.0)
fog-core (~> 1.22)
fog-brightbox (0.16.1)
dry-inflector
fog-core
fog-json
inflecto (~> 0.0.2)
mime-types
fog-cloudatcost (0.1.2)
fog-core (~> 1.36)
fog-json (~> 1.0)
Expand All @@ -109,10 +117,10 @@ GEM
builder
excon (~> 0.58)
formatador (~> 0.2)
fog-digitalocean (0.3.0)
fog-core (~> 1.42)
fog-json (>= 1.0)
fog-xml (>= 0.1)
fog-digitalocean (0.4.0)
fog-core
fog-json
fog-xml
ipaddress (>= 0.5)
fog-dnsimple (1.0.0)
fog-core (~> 1.38)
Expand All @@ -124,38 +132,39 @@ GEM
fog-ecloud (0.3.0)
fog-core
fog-xml
fog-google (0.1.0)
fog-core
fog-json
fog-xml
fog-google (1.9.1)
fog-core (<= 2.1.0)
fog-json (~> 1.2)
fog-xml (~> 0.1.0)
google-api-client (~> 0.23.0)
fog-internet-archive (0.0.1)
fog-core
fog-json
fog-xml
fog-joyent (0.0.1)
fog-core (~> 1.42)
fog-json (>= 1.0)
fog-json (1.0.2)
fog-core (~> 1.0)
fog-json (1.2.0)
fog-core
multi_json (~> 1.10)
fog-local (0.5.0)
fog-local (0.6.0)
fog-core (>= 1.27, < 3.0)
fog-openstack (0.1.25)
fog-core (~> 1.40)
fog-openstack (0.3.10)
fog-core (>= 1.45, <= 2.1.0)
fog-json (>= 1.0)
ipaddress (>= 0.8)
fog-ovirt (0.0.1)
fog-core (~> 1.45)
fog-json
fog-xml (~> 0.1.1)
fog-powerdns (0.1.1)
fog-core (~> 1.27)
fog-json (~> 1.0)
fog-xml (~> 0.1)
fog-powerdns (0.2.0)
fog-core
fog-json
fog-xml
fog-profitbricks (4.1.1)
fog-core (~> 1.42)
fog-json (~> 1.0)
fog-rackspace (0.1.5)
fog-rackspace (0.1.6)
fog-core (>= 1.35)
fog-json (>= 1.0)
fog-xml (>= 0.1)
Expand Down Expand Up @@ -189,26 +198,42 @@ GEM
fog-voxel (0.1.0)
fog-core
fog-xml
fog-vsphere (2.0.1)
fog-vsphere (3.0.0)
fog-core
rbvmomi (~> 1.9)
fog-xenserver (0.3.0)
rbvmomi (>= 1.9, < 3)
fog-xenserver (1.0.0)
fog-core
fog-xml
xmlrpc
fog-xml (0.1.3)
fog-core
nokogiri (>= 1.5.11, < 2.0.0)
formatador (0.2.5)
google-api-client (0.23.9)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.5, < 0.7.0)
httpclient (>= 2.8.1, < 3.0)
mime-types (~> 3.0)
representable (~> 3.0)
retriable (>= 2.0, < 4.0)
signet (~> 0.9)
googleauth (0.6.7)
faraday (~> 0.12)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (~> 0.7)
gssapi (1.2.0)
ffi (>= 1.0.1)
gyoku (1.3.1)
builder (>= 2.1.2)
hashicorp-checkpoint (0.1.5)
httpclient (2.8.3)
i18n (0.8.0)
inflecto (0.0.2)
ipaddress (0.8.3)
json (2.1.0)
jwt (2.1.0)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
Expand All @@ -218,32 +243,42 @@ GEM
logging (2.2.2)
little-plugger (~> 1.1)
multi_json (~> 1.10)
memoist (0.16.0)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.3.0)
mini_portile2 (2.4.0)
multi_json (1.13.1)
multipart-post (2.0.0)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-sftp (2.1.2)
net-ssh (>= 2.6.5)
net-ssh (4.2.0)
nokogiri (1.8.2)
mini_portile2 (~> 2.3.0)
nokogiri (1.10.2)
mini_portile2 (~> 2.4.0)
nori (2.6.0)
optimist (3.0.0)
os (1.0.0)
public_suffix (3.0.3)
rake (10.5.0)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rb-kqueue (0.2.5)
ffi (>= 0.5.0)
rbvmomi (1.11.7)
rbvmomi (2.1.1)
builder (~> 3.0)
json (>= 1.8)
nokogiri (~> 1.5)
trollop (~> 2.1)
optimist (~> 3.0)
representable (3.0.4)
declarative (< 0.1.0)
declarative-option (< 0.2.0)
uber (< 0.2.0)
rest-client (1.6.7)
mime-types (>= 1.16)
retriable (3.1.2)
rspec-core (3.7.1)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
Expand All @@ -259,6 +294,11 @@ GEM
ruby_dep (1.3.1)
rubyntlm (0.6.2)
rubyzip (1.2.1)
signet (0.11.0)
addressable (~> 2.3)
faraday (~> 0.9)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
Expand All @@ -268,7 +308,7 @@ GEM
tins (~> 0.8)
thor (0.18.1)
tins (0.13.2)
trollop (2.1.2)
uber (0.1.0)
wdm (0.1.1)
winrm (2.2.3)
builder (>= 2.1.2)
Expand All @@ -288,6 +328,7 @@ GEM
rubyzip (~> 1.1)
winrm (~> 2.0)
xml-simple (1.1.5)
xmlrpc (0.3.0)

PLATFORMS
ruby
Expand Down
8 changes: 4 additions & 4 deletions lib/vagrant-cloudstack/action/run_instance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ def initialize_parameters

def resolve_parameters
begin
@resource_service.sync_resource(@zone, {available: true})
@resource_service.sync_resource(@service_offering, {listall: true})
@resource_service.sync_resource(@disk_offering, {listall: true})
@resource_service.sync_resource(@template, {zoneid: @zone.id, templatefilter: 'executable', listall: true})
@resource_service.sync_resource(@zone, {available: true, name: @zone.name})
@resource_service.sync_resource(@service_offering, {listall: true, name: @service_offering.name})
@resource_service.sync_resource(@disk_offering, {listall: true, name: @disk_offering.name})
@resource_service.sync_resource(@template, {zoneid: @zone.id, templatefilter: 'executable', listall: true, name: @template.name})
@resource_service.sync_resource(@pf_ip_address)
rescue CloudstackResourceNotFound => e
@env[:ui].error(e.message)
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant-cloudstack/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module VagrantPlugins
module Cloudstack
VERSION = '1.5.0'
VERSION = '1.5.1'
end
end
8 changes: 4 additions & 4 deletions spec/vagrant-cloudstack/action/run_instance_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,11 @@
expect(server).to receive(:wait_for).and_return(ready = true)
allow(server).to receive(:password_enabled).and_return(false)
expect(cloudstack_compute).to receive(:servers).and_return(servers)
allow(cloudstack_compute).to receive(:send).with(:list_zones, available: true).and_return(list_zones_response)
allow(cloudstack_compute).to receive(:send).with(:list_service_offerings, listall: true)
allow(cloudstack_compute).to receive(:send).with(:list_zones, available: true, name: ZONE_NAME).and_return(list_zones_response)
allow(cloudstack_compute).to receive(:send).with(:list_service_offerings, listall: true, name: SERVICE_OFFERING_NAME)
.and_return(list_service_offerings_response)
allow(cloudstack_compute).to receive(:send)
.with(:list_templates, zoneid: ZONE_ID, templatefilter: 'executable', listall: true)
.with(:list_templates, zoneid: ZONE_ID, templatefilter: 'executable', listall: true, name: TEMPLATE_NAME)
.and_return(list_templates_response)
allow(cloudstack_compute).to receive(:zones).and_return([cloudstack_zone])
allow(servers).to receive(:create).with(create_servers_parameters).and_return(server)
Expand Down Expand Up @@ -413,7 +413,7 @@
let(:volume) { double('Fog::Compute::Cloudstack::Volume') }

before(:each) do
allow(cloudstack_compute).to receive(:send).with(:list_disk_offerings, listall: true)
allow(cloudstack_compute).to receive(:send).with(:list_disk_offerings, listall: true, name: DISK_OFFERING_NAME)
.and_return(list_disk_offerings_response)
expect(cloudstack_compute).to receive(:volumes).and_return([volume])
allow(volume).to receive(:server_id).and_return(SERVER_ID)
Expand Down

0 comments on commit 9e72463

Please sign in to comment.