mirror of
https://github.com/podman-desktop/podman-desktop
synced 2026-05-24 10:18:53 +00:00
fix: use other key than the socket path
before podman 4.5, socket path were different for all machines with podman 4.5, socket path is the same for all the machines so some functions were using the path as a key then it leads to lot of errors with invalid data, failure to get the right machine, duplicated things, config from other machines, etc. fixes https://github.com/containers/podman-desktop/issues/2338 Change-Id: I76e23b1cc2656e6fd61d60a265d0b93698f7196d Signed-off-by: Florent Benoit <fbenoit@redhat.com>
This commit is contained in:
parent
4b4a9897b2
commit
1aba2c167e
5 changed files with 21 additions and 9 deletions
|
|
@ -94,6 +94,7 @@ async function updateMachines(provider: extensionApi.Provider): Promise<void> {
|
|||
if (previousStatus !== status) {
|
||||
// notify status change
|
||||
listeners.forEach(listener => listener(machine.Name, status));
|
||||
podmanMachinesStatuses.set(machine.Name, status);
|
||||
}
|
||||
podmanMachinesInfo.set(machine.Name, {
|
||||
name: machine.Name,
|
||||
|
|
@ -394,7 +395,9 @@ async function registerProviderFor(provider: extensionApi.Provider, machineInfo:
|
|||
},
|
||||
};
|
||||
|
||||
monitorPodmanSocket(socketPath, machineInfo.name);
|
||||
// Since Podman 4.5, machines are using the same path for all sockets of machines
|
||||
// so a machine is not distinguishable from another one.
|
||||
// monitorPodmanSocket(socketPath, machineInfo.name);
|
||||
containerProviderConnections.set(machineInfo.name, containerProviderConnection);
|
||||
|
||||
const disposable = provider.registerContainerProviderConnection(containerProviderConnection);
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ export class ConfigurationImpl implements containerDesktopAPI.Configuration {
|
|||
|
||||
getConfigurationKey(): string {
|
||||
if (this.isContainerProviderConnection(this.scope)) {
|
||||
return `container-connection:${this.scope.endpoint.socketPath}`;
|
||||
return `container-connection:${this.scope.name}.${this.scope.endpoint.socketPath}`;
|
||||
} else if (this.isKubernetesProviderConnection(this.scope)) {
|
||||
return `kubernetes-connection:${this.scope.endpoint.apiURL}`;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -565,7 +565,8 @@ export class ContainerProviderRegistry {
|
|||
// grab all connections
|
||||
const matchingContainerProvider = Array.from(this.internalProviders.values()).find(
|
||||
containerProvider =>
|
||||
containerProvider.connection.endpoint.socketPath === providerContainerConnectionInfo.endpoint.socketPath,
|
||||
containerProvider.connection.endpoint.socketPath === providerContainerConnectionInfo.endpoint.socketPath &&
|
||||
containerProvider.connection.name === providerContainerConnectionInfo.name,
|
||||
);
|
||||
if (!matchingContainerProvider || !matchingContainerProvider.api) {
|
||||
throw new Error('No provider with a running engine');
|
||||
|
|
@ -690,7 +691,9 @@ export class ContainerProviderRegistry {
|
|||
this.telemetryService.track('createPod');
|
||||
// grab all connections
|
||||
const matchingContainerProvider = Array.from(this.internalProviders.values()).find(
|
||||
containerProvider => containerProvider.connection.endpoint.socketPath === selectedProvider.endpoint.socketPath,
|
||||
containerProvider =>
|
||||
containerProvider.connection.endpoint.socketPath === selectedProvider.endpoint.socketPath &&
|
||||
containerProvider.connection.name === selectedProvider.name,
|
||||
);
|
||||
if (!matchingContainerProvider || !matchingContainerProvider.libpodApi) {
|
||||
throw new Error('No provider with a running engine');
|
||||
|
|
@ -1000,7 +1003,9 @@ export class ContainerProviderRegistry {
|
|||
this.telemetryService.track('playKube');
|
||||
// grab all connections
|
||||
const matchingContainerProvider = Array.from(this.internalProviders.values()).find(
|
||||
containerProvider => containerProvider.connection.endpoint.socketPath === selectedProvider.endpoint.socketPath,
|
||||
containerProvider =>
|
||||
containerProvider.connection.endpoint.socketPath === selectedProvider.endpoint.socketPath &&
|
||||
containerProvider.name === selectedProvider.name,
|
||||
);
|
||||
if (!matchingContainerProvider || !matchingContainerProvider.libpodApi) {
|
||||
throw new Error('No provider with a running engine');
|
||||
|
|
@ -1020,6 +1025,7 @@ export class ContainerProviderRegistry {
|
|||
const matchingContainerProvider = Array.from(this.internalProviders.values()).find(
|
||||
containerProvider =>
|
||||
containerProvider.connection.endpoint.socketPath === selectedProvider.endpoint.socketPath &&
|
||||
containerProvider.connection.name === selectedProvider.name &&
|
||||
selectedProvider.status === 'started',
|
||||
);
|
||||
if (!matchingContainerProvider || !matchingContainerProvider.api) {
|
||||
|
|
|
|||
|
|
@ -91,7 +91,8 @@ export class ProviderImpl implements Provider, IDisposable {
|
|||
setInterval(async () => {
|
||||
this.containerProviderConnections.forEach(providerConnection => {
|
||||
const status = providerConnection.status();
|
||||
const key = providerConnection.endpoint.socketPath;
|
||||
// key can't be socket path as for some providers it can be the same
|
||||
const key = `${providerConnection.name}.${providerConnection.endpoint.socketPath}`;
|
||||
if (status !== this.containerProviderConnectionsStatuses.get(key)) {
|
||||
this.providerRegistry.onDidChangeContainerProviderConnectionStatus(this, providerConnection);
|
||||
this.containerProviderConnectionsStatuses.set(key, status);
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ export class TrayMenu {
|
|||
childItems: [],
|
||||
};
|
||||
this.menuContainerProviderConnectionItems.set(
|
||||
providerContainerConnectionInfoMenuItem.endpoint.socketPath,
|
||||
`${providerContainerConnectionInfoMenuItem.name}.${providerContainerConnectionInfoMenuItem.endpoint.socketPath}`,
|
||||
providerContainerConnectionInfoMenuItem,
|
||||
);
|
||||
this.updateMenu();
|
||||
|
|
@ -169,7 +169,7 @@ export class TrayMenu {
|
|||
providerContainerConnectionInfo: ProviderContainerConnectionInfo,
|
||||
): void {
|
||||
const menuProviderItem = this.menuContainerProviderConnectionItems.get(
|
||||
providerContainerConnectionInfo.endpoint.socketPath,
|
||||
`${providerContainerConnectionInfo.name}.${providerContainerConnectionInfo.endpoint.socketPath}`,
|
||||
);
|
||||
if (menuProviderItem) {
|
||||
menuProviderItem.status = providerContainerConnectionInfo.status;
|
||||
|
|
@ -181,7 +181,9 @@ export class TrayMenu {
|
|||
_provider: ProviderInfo,
|
||||
providerContainerConnectionInfo: ProviderContainerConnectionInfo,
|
||||
): void {
|
||||
this.menuContainerProviderConnectionItems.delete(providerContainerConnectionInfo.endpoint.socketPath);
|
||||
this.menuContainerProviderConnectionItems.delete(
|
||||
`${providerContainerConnectionInfo.name}.${providerContainerConnectionInfo.endpoint.socketPath}`,
|
||||
);
|
||||
this.updateMenu();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue