Предположим, я хочу включить/выключить репозиторий "test" через API, судя по документации здесь, это должно быть или, на самом деле, возможно: {node}/apt/repositories. Но вот загвоздка: требуемые параметры — index, node, path. Давайте посмотрим на вывод `get /nodes/$(hostname -s)/apt/repositories` на секунду:
JSON: {
"files": [
{
"path": "/etc/apt/sources.list",
"repositories": [
{...},
{
"description": "This is the recommended repository for testing and non-production use. Its packages are not as heavily tested and validated as the production ready enterp
rise repository. You don't need a subscription key to access this repository.",
"handle": "no-subscription",
"name": "No-Subscription",
"status": 1
},
{
"description": "This repository contains the latest packages and is primarily used for test labs and by developers to test new features.",
"handle": "test",
"name": "Test",
"status": 1
},
{...}
]
},
...
],
"infos": [
{"index": 0, "path": "/etc/apt/sources.list"},
{"index": 1, "path": "/etc/apt/sources.list"},
...
]
}
Проблема в том, что нет прямого соответствия между index, который обязателен, и фактическим репозиторием, который нужно включить/выключить. Лучшее, что я смог придумать, — это посчитать количество записей под files/repositories и затем использовать это значение, чтобы получить index, используя files/path и index/path как соединение. Я что-то упускаю, или это ошибка проектирования?
JSON: {
"files": [
{
"path": "/etc/apt/sources.list",
"repositories": [
{...},
{
"description": "This is the recommended repository for testing and non-production use. Its packages are not as heavily tested and validated as the production ready enterp
rise repository. You don't need a subscription key to access this repository.",
"handle": "no-subscription",
"name": "No-Subscription",
"status": 1
},
{
"description": "This repository contains the latest packages and is primarily used for test labs and by developers to test new features.",
"handle": "test",
"name": "Test",
"status": 1
},
{...}
]
},
...
],
"infos": [
{"index": 0, "path": "/etc/apt/sources.list"},
{"index": 1, "path": "/etc/apt/sources.list"},
...
]
}
Проблема в том, что нет прямого соответствия между index, который обязателен, и фактическим репозиторием, который нужно включить/выключить. Лучшее, что я смог придумать, — это посчитать количество записей под files/repositories и затем использовать это значение, чтобы получить index, используя files/path и index/path как соединение. Я что-то упускаю, или это ошибка проектирования?
