deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michal Fojtik (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DTACLOUD-307) method "valid_provider?" doesn't work as expected
Date Thu, 27 Sep 2012 12:13:07 GMT

    [ https://issues.apache.org/jira/browse/DTACLOUD-307?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13464656#comment-13464656
] 

Michal Fojtik commented on DTACLOUD-307:
----------------------------------------

Sorry for no reply on this bug. Basically this will not work until DC is started with specified
driver or the client is configured to send 'API_PROVIDER' together with 'API_DRIVER' HTTP
header.

I agree that checking this is a mess currently and we definitely need to clean it up. My suggestion
is to do following (meta-code):

def valid_provider?(driver, provider)
  set_header :driver => driver
  set_header :provider => provider
  status = GET /api/realms
  
  status == 401 or status ==200
end

This can be nicely wrapped into deltacloud 'client' and allow to check wheter the API_PROVIDER
is valid without credentials.

                
> method "valid_provider?" doesn't work as expected
> -------------------------------------------------
>
>                 Key: DTACLOUD-307
>                 URL: https://issues.apache.org/jira/browse/DTACLOUD-307
>             Project: DeltaCloud
>          Issue Type: Bug
>         Environment: tested both on deltacloud-core-1.0.0-8.fc17.noarch and dc-core from
git repo
>            Reporter: Jan Provaznik
>            Assignee: Michal Fojtik
>
> it raises following exception for rhevm or mock drivers:
> irb(main):007:0> client.drivers[2].id
> => "rhevm"
> irb(main):008:0> client.drivers[2].valid_provider?('')
> NameError: undefined local variable or method `providers' for #<DeltaCloud::API::Base::Driver:0x000000045f9958>
> 	from /usr/local/share/gems/gems/deltacloud-client-1.0.2/lib/base_object.rb:156:in `method_missing'
> 	from /usr/local/share/gems/gems/deltacloud-client-1.0.2/lib/base_object.rb:151:in `method_missing'
> 	from (irb):8
> 	from /usr/share/gems/gems/railties-3.0.11/lib/rails/commands/console.rb:44:in `start'
> 	from /usr/share/gems/gems/railties-3.0.11/lib/rails/commands/console.rb:8:in `start'
> 	from /usr/share/gems/gems/railties-3.0.11/lib/rails/commands.rb:23:in `<top (required)>'
> 	from ./script/rails:6:in `require'
> 	from ./script/rails:6:in `<main>'
> Also this method checks if passed provider is in preconfigured (API_PROVIDER) list, but
dc-core should do real check if passed provider/realm is valid.
> This is based on BZ request https://bugzilla.redhat.com/show_bug.cgi?id=773768

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message