diff --git a/.forgejo/workflows/cd.yaml b/.forgejo/workflows/cd.yaml new file mode 100644 index 0000000..3690493 --- /dev/null +++ b/.forgejo/workflows/cd.yaml @@ -0,0 +1,25 @@ +name: CD + +on: + push: + tags: + - '*' +jobs: + ci: + runs-on: docker + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: '3.13' + cache: 'pip' + + - run: pip install -r requirements.txt + + - run: python3 -m build + + - run: twine upload dist/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} \ No newline at end of file diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml new file mode 100644 index 0000000..6a0f581 --- /dev/null +++ b/.forgejo/workflows/ci.yaml @@ -0,0 +1,17 @@ +name: CI + +on: [ push ] +jobs: + ci: + runs-on: docker + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: '3.13' + cache: 'pip' + + - run: pip install -r requirements.txt + + - run: pylint --max-line-length=120 netbox_pve_sync \ No newline at end of file diff --git a/Changelog.md b/Changelog.md index 6b88a73..933d873 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,8 @@ ## [Unreleased] +## [0.2.2] - 07/05/2025 + ### Fixed - Use `NB_CLUSTER_ID` even for VM update. diff --git a/README.md b/README.md index 900fa1f..2911245 100644 --- a/README.md +++ b/README.md @@ -63,5 +63,5 @@ The following env variables will need to be set: You can then execute the script using the following command: ``` -PVE_API_HOST=xx PVE_API_USER=xx PVE_API_TOKEN=xx PVE_API_SECRET=xx NB_API_URL=xx NB_API_TOKEN=xx python3 -m netbox_pve_sync -``` \ No newline at end of file +PVE_API_HOST=xx PVE_API_USER=xx PVE_API_TOKEN=xx PVE_API_SECRET=xx NB_API_URL=xx NB_API_TOKEN=xx nbpxsync +``` diff --git a/netbox_pve_sync/__init__.py b/netbox_pve_sync/__init__.py index 3cbb4d2..de581bd 100644 --- a/netbox_pve_sync/__init__.py +++ b/netbox_pve_sync/__init__.py @@ -220,10 +220,6 @@ def _process_pve_virtual_machine_network_interface( _interface_vlan_id: Optional[int], _pve_virtual_machine_ip_addresses: dict, ) -> dict: - print( - f'_process_pve_virtual_machine_network_interface(_nb_api, _nb_objects, {_nb_virtual_machine.serial}, {_interface_name}, {_interface_mac_address}, {_interface_vlan_id}, {_pve_virtual_machine_ip_addresses})' - ) - nb_virtual_machines_interface = _nb_objects['virtual_machines_interfaces'] \ .get(_nb_virtual_machine.id, {}) \ .get(_interface_name) @@ -235,10 +231,6 @@ def _process_pve_virtual_machine_network_interface( description=_interface_mac_address, ) - print( - f'_nb_api.virtualization.interfaces.create(virtual_machine={_nb_virtual_machine.id}, name={_nb_virtual_machine.name}, description={_interface_mac_address}) = {nb_virtual_machines_interface} ({nb_virtual_machines_interface.id})' - ) - if _nb_virtual_machine.id not in _nb_objects['virtual_machines_interfaces']: _nb_objects['virtual_machines_interfaces'][_nb_virtual_machine.id] = {} @@ -254,10 +246,6 @@ def _process_pve_virtual_machine_network_interface( assigned_object_id=nb_virtual_machines_interface.id, ) - print( - f'_nb_api.dcim.mac_addresses.create(mac_address={_interface_mac_address}, assigned_object_type=virtualization.vminterface, assigned_object_id={nb_virtual_machines_interface.id}) = {nb_mac_address}' - ) - _nb_objects['mac_addresses'][_interface_mac_address] = nb_mac_address nb_virtual_machines_interface.primary_mac_address = nb_mac_address.id diff --git a/pyproject.toml b/pyproject.toml index 151b8f5..37f5f13 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" [project] name = "netbox-pve-sync" -version = "0.2.1" +version = "0.2.2" authors = [ { name = "Aloïs Micard", email = "alois@micard.lu" }, ]