本文整理汇总了Python中Utils.XmlUtil.removeElement方法的典型用法代码示例。如果您正苦于以下问题:Python XmlUtil.removeElement方法的具体用法?Python XmlUtil.removeElement怎么用?Python XmlUtil.removeElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils.XmlUtil
的用法示例。
在下文中一共展示了XmlUtil.removeElement方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _update_account_settings
# 需要导入模块: from Utils import XmlUtil [as 别名]
# 或者: from Utils.XmlUtil import removeElement [as 别名]
def _update_account_settings(self, account, key, token, endpoint, aikey=None):
"""
Update the MDSD configuration Account element with Azure table storage properties.
Exactly one of (key, token) must be provided. If an aikey is passed, then add a new Account element for Application
Insights with the application insights key.
:param account: Storage account to which LAD should write data
:param key: Shared key secret for the storage account, if present
:param token: SAS token to access the storage account, if present
:param endpoint: Identifies the Azure instance (public or specific sovereign cloud) where the storage account is
:param aikey: Key for accessing AI, if present
"""
assert key or token, "Either key or token must be given."
assert self._mdsd_config_xml_tree is not None
handler_cert_path, handler_pkey_path = self._get_handler_cert_pkey_paths(self._ext_settings.get_handler_settings())
if key:
key = self._encrypt_secret_with_cert(handler_cert_path, key)
XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/Account',
"account", account, ['isDefault', 'true'])
XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/Account',
"key", key, ['isDefault', 'true'])
XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/Account',
"decryptKeyPath", handler_pkey_path, ['isDefault', 'true'])
XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/Account',
"tableEndpoint", endpoint, ['isDefault', 'true'])
XmlUtil.removeElement(self._mdsd_config_xml_tree, 'Accounts', 'SharedAccessSignature')
else: # token
token = self._encrypt_secret_with_cert(handler_cert_path, token)
XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/SharedAccessSignature',
"account", account, ['isDefault', 'true'])
XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/SharedAccessSignature',
"key", token, ['isDefault', 'true'])
XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/SharedAccessSignature',
"decryptKeyPath", handler_pkey_path, ['isDefault', 'true'])
XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/SharedAccessSignature',
"tableEndpoint", endpoint, ['isDefault', 'true'])
XmlUtil.removeElement(self._mdsd_config_xml_tree, 'Accounts', 'Account')
if aikey:
AIUtil.createAccountElement(self._mdsd_config_xml_tree, aikey)
示例2: _update_account_settings
# 需要导入模块: from Utils import XmlUtil [as 别名]
# 或者: from Utils.XmlUtil import removeElement [as 别名]
def _update_account_settings(self, account, token, endpoint):
"""
Update the MDSD configuration Account element with Azure table storage properties.
Exactly one of (key, token) must be provided.
:param account: Storage account to which LAD should write data
:param token: SAS token to access the storage account
:param endpoint: Identifies the Azure instance (public or specific sovereign cloud) where the storage account is
"""
assert token, "Token must be given."
assert self._mdsd_config_xml_tree is not None
token = self._encrypt_secret_with_cert(token)
assert token, "Could not encrypt token"
XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/SharedAccessSignature',
"account", account, ['isDefault', 'true'])
XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/SharedAccessSignature',
"key", token, ['isDefault', 'true'])
XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/SharedAccessSignature',
"decryptKeyPath", self._pkey_path, ['isDefault', 'true'])
XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/SharedAccessSignature',
"tableEndpoint", endpoint, ['isDefault', 'true'])
XmlUtil.removeElement(self._mdsd_config_xml_tree, 'Accounts', 'Account')