コード例 #1
0
ファイル: tenants.py プロジェクト: fmontserrat/kahuna
def cleanup_default_tenants(context):
    """ Cleans up a previously created default tenants. """
    print "### Cleaning up tenants ###"
    admin = context.getAdministrationService()
    enterprises = admin.listEnterprises(Predicates.not(EnterprisePredicates.name("Abiquo")))
    for enterprise in enterprises:
        # This will remove the enterprise and all users (if none of them is a Cloud Admin)
        print "Removing enterprise %s and all users..." % enterprise.getName()
        enterprise.delete()
コード例 #2
0
ファイル: tenants.py プロジェクト: abelboldu/kahuna
def cleanup_default_tenants(config, context):
    """ Cleans up a previously created default tenants """
    log.info("### Cleaning up tenants ###")
    admin = context.getAdministrationService()
    enterprises = admin.listEnterprises(
            Predicates.not(EnterprisePredicates.name("Abiquo")))
    for enterprise in enterprises:
        # This will remove the enterprise and all users
        # (if none of them is a Cloud Admin)
        log.info("Removing enterprise %s and all users..."  \
                % enterprise.getName())
        enterprise.delete()

    rolefilter = Predicates.not(Predicates.or(
        RolePredicates.name("CLOUD_ADMIN"),
        RolePredicates.name("ENTERPRISE_ADMIN"),
        RolePredicates.name("USER")))
    roles = admin.listRoles(rolefilter)
    # This will remove all non default roles
    for role in roles:
        log.info("Removing role %s..." % role.getName())
        role.delete()