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

fix hostnetwork in update #9132

Merged
merged 1 commit into from
Oct 30, 2023
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
13 changes: 10 additions & 3 deletions Solutions/SAP/sapcon-instance-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ while [[ $# -gt 0 ]]; do
DEVURL="$2"
shift 2
;;
--hostnetwork)
HOSTNETWORK=1
shift 1
;;
--dev-acr-login)
DEVACRLOGIN="$2"
shift 2
Expand Down Expand Up @@ -203,6 +207,7 @@ while IFS= read -r contname; do
fi
read -r -a containervariables <<<$(docker inspect "$contname" --format '{{.Config.Env}}' | tr -d '[' | tr -d ']' | tr ' ' ' ')
envstring=""
cmdparams=""
for variable in "${containervariables[@]}"; do
if [[ ! $variable == PATH=* ]] &&
[[ ! $variable == LANG=* ]] &&
Expand Down Expand Up @@ -265,12 +270,14 @@ while IFS= read -r contname; do
docker cp "$contname":$sdkfileloc "/tmp/sapcon-update/$contname/inst/"
fi
sdkfilename=$(ls -1r /tmp/sapcon-update/$contname/inst/nwrfc*.zip | head -n 1)

if [ $HOSTNETWORK ]; then
cmdparams+=" --network host "
fi
if [ ! $NOTESTRUN ]; then
# If test run is required
testruncontainer="$contname-testrun"
log "Creating agent $contname in test mode"
docker create -v "$sysfileloc:/sapcon-app/sapcon/config/system" $envstring $ContainerNetworkSetting --name "$testruncontainer" $dockerimage$tagver --sapconinstanceupdate >/dev/null
docker create -v "$sysfileloc:/sapcon-app/sapcon/config/system" $cmdparams $envstring $ContainerNetworkSetting --name "$testruncontainer" $dockerimage$tagver --sapconinstanceupdate >/dev/null
docker cp "$sdkfilename" "$testruncontainer":$sdkfileloc
docker start "$testruncontainer" >/dev/null

Expand Down Expand Up @@ -344,7 +351,7 @@ while IFS= read -r contname; do
if [ $dryrunsuccess == 1 ]; then
log "Creating updated agent $contname"
labelstring="--label Cloud=$CLOUD "
docker create -v "$sysfileloc:/sapcon-app/sapcon/config/system" $envstring $labelstring $restartpolicystring $ContainerNetworkSetting --name "$contname" $dockerimage$tagver >/dev/null
docker create -v "$sysfileloc:/sapcon-app/sapcon/config/system" $cmdparams $envstring $labelstring $restartpolicystring $ContainerNetworkSetting --name "$contname" $dockerimage$tagver >/dev/null
docker cp "$sdkfilename" "$contname":"$sdkfileloc"
fi
#Cleaning sapcon-update folder
Expand Down
4 changes: 2 additions & 2 deletions Solutions/SAP/sapcon-sentinel-kickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ while [[ $# -gt 0 ]]; do
SID="$2"
shift 2
;;
--hostnetwork)
--hostnetwork)
HOSTNETWORK=1
shift 1
;;
Expand Down Expand Up @@ -793,7 +793,7 @@ cmdparams=" --label Cloud=$CLOUD"
cmdparams+=" -e SENTINEL_AGENT_GUID=$(uuidgen) "

if [ $HOSTNETWORK ]; then
cmdparams+=" --network host"
cmdparams+=" --network host "
fi

if [ "$MODE" == "kvmi" ]; then
Expand Down
2 changes: 1 addition & 1 deletion Solutions/SAP/sapcon-sentinel-ui-agent-kickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ elif [ "$MODE" == "kvsi" ]; then
cmdparams+=" -e AZURE_CLIENT_ID=$APPID -e AZURE_CLIENT_SECRET=$APPSECRET -e AZURE_TENANT_ID=$TENANT"
fi
if [ $HOSTNETWORK ]; then
cmdparams+=" --network host"
cmdparams+=" --network host "
fi
sudo docker create -v "$sysfileloc":/sapcon-app/sapcon/config/system $cmdparams --name "$containername" $dockerimage$tagver >/dev/null

Expand Down