tried to use multiple endpoint in ovh.conf but failed
xinity opened this issue · 8 comments
as discussed on twitter with @oyadutaf
i've tried to use several endpoint but it seems to have failed.
here is an ovh.conf example (not a real one of course :) ):
;[default]
; general configuration: default endpoint
endpoint=ovh-eu
[ovh-eu]
; configuration specific to 'ovh-eu' endpoint
application_key=SDi4hq7ZD6IxcAxI
application_secret=5xaqN4BeD30WKt0qk9Z12wZVcx9MhxAZ
; uncomment following line when writing a script application
; with a single consumer key.
consumer_key=oKKIeDF5JZnGA4wrIa0LZVAZ9xKK8M
[soyoustart-eu]
; configuration specific to 'soyoustart-eu' endpoint
application_key=adrDGpstz3nt2ed8
application_secret=iWgcINEYRqChWH29MEnUhwWkqsuoxs0T
; uncomment following line when writing a script application
; with a single consumer key.
consumer_key=W5ZvsdXnAGpamjEfO9IDSjSHJbL7jkIf
here is a python PoC:
import ovh
import sugarcrm
import datetime
from tabulate import tabulate
mydata= []
def ovh_request():
# create a client for dedicated hosting
clientd = ovh.Client(endpoint='ovh-eu')
# create a client for SYS hosting
clients = ovh.Client(endpoint='soyoustart-eu')
clientall = [clientd , clients]
# get list of all server names
for cli_connect in clientall:
lbills = cli_connect.get('/me/bill?date.from=20150201&date.to=20150331')
for idbills in lbills:
idbillsd = cli_connect.get('/me/bill/%s/details' % idbills)
for bills in idbillsd:
billdetail = cli_connect.get('/me/bill/%s/details/%s' % (idbills, bills) )
source=billdetail['domain']
price=billdetail['totalPrice']['value']
startmonth=billdetail['periodStart']
endmonth=billdetail['periodEnd']
mydata.append([str(source),int(price),str(startmonth),str(endmonth)])
ovh_request()
print tabulate(mydata, headers=['Type', 'Prix', 'SPeriode','EPeriode'])
the ovh-eu endpoint works, but the soyoustart-eu endpoint doesn't.
both only works if i specify the connection strings like:
clientd = ovh.Client(endpoint='ovh-eu',application_key='XXXXX', application_secret='XXXX', consumer_key='XXXX')
clientd = ovh.Client(endpoint='soyoustart-eu', application_key='XXXXX', application_secret='XXXX', consumer_key='XXXX')
any clues on why ? have i made a mistake somewhere ?
Thanks for the detailed report. It definitively looks like a bug. I'll have a closer looks as soon as possible. Just one more question: do you have any ovh.conf
at any of these locations ?
/etc/ovh.conf
$HOME/.ovh.conf
./ovh.conf
ovh.conf only reside in the local dir ( i.e ./ovh.conf)
nothing in /etc/ or in $HOME
I could not reproduce the behavior described in this issue. By any chance, is there any swapped/mis-pasted configuration item in ovh.conf
?
Here is the output of my attempts, with some additional debug at the end of ovh.client.Client.__init__
, using the configuration file provided in the issue.
>>> import ovh
# Checking initialization
>>> c1 = ovh.Client(endpoint='ovh-eu')
https://eu.api.ovh.com/1.0
SDi4hq7ZD6IxcAxI
5xaqN4BeD30WKt0qk9Z12wZVcx9MhxAZ
oKKIeDF5JZnGA4wrIa0LZVAZ9xKK8M=
>>> c2 = ovh.Client(endpoint='soyoustart-eu')
https://eu.api.soyoustart.com/1.0
adrDGpstz3nt2ed8
iWgcINEYRqChWH29MEnUhwWkqsuoxs0T
W5ZvsdXnAGpamjEfO9IDSjSHJbL7jkIf
# Checking endpoints
>>> c1._endpoint
Out[4]: 'https://eu.api.ovh.com/1.0'
>>> c2._endpoint
'https://eu.api.soyoustart.com/1.0'
# Checking no credential got harmed (read: swapped) in the process
>>> c1._application_key
'SDi4hq7ZD6IxcAxI'
>>> c2._application_key
'adrDGpstz3nt2ed8'
>>> c2._application_secret
'iWgcINEYRqChWH29MEnUhwWkqsuoxs0T'
>>> c2._consumer_key
'W5ZvsdXnAGpamjEfO9IDSjSHJbL7jkIf'
>>> c1._consumer_key
'oKKIeDF5JZnGA4wrIa0LZVAZ9xKK8M'
@xinity: Did you noticed you have a ";" before the "default" section name in your config file?
@gierschv yes i put in on purpose thinking that as i described 2 endpoint, default should be enabled.
am i wrong ?
@xinity yes, that's why you sould have
[default]
; general configuration: default endpoint
endpoint=ovh-eu
and you currently have:
;[default]
; general configuration: default endpoint
endpoint=ovh-eu
I'll close this bug as it has been inactive for more than a month. Feel free to re-open it if you are still facing this issue.