Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 33 additions & 16 deletions cfe_internal/enterprise/CFE_hub_specific.cf
Original file line number Diff line number Diff line change
Expand Up @@ -113,36 +113,53 @@ bundle agent update_cli_rest_server_url_config
{
vars:
# Both share and live versions must be changed at once since httpd will be restarted later in the same agent run.
"mp_config_file" string => "$(cfe_internal_hub_vars.docroot)/application/config/config.php";
"mp_share_config_file" string => "$(sys.workdir)/share/GUI/application/config/config.php";
"api_config_file" string => "$(cfe_internal_hub_vars.docroot)/api/modules/inventory/config/config.php";
"mp_config_files" slist => {
"application/config/config.php"
};
"api_config_files" slist => {
"api/config/config.php",
"api/modules/inventory/config/config.php"
};

"share" string => "$(sys.workdir)/share/GUI";
"docroot" string => "$(cfe_internal_hub_vars.docroot)";

"mp_test_pattern" string => ".*localhost:$(cfe_internal_hub_vars.https_port).*";
"api_test_pattern" string => ".*127\.0\.0\.1:$(cfe_internal_hub_vars.https_port).*";

files:
mpf_enable_mission_portal_docroot_sync_from_share_gui::
"$(mp_share_config_file)"
handle => "cfe_internal_edit_share_gui_mp_config",
"$(share)/$(mp_config_files)"
handle => canonify(concat("cfe_internal_edit_share_", "$(mp_config_files)")),
edit_line => change_mp_server_url_port,
if => and(
fileexists("$(mp_share_config_file)"),
islessthan(countlinesmatching("$(mp_test_pattern)", "$(mp_share_config_file)"), 1)
fileexists("$(share)/$(mp_config_files)"),
islessthan(countlinesmatching("$(mp_test_pattern)", "$(share)/$(mp_config_files)"), 1)
);

"$(share)/$(api_config_files)"
handle => canonify(concat("cfe_internal_edit_share_", "$(api_config_files)")),
edit_line => change_api_server_url_port,
if => and(
fileexists("$(share)/$(api_config_files)"),
islessthan(countlinesmatching("$(api_test_pattern)", "$(share)/$(api_config_files)"), 1)
);

any::
"$(mp_config_file)"
handle => "cfe_internal_edit_mp_config",
"$(docroot)/$(mp_config_files)"
handle => canonify(concat("cfe_internal_edit_", "$(mp_config_files)")),
edit_line => change_mp_server_url_port,
if => and(
fileexists("$(mp_config_file)"),
islessthan(countlinesmatching("$(mp_test_pattern)", "$(mp_config_file)"), 1)
fileexists("$(docroot)/$(mp_config_files)"),
islessthan(countlinesmatching("$(mp_test_pattern)", "$(docroot)/$(mp_config_files)"), 1)
);

"$(api_config_file)"
"$(docroot)/$(api_config_files)"
handle => canonify(concat("cfe_internal_edit_", "$(api_config_files)")),
edit_line => change_api_server_url_port,
if => and(
fileexists("$(api_config_file)"),
islessthan(countlinesmatching("$(api_test_pattern)", "$(api_config_file)"), 1)
fileexists("$(docroot)/$(api_config_files)"),
islessthan(countlinesmatching("$(api_test_pattern)", "$(docroot)/$(api_config_files)"), 1)
);
}

Expand All @@ -156,8 +173,8 @@ bundle edit_line change_mp_server_url_port
bundle edit_line change_api_server_url_port
{
replace_patterns:
"^\s*define\(\"API_URL\",\s*\"https:\/\/127\.0\.0\.1(?::(?!$(cfe_internal_hub_vars.https_port))\d{1,5})?\/api\"\);\s*$"
replace_with => value("define(\"API_URL\", \"https://127.0.0.1:$(cfe_internal_hub_vars.https_port)/api\");"),
"https:\/\/127\.0\.0\.1(?::(?!$(cfe_internal_hub_vars.https_port))\d{1,5})?\/"
replace_with => value("https://127.0.0.1:$(cfe_internal_hub_vars.https_port)/"),
comment => "Change port API REST server URL port";
}

Expand Down
4 changes: 4 additions & 0 deletions cfe_internal/enterprise/main.cf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ bundle agent cfe_internal_enterprise_main

enterprise_edition.(policy_server|am_policy_hub)::

"hub" usebundle => update_cli_rest_server_url_config,
handle => "update_cli_rest_server_url_config",
comment => "Update https port in php config files from cfe_internal_hub_vars.https_port";

"hub" usebundle => cfe_internal_update_folders,
handle => "cfe_internal_management_update_folders",
comment => "Create empty directories for CFE self-upgrade";
Expand Down