]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
cephadm: _extract_host_info_from_*() refactor 57601/head
authorGuillaume Abrioux <gabrioux@ibm.com>
Tue, 21 May 2024 09:08:29 +0000 (05:08 -0400)
committerGuillaume Abrioux <gabrioux@ibm.com>
Mon, 27 May 2024 17:46:11 +0000 (19:46 +0200)
commitf4ddb2750eb04d7563356a41c7433a3c5d6ded57
tree6e3726a9ec28a71f4a073a302642ecf6ea796e52
parent0cd602b1d11a1cc56441fbb1faec9e7a9b1cd7d5
cephadm: _extract_host_info_from_*() refactor

The current implementation doesn't take into account the format is Yaml

This can lead to issue when oob details are passed to host service spec.

For instance, with the following host spec:

```
---
service_type: host
addr: 1.2.3.4
hostname: node1
oob:
  username: root
  password: passw0rd
  addr: 127.0.0.1
```

it is converted to a list like the following:

```
['service_type: host', 'addr: 1.2.3.4', 'hostname: node1',
 'oob:', 'username: root', 'password: passw0rd', 'addr: 127.0.0.1']
```

It was (probably) assumed that the pattern `addr:` would be present only
once. With the introduction of node-proxy, this isn't true anymore.

Now that the cephadm binary can embed some external libraries we can leverage pyyaml.
The idea is to use proper yaml format instead so it is easier to process the data.

Fixes: https://tracker.ceph.com/issues/66165
Signed-off-by: Guillaume Abrioux <gabrioux@ibm.com>
src/cephadm/cephadm.py
src/cephadm/cephadmlib/data_utils.py