Metadata-Version: 2.1
Name: vstorage-cep-collector
Version: 0.2.21
Summary: CEP collection library installed on backend nodes (summary.json, cluster-info.json).
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"

## vstorage-cep-collector

Python package **`vstorage_cep_collector`** shipped as RPM **`vstorage-cep-collector`**
(noarch). It implements CEP collection for **`summary.json`** and **`cluster-info.json`**
on **vstorage-ui-backend** nodes.

### Naming (read this once)

| What | Name |
|------|------|
| Git repository | `vstorage-cep-collector` |
| Spec / RPM package | `vstorage-cep-collector` (`vstorage-cep-collector.spec`) |
| Python import | `vstorage_cep_collector` |
| Setuptools distribution | `vstorage-cep-collector` |

**Repository URL in the spec (`URL:`)** must match where this code actually lives; update
`vstorage-cep-collector.spec` if your team uses a different host or path.

### Runtime contract

- Runs **only** on nodes where **`vstorage-ui-backend`** is installed and importable.
- This code **imports `backend.*`**; the backend may import `vstorage_cep_collector.*`.
- Coordinate **API and version** bumps with the backend team when changing shared types
  or `ReportBase` behaviour.

### Version source of truth

**`vstorage_cep_collector.__version__`** is canonical. `pyproject.toml` loads it via
`[tool.setuptools.dynamic]`. **`vstorage-cep-collector.spec`** `%define current_version`
must match for `%prep` tarball naming; CI / `tests/test_packaging_version.py` enforces
alignment.

**RPM identity:** the full **NVR** (e.g. `0.1.5-1`) can change on rebuilds while
**`__version__`** stays the same. Automation that cares about “which build is installed”
should use **`rpm -q vstorage-cep-collector`** (or NVR), not only Python `__version__`.

### Build RPM (local / CI)

Requires **Podman** or **Docker**:

```bash
./scripts/build-rpm-container.sh
```

Artifacts land in **`./RPMS/`** (override with `RPM_OUT=/path`).

The script fails if `rpmbuild` produces no `.rpm` files.

### DevOps / official build pipeline

The container script above is for **developers and ad-hoc CI**. Your organisation may
build this package via **separate repos** (e.g. `*.vhistrg` + `*.vzspecs`) and internal
pipelines. **Confirm with DevOps** before treating `scripts/build-rpm-container.sh` as
the only supported build path.

### Install on a cluster node

```bash
rpm -Uvh vstorage-cep-collector-<version>.noarch.rpm
```

Must be installed on a node that already has **`vstorage-ui-backend`** (runtime imports
`backend.*`). The RPM spec does not declare `Requires: vstorage-ui-backend` to avoid a
circular dependency with the backend package; use image/provisioning to install both.

### Entry points

- **`vstorage_cep_collector.summary_report.SummaryReport`**
- **`vstorage_cep_collector.cluster_info_report.ClusterInfoReport`**

Both subclass backend **`ReportBase`**; the backend wires them into the report factory.

### CI / security scans

| Where | What |
|-------|------|
| **Jenkins** (`Jenkinsfile`) | `make test` + Gitleaks (`scripts/gitleaks-scan.sh`) |
| **Bitbucket Pipelines** | PR/`master`: packaging tests + Gitleaks (same as [vhp-core](https://bitbucket.org/virtuozzocore/vhp-core) `secret-scan`) |

Local secret scan:

```bash
make gitleaks
# or: ./scripts/gitleaks-scan.sh
```

Uses image `nexus.dev.vzint.dev/ci-rust-sonarqube:latest` when `gitleaks` is not on `PATH`.

### Tests (no backend required)

```bash
make test
# or: python3 -m unittest discover -s tests -v
```

Optional: `pip install '.[dev]'` and `pytest` if you add pytest-style tests later.
