本文整理汇总了Python中Products.ZenUtils.ZenScriptBase.ZenScriptBase.connect方法的典型用法代码示例。如果您正苦于以下问题:Python ZenScriptBase.connect方法的具体用法?Python ZenScriptBase.connect怎么用?Python ZenScriptBase.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Products.ZenUtils.ZenScriptBase.ZenScriptBase
的用法示例。
在下文中一共展示了ZenScriptBase.connect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from Products.ZenUtils.ZenScriptBase import ZenScriptBase [as 别名]
# 或者: from Products.ZenUtils.ZenScriptBase.ZenScriptBase import connect [as 别名]
with open(os.devnull, 'w') as devnull:
subprocess.check_call(['sudo', 'rabbitmqctl', '-p', vhost, 'clear_permissions', user], stdout=devnull)
subprocess.check_call(['sudo', 'rabbitmqctl', '-p', vhost, 'set_permissions', user, 'zenoss.openstack.*', 'zenoss.openstack.*', '^$'], stdout=devnull)
except subprocess.CalledProcessError, e:
sys.exit("Unable to exceute rabbitmqctl (%s)" % e)
if __name__ == '__main__':
if not VERSION5:
require_rabbitmq()
create_exchanges()
# Log into ZODB..
try:
script = ZenScriptBase()
script.connect()
dmd = script.dmd
except Exception, e:
sys.exit("Unable to connect to ZODB: %s" % e)
create_default_credentials(dmd)
if not VERSION5:
provision_user(dmd)
rabbit_ip = {}
if VERSION5:
from Products.ZenUtils.controlplane.application import getConnectionSettings
from Products.ZenUtils.controlplane import ControlPlaneClient
client = ControlPlaneClient(**getConnectionSettings())