-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: required podman update in add node flow
- Loading branch information
Showing
12 changed files
with
142 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { | ||
PODMAN_LATEST_VERSION, | ||
PODMAN_MIN_VERSION, | ||
getInstalledPodmanVersion, | ||
} from './install/install'; | ||
import { isPodmanInstalled, isPodmanRunning } from './podman'; | ||
|
||
export type PodmanDetails = { | ||
isInstalled: boolean; | ||
isRunning?: boolean; | ||
installedVersion?: string; | ||
minimumVersionRequired?: string; | ||
latestVersionAvailable?: string; | ||
isOutdated?: boolean; // user must update podman | ||
isOptionalUpdateAvailable?: boolean; | ||
}; | ||
|
||
export const getPodmanDetails = async (): Promise<PodmanDetails> => { | ||
const isInstalled = await isPodmanInstalled(); | ||
const isRunning = await isPodmanRunning(); | ||
const installedVersion = await getInstalledPodmanVersion(); | ||
let isOutdated; | ||
if (installedVersion) { | ||
isOutdated = installedVersion < PODMAN_MIN_VERSION; | ||
} | ||
let isOptionalUpdateAvailable; | ||
// if outdated, leave as undefined because a required update takes precedent | ||
if (!isOutdated && installedVersion) { | ||
isOptionalUpdateAvailable = installedVersion < PODMAN_LATEST_VERSION; | ||
} | ||
|
||
const details: PodmanDetails = { | ||
isInstalled, | ||
isRunning, | ||
installedVersion, | ||
minimumVersionRequired: PODMAN_MIN_VERSION, | ||
latestVersionAvailable: PODMAN_LATEST_VERSION, | ||
isOutdated, | ||
isOptionalUpdateAvailable, | ||
}; | ||
|
||
return details; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/renderer/Presentational/AddNodeStepper/podmanRequirements.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { PodmanDetails } from '../../../main/podman/details'; | ||
|
||
export const arePodmanRequirementsMet = ( | ||
podmanDetails: PodmanDetails, | ||
): boolean => { | ||
let isPodmanRequirementsMet = false; | ||
if (podmanDetails?.isRunning && !podmanDetails.isOutdated) { | ||
isPodmanRequirementsMet = true; | ||
} | ||
return isPodmanRequirementsMet; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters