def compute_policy_remove(ctx, org_name, ovdc_name, compute_policy_name): try: restore_session(ctx) client = ctx.obj['client'] if not client.is_sysadmin(): raise Exception("Insufficient permission to perform operation.") ovdc = Ovdc(client) result = ovdc.update_ovdc_compute_policies(ovdc_name, org_name, compute_policy_name, ComputePolicyAction.REMOVE) stdout(result, ctx) except Exception as e: stderr(e, ctx)
def compute_policy_add(ctx, org_name, ovdc_name, compute_policy_name): CLIENT_LOGGER.debug(f'Executing command: {ctx.command_path}') try: restore_session(ctx) client = ctx.obj['client'] if not client.is_sysadmin(): raise Exception("Insufficient permission to perform operation.") ovdc = Ovdc(client) result = ovdc.update_ovdc_compute_policies(ovdc_name, org_name, compute_policy_name, ComputePolicyAction.ADD, False) stdout(result, ctx) CLIENT_LOGGER.debug(result) except Exception as e: stderr(e, ctx) CLIENT_LOGGER.error(str(e))
def compute_policy_remove(ctx, org_name, ovdc_name, compute_policy_name, remove_compute_policy_from_vms): CLIENT_LOGGER.debug(f'Executing command: {ctx.command_path}') try: client_utils.cse_restore_session(ctx) client = ctx.obj['client'] if not client.is_sysadmin(): raise Exception("Insufficient permission to perform operation.") ovdc = Ovdc(client) result = ovdc.update_ovdc_compute_policies( ovdc_name, org_name, compute_policy_name, shared_constants.ComputePolicyAction.REMOVE, remove_compute_policy_from_vms) stdout(result, ctx) CLIENT_LOGGER.debug(result) except Exception as e: stderr(e, ctx) CLIENT_LOGGER.error(str(e))