当前位置: 首页>>代码示例>>Python>>正文


Python DataStore.getitem方法代码示例

本文整理汇总了Python中DataStore.getitem方法的典型用法代码示例。如果您正苦于以下问题:Python DataStore.getitem方法的具体用法?Python DataStore.getitem怎么用?Python DataStore.getitem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataStore的用法示例。


在下文中一共展示了DataStore.getitem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: registerDataStores

# 需要导入模块: import DataStore [as 别名]
# 或者: from DataStore import getitem [as 别名]
def registerDataStores():
    registerSuccessful = True
    dataStorePaths = []
    # ---------------------------------------------------------------------
    # Create "replicated" set of data stores that will only be used
    # during publishing.
    # ---------------------------------------------------------------------
    print "\n---------------------------------------------------------------------------"
    print "- Registering temporary 'replicated' set of data stores to use during publishing..."
    print "---------------------------------------------------------------------------"
    print
 
    regNameAppend = "_InstallOnly"
    
    # Register folders
    for pubFolderServerName in installOnlyPublishingFolders.keys():
        
        registrationName = dataFolderDStoreName + "_" + pubFolderServerName + regNameAppend
        
        # Get data folder based on the existing folder data store
        searchPath = "/fileShares/" + dataFolderDStoreName
        success, item = DataStore.getitem(serverFQDN, serverPort, userName, passWord, searchPath, useSSL)
        
        if not success:
            registerSuccessful = False
            print "ERROR: Could not find existing data store item " + searchPath + \
                    ". Can't register temp data store " + registrationName
        else:
            serverFolderPath = item['info']['path'].encode('ascii')
            pubFolderPath = installOnlyPublishingFolders[pubFolderServerName]
            dsPath, dsItem = DataStore.create_replicated_folder_item(
                                registrationName, pubFolderPath, serverFolderPath)
            
            print "\n\n\tServer: " + pubFolderServerName
            print "\t\tFolder: Publisher - " + pubFolderPath + "; Server - " + serverFolderPath
            print "\t\t" + dsPath
            
            # Add data store path to list of data stores to unregister
            dataStorePaths.append(dsPath)
            
            # Delete data store if it already exists
            unregisterSuccessful = True
            itemExists, item = DataStore.getitem(serverFQDN, serverPort, userName, passWord, dsPath, useSSL)
            if itemExists:
                print "\t\tData store already exists. Will delete and re-register..."
                success, response = DataStore.unregister(serverFQDN, serverPort, userName, passWord, dsPath, useSSL)
                if success:
                    print "\t\tDeleted successfully."
                else:
                    unregisterSuccessful = False
                    print "\t\tCould not delete the existing data store. Will assume existing data store properties are correct and re-use for publishing."
                    
                        
            # Register the data store item
            if unregisterSuccessful:
                success, response = DataStore.register(serverFQDN, serverPort, userName, passWord, dsItem, useSSL)
                if success:
                    print "\tDone."
                else:
                    registerSuccessful = False
                    print "ERROR:" + str(response)
                
                
    # Register databases
    for db in databases:
        isManaged = databases[db][0]
        
        if not isManaged:
            print "\n\n\tDatabase: " + db
            
            for publishingDBServer in installOnlyPublishingDBServers:
                
                registrationName = databases[db][1] + "_" + publishingDBServer + regNameAppend
                
                # Create the publishing database connection string
                success, pub_db_conn = DataStore.create_postgresql_db_connection_str(
                                        serverFQDN, serverPort, userName, passWord,
                                        publishingDBServer, db, dbuser, passWord, useSSL)
                if not success:
                    registerSuccessful = False
                    print "ERROR: error encountered while creating publishing database connection string -"
                    print str(pub_db_conn)
                
                # Create the server database connection string
                success, server_db_conn = DataStore.create_postgresql_db_connection_str(
                                        serverFQDN, serverPort, userName, passWord,
                                        server, db, dbuser, passWord, useSSL)
                if not success:
                    registerSuccessful = False
                    print "ERROR: error encountered while creating server database connection string -"
                    print str(server_db_conn)
                    
                # Create the data store item
                dsPath, dsItem = DataStore.create_replicated_entdb_item(
                                        registrationName, pub_db_conn, server_db_conn)
                print "\t\t" + dsPath
                
                # Add data store path to list of data stores to unregister
                dataStorePaths.append(dsPath)
                
#.........这里部分代码省略.........
开发者ID:ACueva,项目名称:ops-server-config,代码行数:103,代码来源:PublishToOpsServer.py


注:本文中的DataStore.getitem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。