saltstack / saltstack/salt

[BUG] networks incorrect in Hetzner VM

Open
#61,941 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Salt-Cloud severity-medium
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
When creating VM on Hetzner, "networks" parameter is misinterpreted

Setup
/etc/salt/cloud.providers.d/hetzner.conf
vw-hetz:
driver: hetzner
key: ******
minion:
master: 172.16.54.2

/etc/salt/cloud.profiles.d/test.conf
vw-hetz-test:
provider: vw-hetz
image: debian-11
size: cpx11
private_key: "/root/.ssh/id_rsa"
networks:
- "brinet-1"
ssh_keys:
- root@brine
- darjoc@tpbase

Steps to Reproduce the behavior
Run:
salt-cloud -p vw-hetz-test minion1

Expected behavior
Expecting a new VM created and attached to network "brinet-1".

Actual result
New VM created, however not attached to network "brinet-1".

Versions Report

salt-cloud -V

Salt Version:
Salt: 3004.1

Dependency Versions:
Apache Libcloud: 3.2.0
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.8.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.11.3
libgit2: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.0
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: Not Installed
pycryptodome: 3.9.7
pygit2: Not Installed
Python: 3.9.2 (default, Feb 28 2021, 17:03:44)
python-gnupg: Not Installed
PyYAML: 5.3.1
PyZMQ: 20.0.0
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.4

System Versions:
dist: debian 11 bullseye
locale: utf-8
machine: x86_64
release: 5.10.0-13-amd64
system: Linux
version: Debian GNU/Linux 11 bullseye

Suggested fix
https://github.com/saltstack/salt/blob/v3004.1/salt/cloud/clouds/hetzner.py#L326

Current: networks = [vol for vol in client.networks.get_all() if vol in networks]
Suggested: networks = [vol for vol in client.networks.get_all() if vol.name in networks]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at salt/cloud/clouds/hetzner.py around line 326 and inspect how the configured networks are matched against the provider's networks. Reproduce with salt-cloud -p vw-hetz-test minion1 using the supplied profile, then verify that the new VM is attached to brinet-1.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cloud
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.