| 8920 | } |
| 8921 | |
| 8922 | static void install_tiered_agent_profiles(cbm_tiered_profile_set_t profiles, bool dry_run) { |
| 8923 | cbm_graph_access_t access = cbm_tiered_profile_set_access(profiles); |
| 8924 | for (int value = 0; value < (int)CBM_GRAPH_TIER_COUNT; value++) { |
| 8925 | cbm_graph_tier_t tier = (cbm_graph_tier_t)value; |
| 8926 | char path[CLI_BUF_1K]; |
| 8927 | if (cbm_tiered_profile_path(profiles.verify_path, tier, path, sizeof(path)) != CLI_OK) { |
| 8928 | record_agent_config_error(false, profiles.label, "agent_path", profiles.verify_path); |
| 8929 | continue; |
| 8930 | } |
| 8931 | if (g_install_plan) { |
| 8932 | plan_record(profiles.label, "agent", path); |
| 8933 | continue; |
| 8934 | } |
| 8935 | if (dry_run) { |
| 8936 | printf(" agent: %s\n", path); |
| 8937 | continue; |
| 8938 | } |
| 8939 | char *current = |
| 8940 | cbm_render_graph_profile(profiles.dialect, tier, access, profiles.binary_path); |
| 8941 | if (!current) { |
| 8942 | record_agent_config_error(false, profiles.label, "agent_render", path); |
| 8943 | continue; |
| 8944 | } |
| 8945 | tiered_released_profiles_t released; |
| 8946 | tiered_released_profiles_collect(profiles, tier, access, &released); |
| 8947 | int result = |
| 8948 | prepare_config_parent(path) |
| 8949 | ? cbm_text_migrate_owned_document(path, current, released.content, released.count) |
| 8950 | : CLI_ERR; |
| 8951 | tiered_released_profiles_free(&released); |
| 8952 | free(current); |
| 8953 | if (result != CLI_OK) { |
| 8954 | if (result > CLI_OK) { |
| 8955 | printf(" agent: preserved modified profile %s\n", path); |
| 8956 | } |
| 8957 | record_agent_config_error(false, profiles.label, "agent_install", path); |
| 8958 | continue; |
| 8959 | } |
| 8960 | printf(" agent: %s\n", path); |
| 8961 | } |
| 8962 | } |
| 8963 | |
| 8964 | static void uninstall_tiered_agent_profiles(cbm_tiered_profile_set_t profiles, bool dry_run) { |
| 8965 | cbm_graph_access_t access = cbm_tiered_profile_set_access(profiles); |
no test coverage detected