本文整理汇总了Python中DataStore.create_postgresql_db_connection_str方法的典型用法代码示例。如果您正苦于以下问题:Python DataStore.create_postgresql_db_connection_str方法的具体用法?Python DataStore.create_postgresql_db_connection_str怎么用?Python DataStore.create_postgresql_db_connection_str使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataStore
的用法示例。
在下文中一共展示了DataStore.create_postgresql_db_connection_str方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: registerDataStores
# 需要导入模块: import DataStore [as 别名]
# 或者: from DataStore import create_postgresql_db_connection_str [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)
#.........这里部分代码省略.........