mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
CLOUDSTACK-199: Fix how cloud-setup-databases parses user:password@host
Patch splits by right most @ in supplied argument to get user:password and host substrings. Signed-off-by: Rohit Yadav <rohit.yadav@citrix.com>
This commit is contained in:
parent
6540ff8fa1
commit
f2e0fa230d
@ -475,8 +475,15 @@ for example:
|
||||
self.errorAndExit("There are more than one parameters for user:password@hostname (%s)"%self.args)
|
||||
|
||||
arg = self.args[0]
|
||||
stuff = arg.split("@", 1)
|
||||
if len(stuff) == 1: stuff.append("localhost")
|
||||
try:
|
||||
splitIndex = arg.rindex('@')
|
||||
except ValueError:
|
||||
# If it failed to find @, use host=localhost
|
||||
splitIndex = len(arg)
|
||||
arg += "@localhost"
|
||||
finally:
|
||||
stuff = [arg[:splitIndex], arg[splitIndex+1:]]
|
||||
|
||||
self.user,self.password = parseUserAndPassword(stuff[0])
|
||||
self.host,self.port = parseHostInfo(stuff[1])
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user