rackspace / php-opencloud

The PHP SDK for OpenStack clouds
developer.rackspace.com
Other
451 stars 249 forks source link

Should be able to get a Compute Service without knowing its catalogName #629

Open fifieldt opened 9 years ago

fifieldt commented 9 years ago

Hi,

Currently, to get a compute service, you must run:

$service = $client->computeService('{catalogName}', '{region}', '{urlType}');

with catalogName (the name of the service as it appears in the service catalog) as a required option.

However:

Currently, if catalogName is left blank, a string 'cloudServersOpenStack' is used, which does not work for most clouds.

Instead, I think the desired behaviour should be to check the catalog and if only one compute service is found, that should be the one returned.

jamiehannaford commented 9 years ago

@fifieldt I agree with you, but what happens in the rare situation where somebody has multiple compute entries? Another option would be to change the default string to nova for users running OpenStack.

fifieldt commented 9 years ago

Hi, unfortunately just changing to 'nova' doesn't help much. Though "nova" is used in the install guide, this is a freetext string you set when configuring the cloud - the last 3 clouds I looked at I had "Compute Service", "OpenStack Compute" and "nova".

Surely there's some logic where we make it an optional string, (or fix the logic for the null string case) and fail out with an error if there's multiple compute services in the region and the catalogName isn't specified?

jamiehannaford commented 9 years ago

Yeah, so I think the desired behaviour would be:

fifieldt commented 9 years ago

sounds perfect to me :)