Skip to content

Adjust nova API rest URL for custom https port #2988

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
30 changes: 23 additions & 7 deletions cfe_internal/enterprise/CFE_hub_specific.cf
Original file line number Diff line number Diff line change
Expand Up @@ -112,32 +112,48 @@ bundle agent update_cli_rest_server_url_config
# 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";
"regex_test_pattern" string => ".*localhost:$(cfe_internal_hub_vars.https_port).*";
"api_config_file" string => "$(cfe_internal_hub_vars.docroot)/api/modules/inventory/config/config.php";
"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_disable_mission_portal_docroot_sync_from_share_gui::
"$(mp_share_config_file)"
edit_line => change_cli_rest_server_url_port,
edit_line => change_mp_server_url_port,
if => and(
fileexists("$(mp_share_config_file)"),
islessthan(countlinesmatching("$(regex_test_pattern)", "$(mp_share_config_file)"), 1)
islessthan(countlinesmatching("$(mp_test_pattern)", "$(mp_share_config_file)"), 1)
);

any::
"$(mp_config_file)"
edit_line => change_cli_rest_server_url_port,
edit_line => change_mp_server_url_port,
if => and(
fileexists("$(mp_config_file)"),
islessthan(countlinesmatching("$(regex_test_pattern)", "$(mp_config_file)"), 1)
islessthan(countlinesmatching("$(mp_test_pattern)", "$(mp_config_file)"), 1)
);

"$(api_config_file)"
edit_line => change_api_server_url_port,
if => and(
fileexists("$(api_config_file)"),
islessthan(countlinesmatching("$(api_test_pattern)", "$(api_config_file)"), 1)
);
}

bundle edit_line change_cli_rest_server_url_port
bundle edit_line change_mp_server_url_port
{
replace_patterns:
"^\s*\$config\['cli_rest_server_url'\]\s*=\s*\"https://localhost(?::(?!$(cfe_internal_hub_vars.https_port))\d{1,5})?/api/\";\s*$"
replace_with => value(" $config['cli_rest_server_url'] = \"https://localhost:$(cfe_internal_hub_vars.https_port)/api/\";"),
comment => "Change port CLI REST server URL port";
comment => "Change port MP REST 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/\");"),
comment => "Change port API REST server URL port";
}

##################################################################
Expand Down
10 changes: 5 additions & 5 deletions cfe_internal/enterprise/CFE_knowledge.cf
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ bundle agent cfe_internal_setup_knowledge
copy_from => no_backup_cp_compare("$(sys.workdir)/share/GUI", "binary"),
depth_search => recurse("inf");

"$(cfe_internal_hub_vars.docroot)/.htaccess"
comment => "Correct up htaccess file in doc root",
handle => "cfe_internal_setup_knowledge_files_doc_root_htaccess",
copy_from => no_backup_cp("$(sys.workdir)/share/GUI/Apache-htaccess");

any::

"$(install_logs)" -> { "ENT-4506" }
Expand Down Expand Up @@ -126,11 +131,6 @@ bundle agent cfe_internal_setup_knowledge
handle => "cfe_internal_setup_knowledge_dir_httpd",
perms => mog("755", "root", "root");

"$(cfe_internal_hub_vars.docroot)/.htaccess"
comment => "Correct up htaccess file in doc root",
handle => "cfe_internal_setup_knowledge_files_doc_root_htaccess",
copy_from => no_backup_cp("$(sys.workdir)/share/GUI/Apache-htaccess");

"$(cfe_internal_hub_vars.public_docroot)/scripts/." -> { "CFE-951" }
comment => "Ensure permissions for $(cfe_internal_hub_vars.public_docroot)/scripts",
handle => "cfe_internal_setup_knowledge_files_doc_root_scripts_dir",
Expand Down