]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
cephadm: _extract_host_info_from_*() refactor 58098/head
authorGuillaume Abrioux <gabrioux@ibm.com>
Tue, 21 May 2024 09:08:29 +0000 (05:08 -0400)
committerAdam King <adking@redhat.com>
Mon, 17 Jun 2024 17:54:53 +0000 (13:54 -0400)
commitc26ef5ac11ef5192b8399c0131f3c225422d620e
tree4ca144d89866a49b55366ccc03c3b643bd7a149b
parentf18f3f1cbd11e4a41c557e616d172f24deb91473
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>
(cherry picked from commit f4ddb2750eb04d7563356a41c7433a3c5d6ded57)
src/cephadm/cephadm.py
src/cephadm/cephadmlib/data_utils.py