Build NodeProxyManager from cephadm bootstrap config. Creates temporary CA file and loads node-proxy YAML config.
(cephadm_config: CephadmConfig)
| 8 | |
| 9 | |
| 10 | def create_node_proxy_manager(cephadm_config: CephadmConfig) -> "NodeProxyManager": |
| 11 | """ |
| 12 | Build NodeProxyManager from cephadm bootstrap config. |
| 13 | Creates temporary CA file and loads node-proxy YAML config. |
| 14 | """ |
| 15 | from ceph_node_proxy.main import NodeProxyManager |
| 16 | |
| 17 | ca_file = write_tmp_file( |
| 18 | cephadm_config.root_cert_pem, |
| 19 | prefix_name="cephadm-endpoint-root-cert-", |
| 20 | ) |
| 21 | config = get_node_proxy_config( |
| 22 | path=cephadm_config.node_proxy_config_path, |
| 23 | defaults=DEFAULTS, |
| 24 | ) |
| 25 | |
| 26 | manager = NodeProxyManager( |
| 27 | mgr_host=cephadm_config.target_ip, |
| 28 | cephx_name=cephadm_config.name, |
| 29 | cephx_secret=cephadm_config.keyring, |
| 30 | mgr_agent_port=cephadm_config.target_port, |
| 31 | ca_path=ca_file.name, |
| 32 | api_ssl_crt=cephadm_config.listener_crt, |
| 33 | api_ssl_key=cephadm_config.listener_key, |
| 34 | config_path=cephadm_config.node_proxy_config_path, |
| 35 | config=config, |
| 36 | ) |
| 37 | # Keep temp file alive for the lifetime of the manager |
| 38 | manager._ca_temp_file = ca_file |
| 39 | return manager |
no test coverage detected