Skip to content

Commit 0736811

Browse files
authored
Merge pull request #53 from vrothberg/hackathon-subscription
improve machine error when running on Linux
2 parents d5e55da + 12692fd commit 0736811

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/extension.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import path from 'node:path';
2727
import { accessSync, constants, existsSync, readFileSync } from 'node:fs';
2828
import { restartPodmanMachine, runRpmInstallSubscriptionManager, runSubscriptionManager, runSubscriptionManagerActivationStatus, runSubscriptionManagerRegister } from './podman-cli';
2929
import { SubscriptionManagerClient } from '@redhat-developer/rhsm-client';
30+
import { isLinux } from './util';
3031

3132
let loginService: RedHatAuthenticationService;
3233
let currentSession: extensionApi.AuthenticationSession | undefined;
@@ -156,7 +157,7 @@ async function createOrReuseActivationKey() {
156157

157158
function isPodmanMachineRunning(): boolean {
158159
const conns = extensionApi.provider.getContainerConnections();
159-
const startedPodman = conns.filter(conn => conn.providerId === 'podman' && conn.connection.status() === 'started');
160+
const startedPodman = conns.filter(conn => conn.providerId === 'podman' && conn.connection.status() === 'started' && !conn.connection.endpoint.socketPath.startsWith("/run/user/"));
160161
return startedPodman.length === 1;
161162
}
162163

@@ -255,7 +256,11 @@ export async function activate(extensionContext: extensionApi.ExtensionContext):
255256
location: extensionApi.ProgressLocation.TASK_WIDGET, title: 'Activating Red Hat Subscription'
256257
}, async (progress) => {
257258
if (!isPodmanMachineRunning()) {
258-
await extensionApi.window.showInformationMessage('Podman machine is not running. Please start it and try again.');
259+
if (isLinux()) {
260+
await extensionApi.window.showInformationMessage('Signing into a Red Hat account requires a running Podman machine, and is currently not supported on a Linux host. Please start a Podman machine and try again.');
261+
} else {
262+
await extensionApi.window.showInformationMessage('Signing into a Red Hat account requires a running Podman machine. Please start one and try again.');
263+
}
259264
return;
260265
} else {
261266
if (!(await isSubscriptionManagerInstalled())) {

0 commit comments

Comments
 (0)