Hadron / Hadron/carthage

dump_assignments is a little tricky

Open
#42 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
11
Forks
8
Avg merge
9h 26m
Merged PRs (30d)
6

Description

Assume my goal is to understand the persistent assignments that are being used by Carthage.

I can find `/root/.carthage/state/persistent_assignments/*.mdb`

I can install lmdb-utils and run `mdb_dump -p /root/.carthage/state/persistent_assignments` and get a dump that's not ideal but at least usable

If someone gives me a hint, and I figure out that I need to add `add_provider(carthage.kvstore.persistent_seed_path, 'seed.yml')` , I can use the `dump_assignments` command to get a yaml dump of the assignments, I think. It writes it to the file and then I have to read the file, which is a bit awkward but OK. But the file has a lot fewer K/V pairs than there are in the mdb file, which makes me suspicious.

```
root@radiosim-vm:~/radio-simulation-engine# mdb_dump -p /root/.carthage/state/persistent_assignments
VERSION=3
format=print
type=btree
mapsize=4294967296
maxreaders=126
db_pagesize=4096
HEADER=END
container_net/v4_pool/assignments:10.20.0.48
radiosim_pod|eth0
container_net/v4_pool/assignments:10.20.0.49
webserver.jeff-sandbox.photon.ac|eth0
container_net/v4_pool/assignments:10.20.0.84
keycloak-pod|eth0
container_net/v4_pool/assignments:10.20.0.96
photon.jeff-sandbox.photon.ac|eth0
container_net/v4_pool/assignments:keycloak-pod|eth0
10.20.0.84
container_net/v4_pool/assignments:photon.jeff-sandbox.photon.ac|eth0
10.20.0.96
container_net/v4_pool/assignments:radiosim_pod|eth0
10.20.0.48
container_net/v4_pool/assignments:webserver.jeff-sandbox.photon.ac|eth0
10.20.0.49
container_net/v4_pool/hints:keycloak-pod|eth0
10.20.0.84
container_net/v4_pool/hints:photon.jeff-sandbox.photon.ac|eth0
10.20.0.96
container_net/v4_pool/hints:radiosim_pod|eth0
10.20.0.48
container_net/v4_pool/hints:webserver.jeff-sandbox.photon.ac|eth0
10.20.0.49
dump:container_net/v4_pool/hints
true
DATA=END
```
```root@radiosim-vm:~/radio-simulation-engine# PYTHONPATH=/carthage /carthage/bin/carthage-runner --config config.yml --keep --start --tasks-verbose --command-verbose dump_assignments
Task Handle Certificates last run for at 2023-05-23T16:57:22.923692
Task make download last run for at 2023-05-23T16:57:26.959704
Task Render config.yml.mako template last run for at 2023-05-23T16:57:26.987705
```
```
root@radiosim-vm:~/radio-simulation-engine# ls
README.md ansible carthage_plugin.yml config.yml container.log design engine radiosim resources sample-carthage-config.yml seed.yml
root@radiosim-vm:~/radio-simulation-engine# cat seed.yml
container_net/v4_pool/hints:
radiosim_pod|eth0: 10.20.0.48
webserver.jeff-sandbox.photon.ac|eth0: 10.20.0.49
```

I suspect that I want !dump_assignments to be able to dump to stdout even if I don't define persistent_seed_path. I might also want to be able to set it in config.yml?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.