From f75ceead7a79bbd54c3aea48680e6104a6f67666 Mon Sep 17 00:00:00 2001 From: Georges-Etienne Legendre Date: Thu, 13 May 2021 10:14:16 -0400 Subject: [PATCH] Fix exec not working for another region (#10539) This conditionally includes a region query parameter when opening the exec socket. --- ui/app/services/sockets.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/app/services/sockets.js b/ui/app/services/sockets.js index 29a38b0c7..c6bebc6be 100644 --- a/ui/app/services/sockets.js +++ b/ui/app/services/sockets.js @@ -1,8 +1,11 @@ import Service from '@ember/service'; import config from 'nomad-ui/config/environment'; import { getOwner } from '@ember/application'; +import { inject as service } from '@ember/service'; export default class SocketsService extends Service { + @service system; + getTaskStateSocket(taskState, command) { const mirageEnabled = config.environment !== 'production' && @@ -27,10 +30,12 @@ export default class SocketsService extends Service { const applicationAdapter = getOwner(this).lookup('adapter:application'); const prefix = `${applicationAdapter.host || window.location.host}/${applicationAdapter.urlPrefix()}`; + const region = this.system.activeRegion; return new WebSocket( `${protocol}//${prefix}/client/allocation/${taskState.allocation.id}` + `/exec?task=${taskState.name}&tty=true&ws_handshake=true` + + (region ? `®ion=${region}` : '') + `&command=${encodeURIComponent(`["${command}"]`)}` ); }