Skip to content

Commit

Permalink
Merge pull request #53 from vrothberg/hackathon-subscription
Browse files Browse the repository at this point in the history
improve machine error when running on Linux
  • Loading branch information
vrothberg authored Feb 26, 2024
2 parents d5e55da + 12692fd commit 0736811
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import path from 'node:path';
import { accessSync, constants, existsSync, readFileSync } from 'node:fs';
import { restartPodmanMachine, runRpmInstallSubscriptionManager, runSubscriptionManager, runSubscriptionManagerActivationStatus, runSubscriptionManagerRegister } from './podman-cli';
import { SubscriptionManagerClient } from '@redhat-developer/rhsm-client';
import { isLinux } from './util';

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

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

Expand Down Expand Up @@ -255,7 +256,11 @@ export async function activate(extensionContext: extensionApi.ExtensionContext):
location: extensionApi.ProgressLocation.TASK_WIDGET, title: 'Activating Red Hat Subscription'
}, async (progress) => {
if (!isPodmanMachineRunning()) {
await extensionApi.window.showInformationMessage('Podman machine is not running. Please start it and try again.');
if (isLinux()) {
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.');
} else {
await extensionApi.window.showInformationMessage('Signing into a Red Hat account requires a running Podman machine. Please start one and try again.');
}
return;
} else {
if (!(await isSubscriptionManagerInstalled())) {
Expand Down

0 comments on commit 0736811

Please sign in to comment.