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
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
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()