本文整理汇总了Python中service.accounts.openstack.AccountDriver.init_security_group方法的典型用法代码示例。如果您正苦于以下问题:Python AccountDriver.init_security_group方法的具体用法?Python AccountDriver.init_security_group怎么用?Python AccountDriver.init_security_group使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类service.accounts.openstack.AccountDriver
的用法示例。
在下文中一共展示了AccountDriver.init_security_group方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: security_group_init
# 需要导入模块: from service.accounts.openstack import AccountDriver [as 别名]
# 或者: from service.accounts.openstack.AccountDriver import init_security_group [as 别名]
def security_group_init(core_identity):
os_driver = OSAccountDriver(core_identity.provider)
creds = core_identity.get_credentials()
security_group = os_driver.init_security_group(
creds["key"], creds["secret"], creds["ex_tenant_name"], creds["ex_tenant_name"], os_driver.MASTER_RULES_LIST
)
return security_group
示例2: security_group_init
# 需要导入模块: from service.accounts.openstack import AccountDriver [as 别名]
# 或者: from service.accounts.openstack.AccountDriver import init_security_group [as 别名]
def security_group_init(core_identity, max_attempts = 3):
os_driver = OSAccountDriver(core_identity.provider)
creds = core_identity.get_credentials()
#TODO: Remove kludge when openstack connections can be
#Deemed reliable. Otherwise generalize this pattern so it
#can be arbitrarilly applied to any call that is deemed 'unstable'.
# -Steve
attempt = 0
while attempt < max_attempts:
attempt += 1
security_group = os_driver.init_security_group(
creds['key'], creds['secret'],
creds['ex_tenant_name'], creds['ex_tenant_name'],
os_driver.MASTER_RULES_LIST)
if security_group:
return security_group
time.sleep(2**attempt)
raise SecurityGroupNotCreated()