Exemple #1
0
def delete_group(group_names):
    """deletes user-group on pc"""

    client = get_api_client()

    for name in group_names:
        group_ref = Ref.Group(name)
        res, err = client.group.delete(group_ref["uuid"])
        if err:
            raise Exception("[{}] - {}".format(err["code"], err["error"]))

        LOG.info("Polling on user-group deletion task")
        res = res.json()
        task_state = watch_task(
            res["status"]["execution_context"]["task_uuid"], poll_interval=5
        )
        if task_state in ERGON_TASK.FAILURE_STATES:
            LOG.exception(
                "User-Group deletion task went to {} state".format(task_state)
            )
            sys.exit(-1)

    # Update user-groups in cache
    LOG.info("Updating user-groups cache ...")
    Cache.sync_table(cache_type=CACHE.ENTITY.USER_GROUP)
    LOG.info("[Done]")
Exemple #2
0
class TestDslProjectWithEnv(Project):
    """Sample DSL Project with environments"""

    providers = [
        Provider.Ntnx(
            account=Ref.Account("NTNX_LOCAL_AZ"),
            subnets=[Ref.Subnet(name="vlan.0", cluster="calmdev1")],
        ),
        Provider.Aws(account=Ref.Account("AWS account")),
        Provider.Azure(account=Ref.Account("AZURE_account")),
        Provider.Gcp(account=Ref.Account("GCP Account")),
        Provider.Vmware(account=Ref.Account("Vmware Account")),
        Provider.K8s(account=Ref.Account("K8S_account_basic_auth")),
    ]

    users = [
        Ref.User(name="*****@*****.**"),
    ]

    envs = [ProjEnvironment]

    groups = [
        Ref.Group(name="cn=sspgroup1,ou=pc,dc=systest,dc=nutanix,dc=com"),
    ]

    quotas = {
        "vcpus": 1,
        "storage": 2,
        "memory": 1,
    }
Exemple #3
0
def delete_group(group_names):

    client = get_api_client()

    for name in group_names:
        group_ref = Ref.Group(name)
        res, err = client.group.delete(group_ref["uuid"])
        if err:
            raise Exception("[{}] - {}".format(err["code"], err["error"]))

        LOG.info("Group '{}' deleted".format(name))
    LOG.warning("Please update cache.")
Exemple #4
0
class TestDemoProject(Project):
    """Test project"""

    providers = [
        Provider.Ntnx(
            account=Ref.Account(ACCOUNT),
            subnets=[Ref.Subnet(name=SUBNET, cluster=CLUSTER)],
        )
    ]

    users = [Ref.User(name=USER)]

    groups = [Ref.Group(name=GROUP)]

    quotas = {"vcpus": VCPUS, "storage": STORAGE, "memory": MEMORY}