Skip to content

Commit 44c9466

Browse files
committed
fix: rename getRunningPodmanMachineName
Signed-off-by: Denis Golovin <[email protected]>
1 parent d4ecf97 commit 44c9466

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/extension.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ suite('signin command telemetry reports', () => {
117117
},
118118
);
119119
vi.spyOn(subscription, 'isRedHatRegistryConfigured').mockResolvedValue(true);
120-
vi.spyOn(podmanCli, 'getRunningPodmanMachineName').mockReturnValue(undefined);
120+
vi.spyOn(podmanCli, 'getConnectionForRunningPodmanMachine').mockReturnValue(undefined);
121121
await extension.activate(createExtContext());
122122
expect(commandFunctionCopy!).toBeDefined();
123123
await commandFunctionCopy!();
@@ -180,7 +180,7 @@ suite('signin command telemetry reports', () => {
180180
},
181181
);
182182
vi.spyOn(subscription, 'isRedHatRegistryConfigured').mockReturnValue(true);
183-
vi.spyOn(podmanCli, 'getRunningPodmanMachineName').mockReturnValue('machine1');
183+
vi.spyOn(podmanCli, 'getConnectionForRunningPodmanMachine').mockReturnValue('machine1');
184184
vi.spyOn(OrganizationService.prototype, 'checkOrgScaCapability').mockResolvedValue({ body: {} });
185185
await extension.activate(createExtContext());
186186
expect(commandFunctionCopy!).toBeDefined();

src/extension.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { SubscriptionManagerClient } from '@redhat-developer/rhsm-client';
2727
import { onDidChangeSessions, RedHatAuthenticationService } from './authentication-service';
2828
import { getAuthConfig } from './configuration';
2929
import {
30-
getRunningPodmanMachineName,
30+
getConnectionForRunningPodmanMachine,
3131
runCreateFactsFile,
3232
runRpmInstallSubscriptionManager,
3333
runStartPodmanMachine,
@@ -191,7 +191,7 @@ async function isPodmanVmSubscriptionActivated(connection: extensionApi.Provider
191191
}
192192

193193
async function removeSession(sessionId: string): Promise<void> {
194-
const connection = getRunningPodmanMachineName();
194+
const connection = getConnectionForRunningPodmanMachine();
195195
if (connection) {
196196
runSubscriptionManagerUnregister(connection).catch(console.error); // ignore error in case vm subscription activation failed on login
197197
}
@@ -255,7 +255,7 @@ async function configureRegistryAndActivateSubscription(): Promise<void> {
255255
title: 'Activating Red Hat Subscription',
256256
},
257257
async () => {
258-
const runningConnection = getRunningPodmanMachineName();
258+
const runningConnection = getConnectionForRunningPodmanMachine();
259259
if (!runningConnection) {
260260
if (isLinux()) {
261261
await extensionApi.window.showInformationMessage(

src/podman-cli.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,13 @@ export async function runStartPodmanMachine(
199199
);
200200
}
201201

202-
export function getRunningPodmanMachineName(): podmanDesktopAPI.ProviderContainerConnection | undefined {
202+
export function getConnectionForRunningPodmanMachine(): podmanDesktopAPI.ProviderContainerConnection | undefined {
203203
const conns = podmanDesktopAPI.provider.getContainerConnections();
204-
const startedVms = conns.filter(
204+
const connToRunningVms = conns.filter(
205205
conn =>
206206
conn.providerId === 'podman' &&
207207
conn.connection.status() === 'started' &&
208208
!conn.connection.endpoint.socketPath.startsWith('/run/user/'),
209209
);
210-
return startedVms.length >= 1 ? startedVms[0] : undefined;
210+
return connToRunningVms.length >= 1 ? connToRunningVms[0] : undefined;
211211
}

0 commit comments

Comments
 (0)