Skip to content

Commit

Permalink
fix: only use running podman machine
Browse files Browse the repository at this point in the history
Signed-off-by: Tim deBoer <[email protected]>
  • Loading branch information
deboer-tim committed Jan 10, 2024
1 parent c310f18 commit 4efe4eb
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,23 @@ async function pullBootcImageBuilderImage() {

// keep only the podman engine
// TODO: match by engineId from `image.engineId` instead of just looking for the first podman
const podmanConnection = providerConnections.filter(
const podmanConnections = providerConnections.filter(
providerConnection => providerConnection.connection.type === 'podman',
);

// engine running
if (podmanConnection.length < 1) {
if (podmanConnections.length < 1) {
throw new Error('No podman engine. Cannot preload images');
}

// get the running podman engine(s)
const runningPodmanConnections = providerConnections.filter(
providerConnection => providerConnection.connection.status() === 'started',
);
if (runningPodmanConnections.length < 1) {
throw new Error('No podman engine running. Cannot preload images');
}

// get the podman engine
const containerConnection = podmanConnection[0].connection;
const containerConnection = runningPodmanConnections[0].connection;

console.log('Pulling ' + bootcImageBuilderName);
await extensionApi.containerEngine.pullImage(containerConnection, bootcImageBuilderName, () => {});
Expand Down

0 comments on commit 4efe4eb

Please sign in to comment.