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


Python LadDiagnosticUtil.getResourceIdFromLadCfg方法代码示例

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


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

示例1: getResourceId

# 需要导入模块: from Utils import LadDiagnosticUtil [as 别名]
# 或者: from Utils.LadDiagnosticUtil import getResourceIdFromLadCfg [as 别名]
def getResourceId():
    ladCfg = readPublicConfig('ladCfg')
    resourceId = LadUtil.getResourceIdFromLadCfg(ladCfg)
    if not resourceId:
        encodedXmlCfg = readPublicConfig('xmlCfg').strip()
        if encodedXmlCfg:
            xmlCfg = base64.b64decode(encodedXmlCfg)
            resourceId = XmlUtil.getXmlValue(XmlUtil.createElement(xmlCfg),'diagnosticMonitorConfiguration/metrics','resourceId')
# Azure portal uses xmlCfg which contains WadCfg which is pascal case, Currently we will support both casing and deprecate one later
            if not resourceId:
                resourceId = XmlUtil.getXmlValue(XmlUtil.createElement(xmlCfg),'DiagnosticMonitorConfiguration/Metrics','resourceId')
    return resourceId
开发者ID:arunjvs,项目名称:azure-linux-extensions,代码行数:14,代码来源:diagnostic.py

示例2: get_resource_id

# 需要导入模块: from Utils import LadDiagnosticUtil [as 别名]
# 或者: from Utils.LadDiagnosticUtil import getResourceIdFromLadCfg [as 别名]
 def get_resource_id(self):
     """
     Try to get resourceId from LadCfg. If not present, try to fetch from xmlCfg.
     """
     lad_cfg = self.read_public_config('ladCfg')
     resource_id = LadUtil.getResourceIdFromLadCfg(lad_cfg)
     if not resource_id:
         encoded_xml_cfg = self.read_public_config('xmlCfg').strip()
         if encoded_xml_cfg:
             xml_cfg = base64.b64decode(encoded_xml_cfg)
             resource_id = XmlUtil.getXmlValue(XmlUtil.createElement(xml_cfg),
                                               'diagnosticMonitorConfiguration/metrics', 'resourceId')
             # Azure portal uses xmlCfg which contains WadCfg which is pascal case
             # Currently we will support both casing and deprecate one later
             if not resource_id:
                 resource_id = XmlUtil.getXmlValue(XmlUtil.createElement(xml_cfg),
                                                   'DiagnosticMonitorConfiguration/Metrics', 'resourceId')
     return resource_id
开发者ID:vityagi,项目名称:azure-linux-extensions,代码行数:20,代码来源:lad_ext_settings.py

示例3: test_getResourceIdFromLadCfg

# 需要导入模块: from Utils import LadDiagnosticUtil [as 别名]
# 或者: from Utils.LadDiagnosticUtil import getResourceIdFromLadCfg [as 别名]
 def test_getResourceIdFromLadCfg(self):
     self.assertIsNone(LadUtil.getResourceIdFromLadCfg(self.missing_from_config))
     res_id = LadUtil.getResourceIdFromLadCfg(self.valid_config)
     self.assertIsNotNone(res_id)
     self.assertIn("1111-2222-3333-4444", res_id)
开发者ID:Azure,项目名称:azure-linux-extensions,代码行数:7,代码来源:test_LadDiagnosticUtil.py


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