Skip to content

Commit a05b2a4

Browse files
Merge pull request #149 from baloo/fixup/config-report-slave
report-slave: Allow reporting of port if username not supplied
2 parents 8525c88 + 96f2855 commit a05b2a4

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

pymysqlreplication/binlogstream.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,11 @@ def __init__(self, value):
5757
except IndexError:
5858
pass
5959
elif isinstance(value, dict):
60-
try:
61-
self.hostname = value['hostname']
62-
self.username = value['username']
63-
self.password = value['password']
64-
self.port = int(value['port'])
65-
except KeyError:
66-
pass
60+
for key in ['hostname', 'username', 'password', 'port']:
61+
try:
62+
setattr(self, key, value[key])
63+
except KeyError:
64+
pass
6765
else:
6866
self.hostname = value
6967

0 commit comments

Comments
 (0)