Skip to content

Commit f2e0fa2

Browse files
yadvrPrasanna Santhanam
authored andcommitted
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>
1 parent 6540ff8 commit f2e0fa2

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

setup/bindir/cloud-setup-databases.in

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,15 @@ for example:
475475
self.errorAndExit("There are more than one parameters for user:password@hostname (%s)"%self.args)
476476

477477
arg = self.args[0]
478-
stuff = arg.split("@", 1)
479-
if len(stuff) == 1: stuff.append("localhost")
478+
try:
479+
splitIndex = arg.rindex('@')
480+
except ValueError:
481+
# If it failed to find @, use host=localhost
482+
splitIndex = len(arg)
483+
arg += "@localhost"
484+
finally:
485+
stuff = [arg[:splitIndex], arg[splitIndex+1:]]
486+
480487
self.user,self.password = parseUserAndPassword(stuff[0])
481488
self.host,self.port = parseHostInfo(stuff[1])
482489

0 commit comments

Comments
 (0)