On 08/19/2011 09:46 PM, Scott Seago wrote:
src/app/models/provider.rb | 14 ++++++++++++-- src/app/models/provider_account.rb | 16 ++++++++++++++-- src/app/util/condormatic.rb | 2 +- 3 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/src/app/models/provider.rb b/src/app/models/provider.rb index a099c56..c5f64f1 100644 --- a/src/app/models/provider.rb +++ b/src/app/models/provider.rb @@ -64,6 +64,11 @@ class Provider< ActiveRecord::Base
before_destroy :destroyable?
- def encoded_url_with_driver_and_provider
- unencoded = ";driver=#{provider_type.deltacloud_driver}"
- unencoded += ";provider=#{deltacloud_provider}" if deltacloud_provider
- return url + CGI::escape(unencoded)
Escaped URL doesn't work for me - condor log: 08/25/11 15:37:07 [4589] BaseResource::DoBatchStatus for http://localhost:3002/api%3Bdriver%3Dmock%3Bprovider%3D; skipped for 30 seconds because the resource is down.
W/o escaping (url + unencoded) it works for me.
- end # there is a destroy dependency for a cloud accounts association, # but a cloud account is silently not destroyed when there is # an instance for the cloud account
@@ -81,7 +86,12 @@ class Provider< ActiveRecord::Base
def connect begin
return DeltaCloud.new(nil, nil, url)
opts = {:username => nil,
:password => nil,
:driver => provider_type.deltacloud_driver }
opts[:provider] = deltacloud_provider if deltacloud_provider
client = DeltaCloud.new(nil, nil, url)
return client.with_config(opts) rescue Exception => e logger.error("Error connecting to framework: #{e.message}") logger.error("Backtrace: #{e.backtrace.join("\n")}")
@@ -112,4 +122,4 @@ class Provider< ActiveRecord::Base connect.nil? ? false : true end
-end \ No newline at end of file +end diff --git a/src/app/models/provider_account.rb b/src/app/models/provider_account.rb index 6079a55..b6b0994 100644 --- a/src/app/models/provider_account.rb +++ b/src/app/models/provider_account.rb @@ -125,7 +125,14 @@ class ProviderAccount< ActiveRecord::Base
def connect begin
return DeltaCloud.new(credentials_hash['username'], credentials_hash['password'], provider.url)
opts = {:username => credentials_hash['username'],
:password => credentials_hash['password'],
:driver => provider.provider_type.deltacloud_driver }
opts[:provider] = provider.deltacloud_provider if provider.deltacloud_provider
client = DeltaCloud.new(credentials_hash['username'],
credentials_hash['password'],
provider.url)
return client.with_config(opts) rescue Exception => e logger.error("Error connecting to framework: #{e.message}") logger.error("Backtrace: #{e.backtrace.join("\n")}")
@@ -169,7 +176,12 @@ class ProviderAccount< ActiveRecord::Base if credentials_hash['username'].blank? || credentials_hash['password'].blank? return false end
- DeltaCloud::valid_credentials?(credentials_hash['username'].to_s, credentials_hash['password'].to_s, provider.url)
opts = {:driver => provider.provider_type.deltacloud_driver }
opts[:provider] = provider.deltacloud_provider if provider.deltacloud_provider
DeltaCloud::valid_credentials?(credentials_hash['username'].to_s,
credentials_hash['password'].to_s,
provider.url,
opts)
end
def build_credentials
diff --git a/src/app/util/condormatic.rb b/src/app/util/condormatic.rb index 431697a..c35afe1 100644 --- a/src/app/util/condormatic.rb +++ b/src/app/util/condormatic.rb @@ -89,7 +89,7 @@ def condormatic_instance_create(task) pipe_and_log(pipe, "executable = #{job_name}\n")
pipe_and_log(pipe,
"grid_resource = deltacloud #{found.account.provider.url}\n")
"grid_resource = deltacloud #{found.account.provider.encoded_url_with_driver_and_provider};\n") pipe_and_log(pipe, "DeltacloudUsername = #{found.account.credentials_hash['username']}\n") pipe_and_log(pipe, "DeltacloudPasswordFile = #{pwfilename}") pipe_and_log(pipe, "DeltacloudImageId = #{found.provider_image.target_identifier}\n")