Skip to content
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

use MLZ_LOCATION instead of reserved term Location #139

Merged
merged 2 commits into from
Mar 31, 2021
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
2 changes: 1 addition & 1 deletion src/core/globals.front.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
{
"varname": "mlz_location",
"type": "text",
"default_val": "env:LOCATION",
"default_val": "env:MLZ_LOCATION",
"description": "The location that you're deploying to.",
"options": []
}
Expand Down
20 changes: 10 additions & 10 deletions src/front/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ async def home(request: Request):
})
$('#promptModal').modal('show')
}

var interval = null
function retrieve_results() {
function retrieve_results() {
$.ajax({
type: "GET",
url: "/poll",
Expand All @@ -157,23 +157,23 @@ async def home(request: Request):
}
});
}

function submitForm(){
interval = setInterval(retrieve_results, 2000);
}

$(document).ready(function(){
$('#showTenant').click(function(){
promptTenant()
})

logged_in = readCookie("user")

if(!logged_in || $.trim(logged_in) == ""){
promptLogin()
}
})

$(document).on('submit', '#terraform_config', function(e) {
$('#promptModal').on('show.bs.modal', function (event) {
var modal = $(this)
Expand Down Expand Up @@ -327,7 +327,7 @@ async def process_input(request: Request):
f.writelines("tf_environment=\"" + os.getenv("TF_ENV") + "\"\n" +
"mlz_env_name=\"" + os.getenv("MLZ_ENV") + "\"\n" +
"mlz_config_subid=\"" + os.getenv("SUBSCRIPTION_ID") + "\"\n" +
"mlz_config_location=\"" + os.getenv("LOCATION") + "\"\n" +
"mlz_config_location=\"" + os.getenv("MLZ_LOCATION") + "\"\n" +
"mlz_tenantid=\"" + os.getenv("TENANT_ID") + "\"\n" +
"mlz_tier0_subid=\"" + form_values["tier0_subid"] + "\"\n" +
"mlz_tier1_subid=\"" + form_values["tier1_subid"] + "\"\n" +
Expand All @@ -348,8 +348,8 @@ async def process_input(request: Request):
tier2 = os.path.join(os.getcwd(), "config_output", "tier-2.tfvars.json")

if keyVaultName:
sp_id = secret_client.get_secret("login-app-clientid").value
sp_pwd = secret_client.get_secret("login-app-clientid").value
sp_id = secret_client.get_secret("serviceprincipal-clientid").value
sp_pwd = secret_client.get_secret("serviceprincipal-pwd").value
else:
sp_id = os.getenv("MLZCLIENTID", "NotSet")
sp_pwd = os.getenv("MLZCLIENTSECRET", "NotSet")
Expand Down
12 changes: 6 additions & 6 deletions src/scripts/setup_ezdeploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# shellcheck disable=SC1090,SC1091
# shellcheck disable=SC1090,SC1091,2154
# SC1090: Can't follow non-constant source. Use a directive to specify location.
# SC1091: Not following. Shellcheck can't follow non-constant source.
# SC2154: "var is referenced but not assigned". These values come from an external file.
Expand Down Expand Up @@ -38,7 +38,7 @@ while getopts "d:s:t:l:e:m:p:0:1:2:3:4:" opts; do
s) export mlz_config_subid=${OPTARG}
subs+=("${OPTARG}")
;;
t) export mlz_tenantid=${OPTARG}
t) export mlz_tenantid=${OPTARG}
;;
l) export mlz_config_location=${OPTARG}
;;
Expand Down Expand Up @@ -95,7 +95,7 @@ if [[ $docker_strategy != "local" ]]; then
az acr create \
--resource-group "${mlz_rg_name}" \
--name "${mlz_acr_name}" \
--sku Basic
--sku Basic

echo "Waiting for registry completion and running post process to enable admin on ACR"
sleep 60
Expand All @@ -109,7 +109,7 @@ if [[ $docker_strategy != "local" ]]; then
az acr login --name "${mlz_acr_name}"

ACR_REGISTRY_ID=$(az acr show --name "${mlz_acr_name}" --query id --output tsv)
az role assignment create --assignee "$(az keyvault secret show --name "${mlz_sp_kv_name}" --vault-name "${mlz_kv_name}" --query value --output tsv)" --scope $ACR_REGISTRY_ID --role acrpull
az role assignment create --assignee "$(az keyvault secret show --name "${mlz_sp_kv_name}" --vault-name "${mlz_kv_name}" --query value --output tsv)" --scope "${ACR_REGISTRY_ID}" --role acrpull

echo "INFO: pushing docker container"
docker tag lzfront:latest "${mlz_acr_name}".azurecr.io/lzfront:latest
Expand All @@ -122,7 +122,7 @@ if [[ $docker_strategy != "local" ]]; then
--name "${mlz_instance_name}" \
--image "$ACR_LOGIN_SERVER"/lzfront:latest \
--dns-name-label "${mlz_dns_name}" \
--environment-variables KEYVAULT_ID="${mlz_kv_name}" TENANT_ID="${mlz_tenantid}" LOCATION="${mlz_config_location}" SUBSCRIPTION_ID="${mlz_config_subid}" TF_ENV="${tf_environment}" MLZ_ENV="${mlz_env_name}" \
--environment-variables KEYVAULT_ID="${mlz_kv_name}" TENANT_ID="${mlz_tenantid}" MLZ_LOCATION="${mlz_config_location}" SUBSCRIPTION_ID="${mlz_config_subid}" TF_ENV="${tf_environment}" MLZ_ENV="${mlz_env_name}" \
--registry-username "$(az keyvault secret show --name "${mlz_sp_kv_name}" --vault-name "${mlz_kv_name}" --query value --output tsv)" \
--registry-password "$(az keyvault secret show --name "${mlz_sp_kv_password}" --vault-name "${mlz_kv_name}" --query value --output tsv)" \
--ports 80 \
Expand Down Expand Up @@ -177,6 +177,7 @@ az keyvault secret set \

echo "KeyVault updated with Login App Registration secret!"
echo "All steps have been completed you will need the following to access the configuration utility:"

if [[ $docker_strategy == "local" ]]; then
echo "Your environment variables for local execution are:"
echo "Copy-Paste:"
Expand All @@ -200,7 +201,6 @@ if [[ $docker_strategy == "local" ]]; then
echo "\$env:MLZ_ENV='$mlz_env_name'"
echo "\$env:MLZCLIENTID='$(az keyvault secret show --name "${mlz_sp_kv_name}" --vault-name "${mlz_kv_name}" --query value --output tsv)'"
echo "\$env:MLZCLIENTSECRET='$(az keyvault secret show --name "${mlz_sp_kv_password}" --vault-name "${mlz_kv_name}" --query value --output tsv)'"

else
echo "You can access the front end at http://$fqdn"
fi