コード例 #1
0
def get_mongo_dump_executable(version_info):
    dump_exe = get_mongo_executable(version_info,
                                    'mongodump',
                                    version_check_pref=
                                    VersionPreference.LATEST_MINOR)
    # Warn the user if it is not an exact match (minor match)
    if version_info and version_info != dump_exe.version:
        log_warning("Using mongodump '%s' that does not exactly match "
                    "server version '%s'" % (dump_exe.version, version_info))

    return dump_exe.path
コード例 #2
0
ファイル: dump.py プロジェクト: Mat-Loz/mongoctl
def get_mongo_dump_executable(server_version):
    dump_exe = get_mongo_executable(server_version,
                                    'mongodump',
                                    version_check_pref=
                                    VERSION_PREF_EXACT_OR_MINOR)
    # Warn the user if it is not an exact match (minor match)
    if server_version and version_obj(server_version) != dump_exe.version:
        log_warning("Using mongodump '%s' that does not exactly match "
                    "server version '%s'" % (dump_exe.version, server_version))

    return dump_exe.path
コード例 #3
0
def get_mongo_dump_executable(server_version):
    dump_exe = get_mongo_executable(
        server_version,
        'mongodump',
        version_check_pref=VERSION_PREF_EXACT_OR_MINOR)
    # Warn the user if it is not an exact match (minor match)
    if server_version and version_obj(server_version) != dump_exe.version:
        log_warning("Using mongodump '%s' that does not exactly match "
                    "server version '%s'" % (dump_exe.version, server_version))

    return dump_exe.path
コード例 #4
0
ファイル: server.py プロジェクト: gandhigautam/mongoctl
 def timeout_maybe_db_command(self, cmd, dbname):
     try:
         result = self.db_command(cmd, dbname)
         return result
     except Exception, e:
         log_exception(e)
         if "timed out" in str(e):
             log_warning("Command %s is taking a while to complete. "
                         "This is not necessarily bad. " %
                         document_pretty_string(cmd))
         else:
             raise
コード例 #5
0
ファイル: server.py プロジェクト: macroeyes/mongoctl
 def timeout_maybe_db_command(self, cmd, dbname):
     try:
         result = self.db_command(cmd, dbname)
         return result
     except Exception, e:
         log_exception(e)
         if "timed out" in str(e):
             log_warning("Command %s is taking a while to complete. "
                         "This is not necessarily bad. " %
                         document_pretty_string(cmd))
         else:
             raise
コード例 #6
0
ファイル: restore.py プロジェクト: zenglzh/mongoctl
def get_mongo_restore_executable(version_info):
    restore_exe = get_mongo_executable(version_info,
                                       'mongorestore',
                                       version_check_pref=
                                       VERSION_PREF_EXACT_OR_MINOR)
    # Warn the user if it is not an exact match (minor match)
    if version_info and version_info != restore_exe.version:
        log_warning("Using mongorestore '%s' that does not exactly match"
                    "server version '%s'" % (restore_exe.version,
                                             version_info))

    return restore_exe.path
コード例 #7
0
ファイル: restore.py プロジェクト: zenglzh/mongoctl
def get_mongo_restore_executable(version_info):
    restore_exe = get_mongo_executable(
        version_info,
        'mongorestore',
        version_check_pref=VERSION_PREF_EXACT_OR_MINOR)
    # Warn the user if it is not an exact match (minor match)
    if version_info and version_info != restore_exe.version:
        log_warning("Using mongorestore '%s' that does not exactly match"
                    "server version '%s'" %
                    (restore_exe.version, version_info))

    return restore_exe.path
コード例 #8
0
ファイル: server.py プロジェクト: gandhigautam/mongoctl
    def get_pid(self):
        pid_file_path = self.get_pid_file_path()
        if os.path.exists(pid_file_path):
            pid_file = open(pid_file_path, 'r')
            pid = pid_file.readline().strip('\n')
            if pid and pid.isdigit():
                return int(pid)
            else:
                log_warning("Unable to determine pid for server '%s'. "
                            "Not a valid number in '%s"'' %
                            (self.id, pid_file_path))
        else:
            log_warning("Unable to determine pid for server '%s'. "
                        "pid file '%s' does not exist" %
                        (self.id, pid_file_path))

        return None
コード例 #9
0
ファイル: server.py プロジェクト: macroeyes/mongoctl
    def get_pid(self):
        pid_file_path = self.get_pid_file_path()
        if os.path.exists(pid_file_path):
            pid_file = open(pid_file_path, 'r')
            pid = pid_file.readline().strip('\n')
            if pid and pid.isdigit():
                return int(pid)
            else:
                log_warning("Unable to determine pid for server '%s'. "
                            "Not a valid number in '%s"'' %
                            (self.id, pid_file_path))
        else:
            log_warning("Unable to determine pid for server '%s'. "
                        "pid file '%s' does not exist" %
                        (self.id, pid_file_path))

        return None
コード例 #10
0
ファイル: restore.py プロジェクト: mongolab/mongoctl
def get_mongo_restore_executable(version_info):

    version_check_pref = VersionPreference.EXACT_OR_MINOR

    if version_info and version_info.equals_ignore_edition(make_version_info("3.0.7")):
        log_info("Requiring version 3.0.6 instead of 3.0.7 b/c of mongorestore "
                 "bug TOOLS-939")
        version_info = make_version_info("3.0.6", version_info.edition)
        version_check_pref = VersionPreference.EXACT

    restore_exe = get_mongo_executable(version_info,
                                       'mongorestore',
                                       version_check_pref=
                                       version_check_pref)

    # Warn the user if it is not an exact match (minor match)
    if version_info and version_info != restore_exe.version:
        log_warning("Using mongorestore '%s' that does not exactly match"
                    "server version '%s'" % (restore_exe.version,
                                             version_info))

    return restore_exe.path
コード例 #11
0
ファイル: restore.py プロジェクト: sfdcmahi/mongoctl
def get_mongo_restore_executable(version_info):

    version_check_pref = VersionPreference.EXACT_OR_MINOR

    if version_info and version_info.equals_ignore_edition(
            make_version_info("3.0.7")):
        log_info(
            "Requiring version 3.0.6 instead of 3.0.7 b/c of mongorestore "
            "bug TOOLS-939")
        version_info = make_version_info("3.0.6", version_info.edition)
        version_check_pref = VersionPreference.EXACT

    restore_exe = get_mongo_executable(version_info,
                                       'mongorestore',
                                       version_check_pref=version_check_pref)

    # Warn the user if it is not an exact match (minor match)
    if version_info and version_info != restore_exe.version:
        log_warning("Using mongorestore '%s' that does not exactly match"
                    "server version '%s'" %
                    (restore_exe.version, version_info))

    return restore_exe.path