Skip to content

Commit

Permalink
Merge pull request #725 from at88mph/private-harbor-fix
Browse files Browse the repository at this point in the history
Private harbor fix
  • Loading branch information
at88mph authored Nov 8, 2024
2 parents 645b475 + b6ddf52 commit 401f512
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ get_resource_options() {
else
resources=`curl -s -L -k --header "x-auth-token-skaha: ${TOKEN}" https://(HOST)/skaha/(SKAHA_API_VERSION)/context`
fi
core_default=`echo $resources | jq .cores.default`
core_options=`echo $resources | jq .cores.options[] | tr '\n' ' '`
ram_default=`echo $resources | jq .memoryGB.default`
ram_options=`echo $resources | jq .memoryGB.options[] | tr '\n' ' '`

core_default=`echo $resources | jq .cores.default`
core_options=`echo $resources | jq .cores.options[] | tr '\n' ' '`
ram_default=`echo $resources | jq .memoryGB.default`
ram_options=`echo $resources | jq .memoryGB.options[] | tr '\n' ' '`
}

get_cores() {
Expand Down Expand Up @@ -89,7 +90,7 @@ prompt_user() {
if [ -z "${TOKEN}" ]; then
handle_error "[skaha] No credentials to call back to Skaha with."
else
app_id=`curl -s -L -k "x-auth-token-skaha: ${TOKEN}" -d "image=(IMAGE_ID)" --data-urlencode "param=(NAME)" https://(HOST)/skaha/(SKAHA_API_VERSION)/session/${VNC_PW}/app`
app_id=`curl -s -L -k --header "x-auth-token-skaha: ${TOKEN}" -d "image=(IMAGE_ID)" --data-urlencode "param=(NAME)" https://(HOST)/skaha/(SKAHA_API_VERSION)/session/${VNC_PW}/app`
fi
break
elif [[ ${yn} == "y" || ${yn} == "Y" ]]; then
Expand All @@ -101,7 +102,7 @@ prompt_user() {
if [ -z "${TOKEN}" ]; then
handle_error "[skaha] No credentials to call back to Skaha with."
else
app_id=`curl -s -L -k "x-auth-token-skaha: ${TOKEN}" -d "cores=${cores}" -d "ram=$ram" -d "image=(IMAGE_ID)" --data-urlencode "param=(NAME)" https://(HOST)/skaha/(SKAHA_API_VERSION)/session/${VNC_PW}/app`
app_id=`curl -s -L -k --header "x-auth-token-skaha: ${TOKEN}" -d "cores=${cores}" -d "ram=$ram" -d "image=(IMAGE_ID)" --data-urlencode "param=(NAME)" https://(HOST)/skaha/(SKAHA_API_VERSION)/session/${VNC_PW}/app`
fi
break
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,15 @@
package org.opencadc.skaha;

import ca.nrc.cadc.auth.AuthMethod;
import ca.nrc.cadc.net.HttpDelete;
import ca.nrc.cadc.net.HttpPost;
import ca.nrc.cadc.reg.Standards;
import ca.nrc.cadc.reg.client.RegistryClient;
import ca.nrc.cadc.util.Log4jInit;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.PrivilegedExceptionAction;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.security.auth.Subject;
Expand Down
8 changes: 4 additions & 4 deletions skaha/src/intTest/java/org/opencadc/skaha/SessionUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,16 @@ public class SessionUtil {
public static final URI SKAHA_SERVICE_ID = URI.create("ivo://cadc.nrc.ca/skaha");
private static final Logger LOGGER = Logger.getLogger(SessionUtil.class);
private static final long ONE_SECOND = 1000L;
private static final long TIMEOUT_WAIT_FOR_SESSION_STARTUP_MS = 120L * SessionUtil.ONE_SECOND;
private static final long TIMEOUT_WAIT_FOR_SESSION_TERMINATE_MS = 120L * SessionUtil.ONE_SECOND;
private static final long TIMEOUT_WAIT_FOR_SESSION_STARTUP_MS = 180L * SessionUtil.ONE_SECOND;
private static final long TIMEOUT_WAIT_FOR_SESSION_TERMINATE_MS = 180L * SessionUtil.ONE_SECOND;

static URI getSkahaServiceID() {
final String configuredServiceID = System.getenv("SKAHA_SERVICE_ID");
return StringUtil.hasText(configuredServiceID) ? URI.create(configuredServiceID) : SessionUtil.SKAHA_SERVICE_ID;
}

static void initializeCleanup(final URL sessionURL) throws Exception {
for (Session session : SessionUtil.getSessions(sessionURL, Session.STATUS_TERMINATING, Session.STATUS_SUCCEEDED)) {
for (Session session : SessionUtil.getSessions(sessionURL, Session.STATUS_TERMINATING)) {
if (session.getType().equals(SessionAction.TYPE_DESKTOP_APP)) {
// delete desktop-app
String sessionID = session.getId();
Expand All @@ -139,7 +139,7 @@ static void initializeCleanup(final URL sessionURL) throws Exception {
}

int count = 0;
for (Session s : SessionUtil.getSessions(sessionURL, Session.STATUS_TERMINATING, Session.STATUS_SUCCEEDED)) {
for (Session s : SessionUtil.getSessions(sessionURL, Session.STATUS_TERMINATING)) {
if (!s.getType().equals(SessionAction.TYPE_DESKTOP_APP)) {
count++;
}
Expand Down

0 comments on commit 401f512

Please sign in to comment.