~chuck-bell/mysql-utilities/mysql-utilities

« back to all changes in this revision

Viewing changes to mysql/utilities/common/user.py

  • Committer: chuck.bell at oracle
  • Date: 2011-09-29 14:14:38 UTC
  • Revision ID: chuck.bell@oracle.com-20110929141438-clzfl7m2769wt2jm
WL#5983 : allow user to specify binary log file and position (mysqlreplicate)

This patch adds new features to mysqlreplicate to permit starting replication
from the beginning, starting from a specific log file, and starting from a
specific log file and position.

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
    """   
55
55
    
56
56
        
57
 
    def __init__(self, server1, user, verbose=False):
 
57
    def __init__(self, server1, user, verbosity=0):
58
58
        """Constructor
59
59
        
60
60
        server1[in]        Server class
65
65
        
66
66
        self.server1 = server1
67
67
        self.user, self.passwd, self.host = parse_user_host(user)
68
 
        self.verbose = verbose
 
68
        self.verbosity = verbosity
69
69
        self.current_user = None
70
70
        self.query_options = {
71
71
            'fetch' : False
93
93
            
94
94
        if passwd:
95
95
            query_str += "IDENTIFIED BY '%s'" % (passwd)
96
 
        if self.verbose:
 
96
        if self.verbosity > 0:
97
97
            print query_str
98
98
 
99
99
        res = self.server1.exec_query(query_str, self.query_options)
115
115
        else:
116
116
            query_str += "'%s'@'%s' " % (self.user, self.host)
117
117
            
118
 
        if self.verbose:
 
118
        if self.verbosity > 0:
119
119
            print query_str
120
120
            
121
121
        res = self.server1.exec_query(query_str, self.query_options)
221
221
            server = destination
222
222
        for row in res:
223
223
            # Create an instance of the user class.
224
 
            user = User(server, new_user, self.verbose)
 
224
            user = User(server, new_user, self.verbosity)
225
225
            if not user.exists():
226
226
                user.create()
227
227
 
241
241
                end = grant.index("'", start + len(search_str) + 2) + 2
242
242
                grant = grant[0:start] + grant[end:]
243
243
                
244
 
            if self.verbose:
 
244
            if self.verbosity > 0:
245
245
                print grant
246
246
                
247
247
            res = server.exec_query(grant, self.query_options)