Skip to content

Commit

Permalink
Correct role and image variables in calling scripts, switch to system…
Browse files Browse the repository at this point in the history
…ctl reboot

Use systemd to schedule the reboot, rather than shutdown command.
  • Loading branch information
s-fairchild committed Jun 7, 2024
1 parent 1f164ab commit 1e577bb
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pkg/deploy/assets/env-development.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/deploy/assets/gateway-production.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/deploy/assets/rp-production.json

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions pkg/deploy/generator/scripts/commonVMSS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ verify_role() {

# get_short_role
# args:
# 1) r - nameref, string; role to get short role for
# 1) rl - nameref, string; role to get short role for
# 2) kv_suffix - nameref, string; short role will be assigned to this nameref
# 3) sec_prefix - nameref, string; keyvault certificate prefix will be assigned to this nameref
get_keyvault_suffix() {
Expand Down Expand Up @@ -125,8 +125,8 @@ get_keyvault_suffix() {

# configure_selinux
# args:
# relabel - boolean, optional; defaults to false
# Relabel filesystem context
# 1) relabel - boolean, optional; defaults to false
# Relabel filesystem context
configure_selinux() {
local -r relabel="${1:-false}"
log "starting"
Expand Down Expand Up @@ -385,7 +385,7 @@ enable_services() {
log "enabling services ${services[*]}"
# shellcheck disable=SC2068
for service in ${services[@]}; do
log "Enabling $service now"
log "Enabling and starting $service now"
systemctl enable --now "$service"
done
}
Expand All @@ -397,7 +397,9 @@ reboot_vm() {
configure_selinux "true"

hour="$(date -d "1 hour" +%H:%M)"
shutdown -r "$hour" "Post deployment reboot is happening now"
systemctl reboot \
--message="Bootstrapping complete, reboot scheduled at $hour" \
--when="$hour"
}

# configure_rpm_repos
Expand Down Expand Up @@ -881,7 +883,7 @@ create_required_dirs() {
# 1) log_dir - nameref, string; directory to mount for logging directory of container
# 2) image - nameref, string; container image
# 3) role - nameref, string; VMSS role
# 4) conf_fole - nameref, string; aro gateway environment file
# 4) conf_file - nameref, string; aro gateway environment file
configure_service_aro_gateway() {
local -n log_dir="$1"
local -n image="$2"
Expand Down Expand Up @@ -945,7 +947,7 @@ WantedBy=multi-user.target
# args:
# 1) image - nameref, string; RP container image
# 2) role - nameref, string; VMSS role
# 3) conf_fole - nameref, string; aro rp environment file
# 3) conf_file - nameref, string; aro rp environment file
configure_service_aro_rp() {
local -n image="$1"
local -n role="$2"
Expand Down
4 changes: 2 additions & 2 deletions pkg/deploy/generator/scripts/gatewayVMSS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ DATABASE_ACCOUNT_NAME='$DATABASEACCOUNTNAME'
AZURE_DBTOKEN_CLIENT_ID='$DBTOKENCLIENTID'
DBTOKEN_URL='$DBTOKENURL'
MDM_ACCOUNT='$RPMDMACCOUNT'
MDM_NAMESPACE='${role^}'
MDM_NAMESPACE='${role_gateway^}'
GATEWAY_DOMAINS='$GATEWAYDOMAINS'
GATEWAY_FEATURES='$GATEWAYFEATURES'
RPIMAGE='$image'"
RPIMAGE='$rpimage'"

local -r mdsd_config_version="$GATEWAYMDSDCONFIGVERSION"
# values are references to variables, they should not be dereferenced here
Expand Down
4 changes: 2 additions & 2 deletions pkg/deploy/generator/scripts/rpVMSS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ GATEWAY_DOMAINS='$GATEWAYDOMAINS'
GATEWAY_RESOURCEGROUP='$GATEWAYRESOURCEGROUPNAME'
KEYVAULT_PREFIX='$KEYVAULTPREFIX'
MDM_ACCOUNT='$RPMDMACCOUNT'
MDM_NAMESPACE='${role^^}'
MDM_NAMESPACE='${role_rp^^}'
MDSD_ENVIRONMENT='$MDSDENVIRONMENT'
RP_FEATURES='$RPFEATURES'
RPIMAGE='$image'
RPIMAGE='$rpimage'
ARO_INSTALL_VIA_HIVE='$CLUSTERSINSTALLVIAHIVE'
ARO_HIVE_DEFAULT_INSTALLER_PULLSPEC='$CLUSTERDEFAULTINSTALLERPULLSPEC'
ARO_ADOPT_BY_HIVE='$CLUSTERSADOPTBYHIVE'
Expand Down

0 comments on commit 1e577bb

Please sign in to comment.