deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Unifying driver method parameters across all drivers
Date Tue, 22 May 2012 21:38:48 GMT

I created a minitest that check consistency of the driver methods across all
drivers we currently have, to provide the same API for all drivers.

I tried to somehow make all methods consistent in this way:

# Method to query a collection of resources, returning the Array.
# The opts={} parameter might include additional filters
def instances(credentials, opts={});

# This method should return the **single** resource. The :id parameter is
# required and it must contain the resource identifier
def instance(credentials, id)

# This method might be reboot_instance or destroy_instance. All method like this
# should have the :id parameter, which must contain the resource identifier.
def instance_action(credentials, instance_id)

Note that I used 'instance' just as an example, it also apply to 'realm',
'image', etc...

So, why I'm writing this ;-) If you look to various drivers we have, you'll find
that the methods somehow defines parameters randomly.... A few examples:

def instance(credentials, opts=nil)
def instance(credentials, opts={})
def realms(credentials, opts)

etc... I found many inconsistencies like that. In order to provide at least
'usable' API, we should have the same methods with same parameters in all
drivers. The attached patch should fix them all and make the test pass:

ruby tests/api/driver_test.rb

  -- Michal

View raw message