Ejemplo n.º 1
0
                                                         db_no_obj_value=db1,
                                                         only_obj_value=obj2,
                                                         db_obj_label='db2',
                                                         db_obj_value=db2)
            parser.error(
                PARSE_ERR_DB_OBJ_MISSING_MSG.format(detail=detail,
                                                    db1_label='db1',
                                                    obj1_label='object1',
                                                    db2_label='db2',
                                                    obj2_label='object2'))

        # We have db1.obj:db2.obj
        if obj1:
            try:
                diff = object_diff(server1_values, server2_values,
                                   "%s.%s" % (db1, obj1),
                                   "%s.%s" % (db2, obj2), options)
            except UtilError:
                _, e, _ = sys.exc_info()
                print("ERROR: %s" % e.errmsg)
                sys.exit(1)
            if diff is not None:
                diff_failed = True

        # We have db1:db2
        else:
            try:
                res = database_diff(server1_values, server2_values, db1, db2,
                                    options)
            except UtilError:
                _, e, _ = sys.exc_info()
Ejemplo n.º 2
0
                                                         db_no_obj_value=db1,
                                                         only_obj_value=obj2,
                                                         db_obj_label='db2',
                                                         db_obj_value=db2)
            parser.error(PARSE_ERR_DB_OBJ_MISSING_MSG.format(
                detail=detail,
                db1_label='db1',
                obj1_label='object1',
                db2_label='db2',
                obj2_label='object2'))

        # We have db1.obj:db2.obj
        if obj1:
            try:
                diff = object_diff(server1_values, server2_values,
                                   "%s.%s" % (db1, obj1),
                                   "%s.%s" % (db2, obj2), options)
            except UtilError:
                _, e, _ = sys.exc_info()
                print("ERROR: %s" % e.errmsg)
                sys.exit(1)
            if diff is not None:
                diff_failed = True

        # We have db1:db2
        else:
            try:
                res = database_diff(server1_values, server2_values,
                                    db1, db2, options)
            except UtilError:
                _, e, _ = sys.exc_info()
Ejemplo n.º 3
0
for argument in args:
    m_obj = re.match("([\w\-\_]+)(?:\.([\w\-\_]+))?:([\w\-\_]+)(?:\.([\w\-\_]+))?", argument)
    if not m_obj:
        parser.error("Invalid format for object compare argument. "
                      "Format should be: db1.object:db2:object or db1:db2.")
    db1, obj1, db2, obj2 = m_obj.groups()
    if (obj1 is not None and obj2 is None) or \
       (obj1 is None and obj2 is not None):
        parser.error("Incorrect object compare argument. "
                      "Format should be: db1.object:db2:object or db1:db2.")
    
    # We have db1.obj:db2.obj
    if obj1 is not None:
        try:
            diff = object_diff(server1_values, server2_values,
                               "`%s`.`%s`" % (db1, obj1),
                               "`%s`.`%s`" % (db2, obj2), options)
        except UtilError, e:
            print "ERROR:", e.errmsg
            exit(1)
        except Exception, e:
            print e
            exit(1)
        if diff is not None:
            diff_failed = True
            
    # We have db1:db2
    else:
        try:
            res = database_diff(server1_values, server2_values, db1, db2, options)
        except UtilError, e: